xxxxxxxxxx
async function encryptWithAes(data, key, iv) {
// const passwordBits = prescriptionID;
let passwordBits = iv;
return await crypto.subtle.encrypt(
{
name: 'AES-GCM',
iv: passwordBits,
},
key,
data
);
}
// Function to decrypt data with AES-GCM
async function decryptWithAes(encryptedData, aesKey, iv) {
const decryptedData = await window.crypto.subtle.decrypt(
{
name: "AES-GCM",
iv: iv,
},
aesKey,
encryptedData
);
return decryptedData;
}
xxxxxxxxxx
async function encryptWithAes(data, key, iv) {
// const passwordBits = prescriptionID;
let passwordBits = iv;
return await crypto.subtle.encrypt(
{
name: 'AES-GCM',
iv: passwordBits,
},
key,
data
);
}