From aa710aac98885356cfb5bdfd237d2be8265ed2e6 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Tue, 4 Oct 2022 13:39:41 +0200 Subject: fix(ext/crypto): ecdh spki key import/export roundtrip (#16152) --- cli/tests/unit/webcrypto_test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cli/tests/unit') diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts index c5f5dc6c2..38f183c11 100644 --- a/cli/tests/unit/webcrypto_test.ts +++ b/cli/tests/unit/webcrypto_test.ts @@ -1919,3 +1919,13 @@ Deno.test(async function testImportLeadingZeroesKey() { assert(key instanceof CryptoKey); assertEquals(key.type, "private"); }); + +// https://github.com/denoland/deno/issues/15523 +Deno.test(async function testECspkiRoundTrip() { + const alg = { name: "ECDH", namedCurve: "P-256" }; + const { publicKey } = await crypto.subtle.generateKey(alg, true, [ + "deriveBits", + ]); + const spki = await crypto.subtle.exportKey("spki", publicKey); + await crypto.subtle.importKey("spki", spki, alg, true, []); +}); -- cgit v1.2.3