( privateKey: Buffer )
| 71 | } |
| 72 | |
| 73 | export async function createKeyPair( |
| 74 | privateKey: Buffer |
| 75 | ): Promise<EncryptionKeyPair> { |
| 76 | const ecdh = createECDH('prime256v1'); |
| 77 | ecdh.setPrivateKey(privateKey); |
| 78 | |
| 79 | const publicKey = ecdh.getPublicKey(); |
| 80 | |
| 81 | encryptionLogger.debug(`Created key pair`, { publicKey }); |
| 82 | |
| 83 | return { |
| 84 | privateKey, |
| 85 | publicKey, |
| 86 | }; |
| 87 | } |
| 88 | |
| 89 | export async function generateKeyPair(): Promise<EncryptionKeyPair> { |
| 90 | const ecdh = createECDH('prime256v1'); |
no test coverage detected