如何在 Cloudflare 中访问名为“ENCRYPTION_KEY”的密钥/环境变量并将其用作解密密钥而不是在我的 JavaScript 代码中进行硬编码?具体来说,我有一个使用作为常量存储的密码解密数据的函数。我想用密钥的值替换硬编码密码。这是相关代码的示例:
const password = 'my_hardcoded_password';
async function decryptData(data, password) {
const decoder = new TextDecoder();
const encoder = new TextEncoder();
// Decryption logic here
}
// I want to replace this hardcoded password with the value of the secret key
const decryptedData = await decryptData(encryptedData, password);
我不记得我尝试了什么,但我问了 chatgpt 几个问题然后求助于来这里