@neardefi/shade-agent-js
Version:
This library is intended to be used in conjunction with the [shade agent template](https://github.com/NearDeFi/shade-agent-template/).
29 lines (27 loc) • 1.31 kB
text/typescript
/**
* Gets the worker ephemeral account from the shade-agent-js api docker app
* TODO error handling and return type checking
*/
declare function getAgentAccount(): Promise<any>;
/**
* Gets a signature with the worker account using the path and payload provided
* @param {String} path - need a path to call MPC contract
* @param {String} payload - need a payload (array of bytes) to sign
* @returns {Promise<any>} The derived account ID
*
* TODO error handling and return type checking
*/
declare function signWithAgent(path: String, payload: Array<Number>): Promise<any>;
/**
* Derives a worker account using TEE-based entropy
* @param {Buffer | undefined} hash - User provided hash for seed phrase generation. When undefined, it will try to use TEE hardware entropy or JS crypto.
* @returns {Promise<string>} The derived account ID
*/
declare function deriveAgentAccount(hash: Buffer | undefined): Promise<string>;
/**
* Registers a worker with the contract
* @param {String | undefined} codehash - User provided codehash for proxy contract, running locally and NOT in a TEE
* @returns {Promise<boolean>} Result of the registration
*/
declare function registerAgent(codehash: String | undefined): Promise<any>;
export { deriveAgentAccount, getAgentAccount, registerAgent, signWithAgent };