activescott / activescott/auth
email-provider: can magiclink and otp be consolidated to simplify the internal implementation and usage of the email-providre?
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.