@praecise/tere
Version:
Trusted Execution Runtime Environment SDK
89 lines (88 loc) • 2.98 kB
TypeScript
import { TereOptions, DeployOptions, ExecuteOptions, DeployResponse, ExecuteResponse, ScriptInfo, VerifyAttestationOptions, VerifyAttestationResult, HsmKeyInfo } from './types';
/**
* Main client for interacting with the TERE service
*/
export declare class TereClient {
private endpoint;
private httpClient;
/**
* Create a new TERE client
* @param options Client configuration options
*/
constructor(options?: TereOptions);
/**
* Deploy a TERE script to a Trusted Execution Environment
* @param options Deployment options
* @returns Deployment result
*/
deploy(options: DeployOptions): Promise<DeployResponse>;
/**
* Execute a function in a deployed script
* @param options Execute options
* @returns Execution result
*/
execute(options: ExecuteOptions): Promise<ExecuteResponse>;
/**
* Get the status of an asynchronous job
* @param jobId ID of the job to check
* @returns Current job status and result if completed
*/
getJobStatus(jobId: string): Promise<ExecuteResponse>;
/**
* List all deployed scripts
* @returns Array of script information
*/
listScripts(): Promise<ScriptInfo[]>;
/**
* Get information about a specific script
* @param scriptId ID of the script
* @returns Script information
*/
getScript(scriptId: string): Promise<ScriptInfo>;
/**
* Start a stopped instance
* @param scriptId ID of the script
*/
startInstance(scriptId: string): Promise<void>;
/**
* Stop a running instance
* @param scriptId ID of the script
*/
stopInstance(scriptId: string): Promise<void>;
/**
* Delete a deployed script
* @param scriptId ID of the script
* @param options Options for deletion
*/
deleteScript(scriptId: string, options?: {
preserveState?: boolean;
}): Promise<void>;
/**
* Verify an attestation
* @param options Verification options
* @returns Verification result
*/
verifyAttestation(options: VerifyAttestationOptions): Promise<VerifyAttestationResult>;
/**
* List HSM keys available for a script
* @param scriptId ID of the script
* @returns List of HSM keys and their details
*/
listHsmKeys(scriptId: string): Promise<HsmKeyInfo[]>;
/**
* Create a new HSM key for a script
* @param scriptId ID of the script
* @param keyId ID for the new key
* @param purpose Purpose of the key ('encrypt', 'sign', 'decrypt')
* @param algorithm Optional algorithm specification
* @returns Details of the created key
*/
createHsmKey(scriptId: string, keyId: string, purpose: string, algorithm?: string): Promise<HsmKeyInfo>;
/**
* Handle errors from API calls
* @param error Original error
* @param defaultMessage Default error message
* @returns Properly formatted TereError
*/
private handleError;
}