Laravel Two-Factor Rust
Codes from an authenticator app for Laravel for Rust, with QR codes and recovery codes.
cargo add laravel-two-factor-rust
Try it
Scan the code with an authenticator app, then type the code it shows. The secret lives in your session only, and nothing is stored.
- Secret
- UBCMWSKTOITLGFNLFAQS2PCNN4UK5QEZ
- Code right now
- 130829
The otpauth URL and the recovery codes
otpauth://totp/Mischa%20Sigtermans:demo%40mischa.sigtermans.me?secret=UBCMWSKTOITLGFNLFAQS2PCNN4UK5QEZ&issuer=Mischa%20Sigtermans&algorithm=SHA1&digits=6&period=30
H0KgqCe9gC-fvv0VwZjpb
fAyybJEjtk-luL1dA8bQu
LxlKfMyH1e-kudgqxbsYQ
555PxhCL52-PgrngrlRII
AOE9gS5emF-kwkWpLiieU
Vth3KBGIU9-CuQvs7Umgr
WVAtr539yV-b9QS1V2rFM
y8I5JB5KT0-sY7TUxKiMP
The demo above keeps its secret in your session only, so scan it, try a code, and close the tab.
What it does
-
Any authenticator app
Codes follow RFC 6238, so Google Authenticator, 1Password, Authy and every app that scans a QR code work.
-
A code works once
verify_once lets each code through once per user, so a code someone saw over your shoulder is already spent.
-
Recovery codes
Eight codes that each log in once. A used one is replaced, so the user always has eight.
-
A shared rate limit
attempt() limits the tries per user, shared by confirming, logging in and recovering.
Hi, I'm Mischa. I've been shipping products and building ventures for over a decade. First exit at 25, second at 30. Now Partner & CPO at Ryde Ventures, an AI venture studio in Amsterdam. Currently shipping Stagent, TAP and Steddle. I write about what I learn along the way. More about me.
You might also enjoy: A directory is worthless, a registrar isn't.