async function subtleDecryptData(data, password, cipher = 'aes-gcm') {
  const pwUtf8 = new TextEncoder().encode(password); // encode password as UTF-8
  const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8); // hash the password
  const iv = new Uint8Array(data.slice(0,12)); // decode base64 iv
  const alg = { name: cipher.toUpperCase(), iv: iv }; // specify algorithm to use
  const key = await crypto.subtle.importKey('raw', pwHash, alg, false, ['decrypt']); // generate key from pw

  const ctUint8 = new Uint8Array(data.slice(12)); // decode base64 ciphertext

  const plainBuffer = await crypto.subtle.decrypt(alg, key, ctUint8); // decrypt ciphertext using key
  return new Uint8Array(plainBuffer);

}
Decrypts ciphertext encrypted with dataEncrypt() using supplied password.
@param   {Uint8Array} data - Ciphertext to be decrypted.
@param   {String} password - Password to use to decrypt ciphertext.
@param   {String} [cipher=aes-gcm] - Algorithm to use.
@returns {Uint8Array} Decrypted data.
@example const data = await aesGcmDecrypt(uint8array, 'password');