summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/webcrypto_test.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts
index ba6aaa327..0e7e2829a 100644
--- a/cli/tests/unit/webcrypto_test.ts
+++ b/cli/tests/unit/webcrypto_test.ts
@@ -1668,3 +1668,19 @@ Deno.test(async function testAesGcmTagLength() {
);
});
});
+
+Deno.test(async function ecPrivateKeyMaterialExportSpki() {
+ // `generateKey` generates a key pair internally stored as "private" key.
+ const keys = await crypto.subtle.generateKey(
+ { name: "ECDSA", namedCurve: "P-256" },
+ true,
+ ["sign", "verify"],
+ );
+
+ assert(keys.privateKey instanceof CryptoKey);
+ assert(keys.publicKey instanceof CryptoKey);
+
+ // `exportKey` should be able to perform necessary conversion to export spki.
+ const spki = await crypto.subtle.exportKey("spki", keys.publicKey);
+ assert(spki instanceof ArrayBuffer);
+});