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.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit_node/crypto/crypto_key_test.ts b/tests/unit_node/crypto/crypto_key_test.ts
index de941da88..ef154fc35 100644
--- a/tests/unit_node/crypto/crypto_key_test.ts
+++ b/tests/unit_node/crypto/crypto_key_test.ts
@@ -341,3 +341,16 @@ Deno.test("ECDH generateKeys compressed", function () {
const uncompressedKey = ecdh.generateKeys("binary");
assertEquals(uncompressedKey.length, 65);
});
+
+Deno.test("ECDH getPublicKey compressed", function () {
+ const ecdh = createECDH("secp256k1");
+ for (const format of ["compressed", "uncompressed"] as const) {
+ ecdh.generateKeys("binary", format);
+
+ const compressedKey = ecdh.getPublicKey("binary", "compressed");
+ assertEquals(compressedKey.length, 33);
+
+ const uncompressedKey = ecdh.getPublicKey("binary");
+ assertEquals(uncompressedKey.length, 65);
+ }
+});