diff options
Diffstat (limited to 'cli/tests/unit/webcrypto_test.ts')
-rw-r--r-- | cli/tests/unit/webcrypto_test.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts index 4e1a31eaa..829330eba 100644 --- a/cli/tests/unit/webcrypto_test.ts +++ b/cli/tests/unit/webcrypto_test.ts @@ -2006,3 +2006,42 @@ Deno.test(async function testHmacJwkImport() { ["sign", "verify"], ); }); + +Deno.test(async function p521Import() { + const jwk = { + "crv": "P-521", + "ext": true, + "key_ops": [ + "verify", + ], + "kty": "EC", + "x": + "AXkSI8nfkc6bu3fifXGuKKbu08g5LKPfxUNQJJYzzPgmN8XLDzx0C9Sdeejl1XoWGrheKPHl0k4tUmHw0cdInpfj", + "y": + "AT4vjsO0bzVRlN3Wthv9DewncDXS2tlTob5QojV8WX1GzOAikRfWFEP3nspoSv88U447acZAsk5IvgGJuVjgMDlx", + }; + const algorithm = { name: "ECDSA", namedCurve: "P-521" }; + + const key = await crypto.subtle.importKey( + "jwk", + jwk, + algorithm, + true, + ["verify"], + ); + + assert(key instanceof CryptoKey); +}); + +Deno.test(async function p521Generate() { + const algorithm = { name: "ECDSA", namedCurve: "P-521" }; + + const key = await crypto.subtle.generateKey( + algorithm, + true, + ["sign", "verify"], + ); + + assert(key.privateKey instanceof CryptoKey); + assert(key.publicKey instanceof CryptoKey); +}); |