()
| 87 | } |
| 88 | |
| 89 | export async function generateKeyPair(): Promise<EncryptionKeyPair> { |
| 90 | const ecdh = createECDH('prime256v1'); |
| 91 | ecdh.generateKeys(); |
| 92 | |
| 93 | const publicKey = ecdh.getPublicKey(); |
| 94 | const privateKey = ecdh.getPrivateKey(); |
| 95 | |
| 96 | encryptionLogger.debug(`Generated key pair`, { publicKey, privateKey }); |
| 97 | |
| 98 | return { |
| 99 | privateKey, |
| 100 | publicKey, |
| 101 | }; |
| 102 | } |
| 103 | |
| 104 | export async function deriveSharedKey( |
| 105 | privateKey: Buffer, |
no outgoing calls
no test coverage detected