Skip to content

Commit 3afba0f

Browse files
committed
docs: improve readme example
1 parent f807885 commit 3afba0f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ totpAuthenticator.use(
2323
},
2424
async (data) => {
2525
const { event, request } = data;
26+
// this part is a example, dev can use a cookie to store the code and email to validate user magic link
27+
// or store in a database to validate user magic link.
28+
// there is 2 events, send-email and verify-code.
29+
// send-email is used to send the email to the user with the code and magic link.
30+
// verify-code is used to verify the code and email with the logic you prefer.
2631
if (event === "send-email") {
32+
// send-email event
2733
const { email, code } = data;
2834
console.log(`\x1b[35m[DEV ONLY]:\x1b[0m \x1b[42m${code}\x1b[0m`);
2935

@@ -46,11 +52,11 @@ totpAuthenticator.use(
4652
});
4753
}
4854

55+
// verify-code event
4956
return {
5057
id: "1",
5158
email: "",
5259
};
53-
// TODO: validate data
5460
},
5561
),
5662
"totp",

0 commit comments

Comments
 (0)