async unwrapKey({wrappedKey}) {
    const kek = this.key;
    // Note: `AES-GCM` algorithm name doesn't matter; will be exported raw.
    wrappedKey = base64url.decode(wrappedKey);
    try {
      const extractable = true;
      const key = await crypto.subtle.unwrapKey(
        'raw', wrappedKey, kek, kek.algorithm,
        // key usage of `encrypt` refers to the key that is being unwrapped;
        // we just treat it like an AES-GCM key regardless of what it is
        {name: 'AES-GCM'}, extractable, ['encrypt']);
      const keyBytes = await crypto.subtle.exportKey('raw', key);
      return new Uint8Array(keyBytes);
    } catch(e) {
      // unwrapping key failed
      return null;
    }
  }
/**
   * Unwraps a cryptographic key.
   *
   * @param {object} options - The options to use.
   * @param {string} options.wrappedKey - The wrapped key material as a
   *   base64url-encoded string.
   *
   * @returns {Promise<Uint8Array>} - Resolves to the key bytes or null if
   *   the unwrapping fails because the key does not match.
   */
Unwraps a cryptographic key.
@param {object} options - The options to use.
@param {string} options.wrappedKey - The wrapped key material as a
base64url-encoded string.

@returns {Promise} - Resolves to the key bytes or null if
the unwrapping fails because the key does not match.
Unwraps a cryptographic key . @param { object } options - The options to use . @param { string } options . wrappedKey - The wrapped key material as a base64url - encoded string . @returns { Promise } - Resolves to the key bytes or null if the unwrapping fails because the key does not match .
async unwrapKey({wrappedKey}) {
    const kek = this.key;
    wrappedKey = base64url.decode(wrappedKey);
    try {
      const extractable = true;
      const key = await crypto.subtle.unwrapKey(
        'raw', wrappedKey, kek, kek.algorithm,
        {name: 'AES-GCM'}, extractable, ['encrypt']);
      const keyBytes = await crypto.subtle.exportKey('raw', key);
      return new Uint8Array(keyBytes);
    } catch(e) {
      return null;
    }
  }
async unwrapKey ( { wrappedKey } ) { const kek = this . key ; wrappedKey = base64url . decode ( wrappedKey ) ; try { const extractable = true ; const key = await crypto . subtle . unwrapKey ( 'raw' , wrappedKey , kek , kek . algorithm , { name : 'AES-GCM' } , extractable , [ 'encrypt' ] ) ; const keyBytes = await crypto . subtle . exportKey ( 'raw' , key ) ; return new Uint8Array ( keyBytes ) ; } catch ( e ) { return null ; } }
Unwraps a cryptographic key.
Unwraps a cryptographic key .
// Note: `AES-GCM` algorithm name doesn't matter; will be exported raw. // key usage of `encrypt` refers to the key that is being unwrapped; // we just treat it like an AES-GCM key regardless of what it is // unwrapping key failed