summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2021-08-29 17:53:51 +0530
committerGitHub <noreply@github.com>2021-08-29 14:23:51 +0200
commit5ee211017912bc0837cbce3b845e6ab4a7887885 (patch)
tree8f71f0dff5013e422f56e61e5b1623d29a3fd0f8 /cli
parent8a097410a8df3195681305818035ab7dde41452b (diff)
feat(ext/crypto): support JWK export for HMAC (#11864)
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/unit/webcrypto_test.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts
index a37e32eba..475efde6c 100644
--- a/cli/tests/unit/webcrypto_test.ts
+++ b/cli/tests/unit/webcrypto_test.ts
@@ -254,6 +254,8 @@ const jwk: JsonWebKey = {
// unpadded base64 for rawKey.
k: "AQIDBAUGBwgJCgsMDQ4PEA",
alg: "HS256",
+ ext: true,
+ "key_ops": ["sign"],
};
unitTest(async function subtleCryptoHmacImportExport() {
@@ -297,7 +299,10 @@ unitTest(async function subtleCryptoHmacImportExport() {
new Uint8Array(actual2),
expected,
);
- // TODO(@littledivy): Add a test for exporting JWK key when supported.
- const exportedKey = await crypto.subtle.exportKey("raw", key1);
- assertEquals(new Uint8Array(exportedKey), rawKey);
+
+ const exportedKey1 = await crypto.subtle.exportKey("raw", key1);
+ assertEquals(new Uint8Array(exportedKey1), rawKey);
+
+ const exportedKey2 = await crypto.subtle.exportKey("jwk", key2);
+ assertEquals(exportedKey2, jwk);
});