MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / getKey

Method getKey

sdk/js/src/index.ts:216–229  ·  view source on GitHub ↗
(path: string, purpose: string = '', algorithm: string = 'secp256k1')

Source from the content-addressed store, hash-verified

214 }
215
216 async getKey(path: string, purpose: string = '', algorithm: string = 'secp256k1'): Promise<GetKeyResponse> {
217 await this.ensureAlgorithmSupported(algorithm)
218 const payload = JSON.stringify({
219 path: path,
220 purpose: purpose,
221 algorithm: algorithm
222 })
223 const result = await send_rpc_request<{ key: string, signature_chain: string[] }>(this.endpoint, '/GetKey', payload)
224 return Object.freeze({
225 key: new Uint8Array(Buffer.from(result.key, 'hex')),
226 signature_chain: result.signature_chain.map(sig => new Uint8Array(Buffer.from(sig, 'hex'))),
227 __name__: 'GetKeyResponse',
228 })
229 }
230
231 async getTlsKey(options: TlsKeyOptions = {}): Promise<GetTlsKeyResponse> {
232 const {

Callers 4

mainFunction · 0.95
index.test.tsFile · 0.80
viem.test.tsFile · 0.80
solana.test.tsFile · 0.80

Calls 2

fromMethod · 0.45

Tested by

no test coverage detected