diff options
-rw-r--r-- | cli/tests/unit/webcrypto_test.ts | 15 | ||||
-rw-r--r-- | ext/crypto/00_crypto.js | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts index 10acc7940..86d9f38ab 100644 --- a/cli/tests/unit/webcrypto_test.ts +++ b/cli/tests/unit/webcrypto_test.ts @@ -1965,3 +1965,18 @@ Deno.test(async function testECspkiRoundTrip() { const spki = await crypto.subtle.exportKey("spki", publicKey); await crypto.subtle.importKey("spki", spki, alg, true, []); }); + +Deno.test(async function testHmacJwkImport() { + await crypto.subtle.importKey( + "jwk", + { + kty: "oct", + use: "sig", + alg: "HS256", + k: "hJtXIZ2uSN5kbQfbtTNWbpdmhkV8FJG-Onbc6mxCcYg", + }, + { name: "HMAC", hash: "SHA-256" }, + false, + ["sign", "verify"], + ); +}); diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 857283623..fac407d88 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -2880,10 +2880,10 @@ // 7. if ( - keyUsages.length > 0 && jwk.use !== undefined && jwk.use !== "sign" + keyUsages.length > 0 && jwk.use !== undefined && jwk.use !== "sig" ) { throw new DOMException( - "'use' property of JsonWebKey must be 'sign'", + "'use' property of JsonWebKey must be 'sig'", "DataError", ); } |