deno.com
method SubtleCrypto.unwrapKey
#SubtleCrypto.unwrapKey(
format: KeyFormat,
wrappedKey: BufferSource,
unwrappingKey: CryptoKey,
extractable: boolean,
keyUsages: KeyUsage[],
): Promise<CryptoKey>

Unwraps (decrypts) a previously wrapped key.

Examples #

#
// Unwrap an AES-GCM key wrapped with AES-KW
const unwrappedKey = await crypto.subtle.unwrapKey(
  "jwk", // Format of the key to import
  wrappedKey, // Encrypted key data as ArrayBuffer
  unwrappingKey, // CryptoKey used for unwrapping
  { name: "AES-KW" }, // Unwrapping algorithm
  { name: "AES-GCM", length: 256 }, // Algorithm for unwrapped key
  true, // Whether the unwrapped key is extractable
  ["encrypt", "decrypt"] // Allowed key usages
);

Parameters #

#format: KeyFormat
#wrappedKey: BufferSource
#unwrappingKey: CryptoKey
#extractable: boolean
#keyUsages: KeyUsage[]

Return Type #

Promise<CryptoKey>

See #