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:
Filip Skokan
2022-06-20 15:42:33 +02:00
committed by GitHub
parent 6ac55fa337
commit f9db8840ad

View File

@@ -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,