Recent
:
Back to Boston Children’s with my daughter. Since the winter storm is upon us and the other patients canceled, I’m hoping the appointment will go a bit quicker than the scheduled five hours. Hopefully the snow isn’t too bad when we head out. âī¸
Private key (AES-CBC) encryption and decryption in Deno
I found myself needing to encrypt a small string on Deno (and subsequently decrypt it later) for a small side project. I checked out a few websites with code samples. But those didn’t work/were out of date. So this is what worked for me:
Note: I am not a security expert and I don’t play one on TV. You shouldn’t trust anything important with random code you found on the internet. Seriously.
1. Save the key
First we generate a key using the standard SubtleCrypto api that ships with Deno. Then export a JSON webkey and save it. I’m putting it in an environmental variable. âĻ
Featured Adventures