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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
panva authored and targos committed Jul 12, 2022
1 parent d0c78d2 commit 9bd13bb
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 9bd13bb

Please sign in to comment.