async function decode(password, encryptedSecret) {
if (typeof encryptedSecret === 'string') encryptedSecret = JSON.parse(encryptedSecret)
const key = await deriveKey(password, decode64(encryptedSecret.salt));
const secret = await window.crypto.subtle.decrypt(
{
name: encryptedSecret.name,
iv: decode64(encryptedSecret.iv)
},
key,
decode64(encryptedSecret.ciphertext)
);
return new TextDecoder().decode(secret)
}