mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
crypto: update Wrapping and unwrapping keys webcrypto example
PR-URL: https://github.com/nodejs/node/pull/43452 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
6ac55fa337
commit
f9db8840ad
@ -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(
|
||||
@ -238,7 +238,7 @@ async function unwrapHmacKey(
|
||||
const key = await subtle.unwrapKey(
|
||||
format,
|
||||
wrappedKey,
|
||||
unwrappingKey,
|
||||
wrappingKey,
|
||||
'AES-KW',
|
||||
{ name: 'HMAC', hash },
|
||||
true,
|
||||
|
Loading…
Reference in New Issue
Block a user