AlexA
Convex Community11mo ago
1 reply
Alex

Is crypto.subtle.encrypt() supported?

I'm trying to encrypt data within a mutation. From the docs and discord conversations I understand that crypto.subtle is partially supported. However when I attempt to use the following code I get this error message:

Not implemented: encrypt for SubtleCrypto. Consider calling an action defined in Node.js instead (https://docs.convex.dev/functions/actions).

Here's the code:

const encryptedBuffer = await crypto.subtle.encrypt(
{
name: 'AES-GCM',
iv: iv,
},
key,
data
);

I understand that I could use the node environment instead, but ideally I'd like to use encryption directly within the mutation. Any pointers would be really appreciated!
Was this page helpful?