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

Function toKeypair

sdk/js/src/solana.ts:13–22  ·  view source on GitHub ↗
(keyResponse: GetTlsKeyResponse | GetKeyResponse)

Source from the content-addressed store, hash-verified

11 * Current implementation uses raw key material without proper hashing.
12 */
13export function toKeypair(keyResponse: GetTlsKeyResponse | GetKeyResponse) {
14 // Keep legacy behavior for GetTlsKeyResponse, but with warning.
15 if (keyResponse.__name__ === 'GetTlsKeyResponse') {
16 console.warn('toKeypair: Please don\'t use `deriveKey` method to get key, use `getKey` instead.')
17 // Restored original behavior: using first 32 bytes directly
18 const bytes = keyResponse.asUint8Array(32)
19 return Keypair.fromSeed(bytes)
20 }
21 return Keypair.fromSeed(keyResponse.key)
22}
23
24/**
25 * Creates a Solana Keypair from DeriveKeyResponse using secure key derivation.

Callers 2

solana.test.tsFile · 0.90
mainFunction · 0.85

Calls 1

asUint8ArrayMethod · 0.45

Tested by

no test coverage detected