1 import { decryptData, encryptDataWith16ByteIV } from '@proton/crypto/lib/subtle/aesGcm';
4 base64StringToUint8Array,
6 uint8ArrayToBase64String,
8 } from '../helpers/encoding';
10 export const getEncryptedBlob = async (key: CryptoKey, data: string, additionalData?: Uint8Array) => {
11 const result = await encryptDataWith16ByteIV(key, stringToUint8Array(data), additionalData);
12 return uint8ArrayToBase64String(result);
15 export const getDecryptedBlob = async (key: CryptoKey, blob: string, additionalData?: Uint8Array) => {
16 const result = await decryptData(key, base64StringToUint8Array(blob), additionalData, true);
17 return uint8ArrayToString(result);