Add tiered per-IP rate limiting to the router, completing the assembly: - STRICT tier (~2 req/s, burst 20) on the unauthenticated, abuse-prone surface: /api/v1/auth/* and /api/v1/website/*. This closes the website-challenge growth vector (the prior rate-limit LOW): an unauthenticated flood of challenge requests is now throttled per IP. - NORMAL tier (~10 req/s, burst 60) on the authenticated wallet/identity API. - PeerIpKeyExtractor keys on the peer IP; `main` now serves with into_make_service_with_connect_info::<SocketAddr> so the IP is available, and the test harness injects a loopback ConnectInfo (each test builds a fresh router with fresh limiter state). Over-limit returns 429. The limiter sits inside the global layers (CORS/timeout/ body/compression/trace) and in front of the handlers. L1 test proves it throttles: a 40-request burst to a strict-tier route returns 429 (the governor runs before the handler, so even unauthenticated requests count). All 33 integration tests + 114 lib tests pass through the fully-layered router; openapi unchanged.
smirk-backend-core
Open, self-hostable backend for the Smirk non-custodial, multi-chain wallet. It provides the chain-access and identity surface a Smirk wallet needs — authentication, per-chain wallet access (Bitcoin, Litecoin, Monero, Wownero, Grin), the Grin slatepack relay, and Nostr-based identity — so anyone can run their own backend and a Smirk wallet can connect to it.
Status: early, under active development. Interfaces and the database schema may change before the first tagged release. Not yet recommended for production self-hosting.
What it is
- Non-custodial. The server never holds spend keys or seeds. It brokers access to blockchain data and relays wallet-to-wallet messages.
- Open core, feature-flagged. Every feature ships in this codebase and is
toggled per deployment; the wallet reads
GET /api/v1/capabilitiesand adapts to what a given backend offers. - Identity via "Sign in with Smirk". Authentication uses a seed-derived Nostr key (NIP-98); the server stores only public keys.
- Privacy first. No PII is required to use it; operator and user privacy are explicit design goals.
Architecture
Rust + Axum, PostgreSQL via sqlx. The public HTTP contract is generated from the handlers with utoipa (OpenAPI), which in turn drives the wallet's generated TypeScript client — one source of truth, checked for drift in CI.
Quickstart
cp .env.example .env # then fill in DATABASE_URL, JWT_SECRET, node URLs
cargo run # starts the API server
A full self-hosting guide (node requirements, reverse proxy, Tor admin onion,
backups) will live in docs/ as it stabilises.
Security
Please report vulnerabilities privately — see SECURITY.md. Do not open public issues for security reports.
License
To be finalized (MIT vs AGPL-3.0-or-later). Until a LICENSE file is added,
all rights are reserved.