`use node` Convex Auth provider
I'm trying to write a convex auth provider that uses the node
crypto
package.
Implementation: https://github.com/nickretallack/ranked-choice-convex/blob/92fbcb532aa40af85b3e613885e6bf0c694b87dd/convex/telegram/auth.ts#L9-L20
Used here https://github.com/nickretallack/ranked-choice-convex/blob/92fbcb532aa40af85b3e613885e6bf0c694b87dd/convex/auth.ts).
Unfortunately, this causes convex to produce this error:
I know the solution to this is supposed to be annotating one of my files with "use node"
, but is the file I need somewhere inside of Convex Auth?
Doesn't it make sense to have access to the node crypto
package when writing a credentials authorization function?6 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Existing auth providers use the web crypto library instead of the node one. Do you need behavior that's not supported by the built-in web crypto library?
I'm using a library that uses node's crypto library. I suppose I could fork it.
GitHub
GitHub - grammyjs/validator: Validation logic for Web Apps and logi...
Validation logic for Web Apps and login widgets. Contribute to grammyjs/validator development by creating an account on GitHub.
Porting it to SubtleCrypto worked. Thanks!
For any future readers who need node and can't switch to web crypto, the auth provider itself can't have
use node
, but it can use ctx.runAction
to call into other code that can be in a use node
file (e.g. https://github.com/get-convex/convex-auth/blob/main/test/convex/otp/TwilioOTP.ts where the Twilio SDK seems to require Node)GitHub
convex-auth/test/convex/otp/TwilioOTP.ts at main · get-convex/conve...
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.