MCPcopy Create free account
hub / github.com/bytespider/Meross / createKeyPair

Function createKeyPair

packages/lib/src/encryption.ts:73–87  ·  view source on GitHub ↗
(
  privateKey: Buffer
)

Source from the content-addressed store, hash-verified

71}
72
73export 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
89export async function generateKeyPair(): Promise<EncryptionKeyPair> {
90 const ecdh = createECDH('prime256v1');

Callers 1

setPrivateKeyMethod · 0.85

Calls 1

setPrivateKeyMethod · 0.80

Tested by

no test coverage detected