Skip to content

Commit

Permalink
crypto: update Wrapping and unwrapping keys webcrypto example
Browse files Browse the repository at this point in the history
PR-URL: #43452
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
panva authored Jun 20, 2022
1 parent 6ac55fa commit f9db884
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/api/webcrypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async function generateAndWrapHmacKey(format = 'jwk', hash = 'SHA-512') {

const wrappedKey = await subtle.wrapKey(format, key, wrappingKey, 'AES-KW');

return wrappedKey;
return { wrappedKey, wrappingKey };
}

async function unwrapHmacKey(
Expand All @@ -238,7 +238,7 @@ async function unwrapHmacKey(
const key = await subtle.unwrapKey(
format,
wrappedKey,
unwrappingKey,
wrappingKey,
'AES-KW',
{ name: 'HMAC', hash },
true,
Expand Down

0 comments on commit f9db884

Please sign in to comment.