add passkey support
ci/woodpecker/push/e2e Pipeline failed
ci/woodpecker/push/fmt Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
2026-08-02 16:46:52 -04:00
parent 04c9724c76
commit fdd3e8c5da
18 changed files with 1073 additions and 28 deletions
+10 -1
View File
@@ -8,7 +8,13 @@ A small shared grocery list built with Rust, Axum, Maud, htmx, WebSockets, and S
cargo run
```
Open <http://127.0.0.1:3000>. The application creates `sustenance.db` in the working directory on first start.
Open <http://localhost:3000>. The application creates `sustenance.db` in the
working directory on first start.
**Note:** use `localhost` (not `127.0.0.1`) when testing passkeys locally —
browsers reject IP addresses as WebAuthn RP IDs. The app defaults to
`localhost` for loopback hosts, so passkeys work out of the box when you access
the site via `http://localhost:3000`.
## Configuration
@@ -20,6 +26,8 @@ Open <http://127.0.0.1:3000>. The application creates `sustenance.db` in the wor
| `COOKIE_SECURE` | `false` | Add the `Secure` attribute to session cookies |
| `REGISTRATION_MODE` | `invite_only` | Use `open` for local development; otherwise registration requires a valid list invitation after the first account |
| `SEED_CONFIG` | `seed.json` | Optional JSON file with a default user to create when the database is first initialized |
| `RP_ID` | derived from `PUBLIC_BASE_URL` | WebAuthn relying party ID (the host users access the site from) |
| `RP_NAME` | `Sustenance` | WebAuthn relying party name shown to users |
| `RUST_LOG` | `sustenance=info,tower_http=info` | Log filter; HTTP requests are logged at info level |
### Seeding a default user
@@ -41,6 +49,7 @@ The file is optional — if it is missing or invalid, seeding is silently skippe
## Current features
- Email/password accounts with Argon2 password hashes
- Optional WebAuthn passkeys for passwordless sign-in (managed from the account page)
- Cookie-backed sessions and CSRF tokens for list mutations
- Shared lists with one-time, seven-day invitation links
- Invite-only registration by default after the first account