How rlnorthcutt/go-passwordless works
Project type and purpose
• This is a Go-language “passwordless authentication” library, not a standalone frontend/backend application.
• It provides a Manager orchestration layer, pluggable Stores for token persistence, and pluggable Transports for delivering one-time codes or links.
File structure
• Top-level packages and files:
• passwordless.go / onetimelogin.go / config.go – core manager logic, helpers, configuration
• store/ – token persistence interfaces and implementations (MemStore, DbStore, file, cookie, session helpers)
• transport/ – delivery interfaces and implementations (LogTransport, SMTPTransport)
• mocksmtp/ – test-only SMTP server implementation
• examples/ – sample client programs demonstrating CLI, REST API, file-based, SMTP auth
• Config & CI: .devcontainer, GitHub workflows, go.mod, tests, mocks.
README for additional insights
• Key flow: StartLogin → generate & store token → Transport.Send → user receives code/link → VerifyLogin → validate & delete token.
• Interfaces: Store (Create, Fetch, Delete), Transport (Send).
• External dependencies: securecookie, modernc.org/sqlite, net/smtp.
Detail without over-engineering
• Every Store implementation and every Transport implementation as subcomponents.
• Mocksmtp package in a “Testing” or “Dev” boundary.
• Examples/ folder as “Sample Integrations” off to one side.
• The central Manager module, its two plugin points (Store and Transport),
• All store & transport variants,
• External dependencies, and
• How a client application integrates and drives the passwordless flow.