mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-12-01 04:53:56 +01:00
feat: website auth, username + key registration, NIP-05 directory
- api/website.rs: sign-in-with-wallet (dapp connect). challenge bound to origin + short TTL; verify is single-use (remove-before-verify, race-safe), expiry- checked, signature via Result<(),AppError> verifiers (no oracle), resolves an EXISTING user by the proven key's pubkey_hash (never mints identity), mints a Platform::Web session. - api/users.rs: username set/get + by-username lookup (JWT-gated, 409 on taken, constant-shape lookup); per-asset key registration bound to the JWT user (no spoofable user_id) + public key-directory reads. - api/nip05.rs: /.well-known/nostr.json directory (username -> nostr_pubkey). - Wired into api/mod.rs; website+users nested at /api/v1, nip05 at root; all paths/schemas registered (openapi.json now 17 endpoints). - main.rs: periodic GC of expired web challenges (bounds the in-memory store). Adversarially reviewed (register_key authz + website identity-binding both hold; no critical/high). 69 tests green. Deferred LOW: per-IP rate-limit on the website routes lands with the router-assembly unit.
This commit is contained in:
@@ -24,6 +24,15 @@ use utoipa::OpenApi;
|
||||
crate::api::auth::get_me,
|
||||
crate::api::auth::nostr_login,
|
||||
crate::api::auth::nostr_link,
|
||||
crate::api::website::website_challenge,
|
||||
crate::api::website::website_verify,
|
||||
crate::api::users::set_username,
|
||||
crate::api::users::get_my_username,
|
||||
crate::api::users::lookup_username,
|
||||
crate::api::users::register_key,
|
||||
crate::api::users::get_user_keys,
|
||||
crate::api::users::get_user_key_for_asset,
|
||||
crate::api::nip05::well_known_nostr,
|
||||
),
|
||||
components(schemas(
|
||||
crate::api::health::HealthResponse,
|
||||
@@ -38,6 +47,19 @@ use utoipa::OpenApi;
|
||||
crate::api::auth::LogoutResponse,
|
||||
crate::api::auth::NostrLinkRequest,
|
||||
crate::api::auth::NostrLinkResponse,
|
||||
crate::api::website::WebsiteChallengeRequest,
|
||||
crate::api::website::WebsiteChallengeResponse,
|
||||
crate::api::website::AssetSignature,
|
||||
crate::api::website::WebsiteVerifyRequest,
|
||||
crate::api::users::SetUsernameRequest,
|
||||
crate::api::users::SetUsernameResponse,
|
||||
crate::api::users::MyUsernameResponse,
|
||||
crate::api::users::PublicKeysInfo,
|
||||
crate::api::users::LookupUsernameResponse,
|
||||
crate::api::users::RegisterKeyRequest,
|
||||
crate::api::users::UserKeyInfo,
|
||||
crate::api::users::UserKeysResponse,
|
||||
crate::api::nip05::WellKnownResponse,
|
||||
)),
|
||||
tags(
|
||||
(name = "system", description = "Service health and metadata."),
|
||||
|
||||
Reference in New Issue
Block a user