Skip to main content
Module

x/fastro/crypto/decrypt.ts

Fast and simple web application framework for deno
Go to Latest
File
export function decryptData( key: CryptoKey, encryptedData: string,) { const encryptedDataArray = new Uint8Array( atob(encryptedData).split("").map((char) => char.charCodeAt(0)), ); return crypto.subtle.decrypt( { name: key.algorithm.name, iv: new Uint8Array(12) }, key, encryptedDataArray, ).then((decryptedData) => { return new TextDecoder().decode(decryptedData); });}