(cipher, pass, base64)
| 297 | |
| 298 | |
| 299 | async function encryptData(cipher, pass, base64) { |
| 300 | let encrypted = await subtleEncryptData(base64, pass); |
| 301 | return encrypted |
| 302 | return new Promise((resolve, reject) => { |
| 303 | loadScript("/js/crypto-js.min.js").then(() => { |
| 304 | console.log("encrypting", cipher) |
| 305 | let encrypted = CryptoJS[cipher.toUpperCase()].encrypt(base64, pass); |
| 306 | return resolve(CryptoJS.enc.Base64.stringify(encrypted)); |
| 307 | }) |
| 308 | }) |
| 309 | } |
| 310 | async function decryptData(cipher, base64, password) { |
| 311 | console.log("🔐 Decrypting data:", cipher); |
| 312 | let pass = password || prompt("This page is encrypted. What's the passcode?"); |
no test coverage detected