mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 15:31:38 +02:00
api/middleware.rs: Bearer access-token extraction; client_ip() trusts XFF only behind config.trusted_proxies (fail-closed against spoofing). api/auth.rs: extension_register (PoW-gated; derivation-rotation requires a signature from the on-file key, no fingerprint hijack), check_restore (per-IP + per-fingerprint rate limits, enumeration/timing-resistant), pow_challenge, refresh_token (re-checks active session + revoke-then-issue rotation, race-safe), logout, get_me, nostr_login (login-grade NIP-98, never creates a user, bound to config public_api_url), nostr_link (JWT + state-change verify_signed_action, fail-closed nonce stub) + DTOs + routes(). Wired into api/mod.rs + nested at /api/v1 in main.rs; all 8 paths registered in ApiDoc so openapi.json covers the auth surface (was vacuous). Drafted+hardened via draft->adversarial-review->revise workflow; independently re-reviewed (no critical/high). 58 tests, all gates green. Known LOW (tracked): concurrent first-registration of the same new pubkey_hash can 500 instead of idempotent re-read; client-retryable.
20 KiB
20 KiB