summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto/diffiehellman.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/internal/crypto/diffiehellman.ts')
-rw-r--r--ext/node/polyfills/internal/crypto/diffiehellman.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/node/polyfills/internal/crypto/diffiehellman.ts b/ext/node/polyfills/internal/crypto/diffiehellman.ts
index 4b105e575..da7907734 100644
--- a/ext/node/polyfills/internal/crypto/diffiehellman.ts
+++ b/ext/node/polyfills/internal/crypto/diffiehellman.ts
@@ -1236,12 +1236,18 @@ export class ECDH {
generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
generateKeys(
encoding?: BinaryToTextEncoding,
- _format?: ECDHKeyFormat,
+ format: ECDHKeyFormat = "uncompressed",
): Buffer | string {
+ this.#pubbuf = Buffer.alloc(
+ format.trim() == "compressed"
+ ? this.#curve.publicKeySizeCompressed
+ : this.#curve.publicKeySize,
+ );
op_node_ecdh_generate_keys(
this.#curve.name,
this.#pubbuf,
this.#privbuf,
+ format,
);
if (encoding !== undefined) {