mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02: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
1 changed files with 2 additions and 2 deletions
|
@ -226,7 +226,7 @@ async function generateAndWrapHmacKey(format = 'jwk', hash = 'SHA-512') {
|
||||||
|
|
||||||
const wrappedKey = await subtle.wrapKey(format, key, wrappingKey, 'AES-KW');
|
const wrappedKey = await subtle.wrapKey(format, key, wrappingKey, 'AES-KW');
|
||||||
|
|
||||||
return wrappedKey;
|
return { wrappedKey, wrappingKey };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unwrapHmacKey(
|
async function unwrapHmacKey(
|
||||||
|
@ -238,7 +238,7 @@ async function unwrapHmacKey(
|
||||||
const key = await subtle.unwrapKey(
|
const key = await subtle.unwrapKey(
|
||||||
format,
|
format,
|
||||||
wrappedKey,
|
wrappedKey,
|
||||||
unwrappingKey,
|
wrappingKey,
|
||||||
'AES-KW',
|
'AES-KW',
|
||||||
{ name: 'HMAC', hash },
|
{ name: 'HMAC', hash },
|
||||||
true,
|
true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue