activescott / activescott/auth

email-provider: can magiclink and otp be consolidated to simplify the internal implementation and usage of the email-providre?

Đang mở
#39 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
0
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.