Behavior of secrets / environment variables with newlines (escaped / unescaped characters)

Now that's weird. When I put my key in a variable in the code (let key = "..."), it works perfectly but if I put the same key (I copy pasted it) in a secret, the importPKCS8() function results in an error : atob() called with invalid base64-encoded data. (Only whitespace, '+', '/', alphanumeric ASCII, and up to two terminal '=' signs when the input data length is divisible by 4 are allowed.) So it works but I would prefer to have the value in a secret since it's the key to my Google Cloud Service Account so it's not great for security to literally have it in my code...
3 Replies
ItsWendell
ItsWendell•2y ago
Seems like this exact issue still exists, e.g. when you have public / private keys in secrets in cloudflare, and you put them in secrets, they get returned in an escaped format. Did you ever find a clean solution to this? @gamengineer314 ?
sathoro
sathoro•2y ago
store as b64 and decode?
Gamengineer314
Gamengineer314•2y ago
I think I put it in a KV from the code (and then you can delete it in your code and use the KV). I'm not sure if it's really clean but it's better than nothing 😅
Want results from more Discord servers?
Add your server