Passkey-Anmeldung (WebAuthn) zusätzlich zum Passwort

- Tabelle passkeys + lib/passkeys.ts (CRUD, Counter-Replay-Schutz)
- lib/webauthn.ts: RP-Config via RP_ID/RP_ORIGIN/RP_NAME, Challenge im
  httpOnly-Cookie, Wrapper um @simplewebauthn/server
- API: app/api/passkey/{register,authenticate,route}; authenticate ist
  öffentlich (proxy.ts ausgenommen) und setzt bei Erfolg die Session
- Login-Button "Mit Passkey anmelden", Verwaltung im Einstellungen-Tab
- Passwort bleibt als Fallback; Version 0.1.1

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 13:30:12 +02:00
parent 4dc64bfb5c
commit 4a3dfa5821
13 changed files with 856 additions and 26 deletions
+7 -1
View File
@@ -10,7 +10,13 @@ const key = new TextEncoder().encode(secretKey);
export async function proxy(request: NextRequest) {
const { pathname } = request.nextUrl;
if (pathname.startsWith('/login') || pathname.startsWith('/_next') || pathname.startsWith('/favicon')) {
if (
pathname.startsWith('/login') ||
pathname.startsWith('/_next') ||
pathname.startsWith('/favicon') ||
// Passkey-Anmeldung muss ohne Session erreichbar sein.
pathname.startsWith('/api/passkey/authenticate')
) {
return NextResponse.next();
}