activescott / activescott/auth

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

オープン
#39 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
0
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。