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: nodejs/node#43452
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
panva authored and guangwong committed Oct 10, 2022
1 parent 79f1519 commit addc935
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 addc935

Please sign in to comment.