summaryrefslogtreecommitdiff
path: root/tests/unit_node/crypto/crypto_key_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_node/crypto/crypto_key_test.ts')
-rw-r--r--tests/unit_node/crypto/crypto_key_test.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit_node/crypto/crypto_key_test.ts b/tests/unit_node/crypto/crypto_key_test.ts
index bcb47b5a7..5fa36bd11 100644
--- a/tests/unit_node/crypto/crypto_key_test.ts
+++ b/tests/unit_node/crypto/crypto_key_test.ts
@@ -2,6 +2,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import {
+ createECDH,
createHmac,
createPrivateKey,
createPublicKey,
@@ -313,3 +314,12 @@ Deno.test("createPublicKey SPKI for DH", async function () {
assertEquals(pubKey.asymmetricKeyType, "ec");
assertEquals(privKey.asymmetricKeyType, "ec");
});
+
+Deno.test("ECDH generateKeys compressed", function () {
+ const ecdh = createECDH("secp256k1");
+ const publicKey = ecdh.generateKeys("binary", "compressed");
+ assertEquals(publicKey.length, 33);
+
+ const uncompressedKey = ecdh.generateKeys("binary");
+ assertEquals(uncompressedKey.length, 65);
+});