MeexaM
Convex Community12mo ago
6 replies
Meexa

What is the recommended way to do encryption?

I’m trying to encrypt API keys into a document but I’m running into some issues. I wanted to use node:crypto but I need the node environment for that but that environment doesn’t allow mutations. So I tried using the web crypto module but that is not fully implemented so I can’t get that working either.

My other options are third-party libraries but crypto-js is deprecated and the alternatives seem unreliable

I need to decrypt the value again later, so I can’t encrypt on the client either.

I tried using an action but:
- feels clunky because I can’t access the DB directly
- typescript breaks when I return a value from the action

What do I do?
Was this page helpful?