activescott / activescott/auth
email-provider: can magiclink and otp be consolidated to simplify the internal implementation and usage of the email-providre?
- Langage dominant
- TypeScript
- Étoiles
- 0
- Forks
- 1
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
In https://github.com/activescott/auth/blob/ade8601c4673589fbf6d3f4387976a4a5dea3a91/packages/auth-provider-email/src/email-provider.ts#L92-L114 we have different code to generate a "link key" separate from generating an OTP code. Since OTP codes and link keys are very similar in purpose, I wonder the "link key" can't simply be an OTP code. The separation of OTP and link key is scattered a bit throughout the code so it isn't just this one block of code. Some other notable places the duplication impacts that I noticed (there may be more):
- EmailTransport.sendMagicLink: Has to deal with both magiclink and options arg (SendMagicLinkOptions) includes the OTP code. Why isn't this more like "sendMessage" and includes an OTP. I wonder if unifying on OTP for the magic link can even be further DRYd up with SMS transport.
- the EmailProvider.verify implementation has to deal with boduy.challenge and body.key and body.code.
- examples/react-router/app/lib/capture-email-transport.server.ts ends up with "sendMagicLink" which seems overfitted to the purpose here sinc eit sends a code.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.