sign up hook
on user sign up i need to generate him a key pair and encode the private key with his password, then save it to the user table in database, how can i do it in better auth?
1 Reply
That's definitely going to be tough.
What I recommend is to make a custom endpoint to do then manually call auth.api.signUpEmail and then pass that private key there.
Make sure to add the user additionalFields for this private key (read our docs on additional fields under
concept>typescript
)
Then in your auth config, add a before
hook to ensure that the signup endpoint can only be called from the server. For example: