diff options
author | EduM22 <38257387+EduM22@users.noreply.github.com> | 2022-04-07 14:58:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 18:28:56 +0530 |
commit | 181e378032757938be88d8a02d6f87be191b47e2 (patch) | |
tree | 88ca10d6f72821536db7956e444a7b45ef7c5901 /cli/tests/unit/webcrypto_test.ts | |
parent | b8d66a683a72e6d3b48e44d08fcdae433e4fb755 (diff) |
fix(ext/crypto): check extractable in exportKey (#14222)
Diffstat (limited to 'cli/tests/unit/webcrypto_test.ts')
-rw-r--r-- | cli/tests/unit/webcrypto_test.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts index 94f011bae..63adaddc7 100644 --- a/cli/tests/unit/webcrypto_test.ts +++ b/cli/tests/unit/webcrypto_test.ts @@ -1750,3 +1750,23 @@ Deno.test(async function importJwkWithUse() { assert(key instanceof CryptoKey); }); + +// https://github.com/denoland/deno/issues/14215 +Deno.test(async function exportKeyNotExtractable() { + const key = await crypto.subtle.generateKey( + { + name: "HMAC", + hash: "SHA-512", + }, + false, + ["sign", "verify"], + ); + + assert(key); + assertEquals(key.extractable, false); + + await assertRejects(async () => { + // Should fail + await crypto.subtle.exportKey("raw", key); + }, DOMException); +}); |