(keyResponse: GetTlsKeyResponse | GetKeyResponse)
| 11 | * Current implementation uses raw key material without proper hashing. |
| 12 | */ |
| 13 | export 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. |
no test coverage detected