Prepare for public release: generic wording, MIT LICENSE

Make the scaffold standalone and publish-ready:
- Rewrite code + README references to the originating backend as a generic
  "wallet backend" so the service reads as a reusable, run-anywhere LWS.
- Add the MIT LICENSE file (matches Cargo.toml) and a short provenance note.
- Add repository/readme/keywords/categories metadata to Cargo.toml.
This commit is contained in:
jwinterm
2026-07-09 07:11:10 -04:00
parent 1dabd1513c
commit 255c13e27e
8 changed files with 87 additions and 55 deletions
+6 -5
View File
@@ -1,10 +1,11 @@
//! HTTP surface — mirrors the monero-lws user API so smirk-backend-core can
//! proxy to it exactly as it proxies the XMR/WOW LWS (see `infra/lws/client.rs`).
//! HTTP surface — mirrors the monero-lws user API so a wallet backend can proxy
//! to it exactly as it proxies a Monero LWS.
//!
//! AUTH: the user API is unauthenticated at THIS layer — grin-lws binds to
//! loopback / a private network and trusts smirk-backend-core (which does the
//! JWT auth) as its only caller. The admin API (`/list_accounts`, `/rescan`) is
//! gated by a shared bearer (`GRINLWS_ADMIN_KEY`) and disabled when unset.
//! loopback / a private network and trusts the proxying wallet backend (which
//! does the JWT auth) as its only caller. The admin API (`/list_accounts`,
//! `/rescan`) is gated by a shared bearer (`GRINLWS_ADMIN_KEY`) and disabled
//! when unset.
//!
//! The `rewind_hash` in every user request is a VIEW credential (public-key
//! derived — it cannot spend). Its request DTOs omit `Debug` so it is never
+2 -3
View File
@@ -1,8 +1,7 @@
//! Error type mapped to HTTP responses.
//!
//! Hostile-upstream hygiene (carried over from smirk-backend-core's LWS/grin
//! clients): a node/DB error NEVER interpolates an untrusted upstream response
//! body into the client-facing message.
//! Hostile-upstream hygiene: a node/DB error NEVER interpolates an untrusted
//! upstream response body into the client-facing message.
use axum::{http::StatusCode, response::IntoResponse, Json};
+2 -3
View File
@@ -4,9 +4,8 @@
//! block outputs (commit + rangeproof), and relay a finalized transaction. This
//! is the ONLY component that reaches the chain; everything else reads the DB.
//!
//! Hostile-upstream hygiene (carried from smirk-backend-core's node client):
//! per-request + connect timeouts, a streaming body-size cap, and errors that
//! never interpolate an untrusted node body.
//! Hostile-upstream hygiene: per-request + connect timeouts, a streaming
//! body-size cap, and errors that never interpolate an untrusted node body.
//!
//! REWIND (the hard, deferred part): recognizing which of a block's outputs
//! belong to a registered account means rewinding each output's Bulletproof
+17 -18
View File
@@ -10,25 +10,24 @@
//!
//! WHY A DB
//! --------
//! smirk-backend-core's current `POST /wallet/grin/scan` is an ON-DEMAND,
//! STATELESS proxy: each request forwards a `rewind_hash` to grin-wallet's
//! `scan_rewind_hash`, which rescans and returns matches, storing NOTHING. That
//! is fine for grin's small UTXO set but it is NOT a light-wallet-server. A real
//! LWS — like monero-lws — keeps a per-account output store maintained by a
//! background scanner, so reads are O(rows) not O(chain). Hence this service
//! needs a database (the 3 tables in `migrations/`).
//! A typical wallet backend exposes an ON-DEMAND, STATELESS grin scan: each
//! request forwards a `rewind_hash` to grin-wallet's `scan_rewind_hash`, which
//! rescans and returns matches, storing NOTHING. That is fine for grin's small
//! UTXO set but it is NOT a light-wallet-server. A real LWS — like monero-lws —
//! keeps a per-account output store maintained by a background scanner, so reads
//! are O(rows) not O(chain). Hence this service needs a database (the 3 tables in
//! `migrations/`).
//!
//! HOW smirk-backend-core PROXIES TO IT
//! ------------------------------------
//! Identical wiring to the XMR/WOW LWS (`infra/lws/client.rs`): the backend adds
//! a `GrinLwsConfig { lws_url, admin_url?, admin_key? }` and a `GrinLwsClient`;
//! when the `grin_lws` feature is on, `POST /wallet/grin/scan` forwards the
//! `rewind_hash` to this service's `/get_unspent_outs` (and registers via
//! `/register` at balance-fetch time, idempotently, exactly as `fetchLwsBalance`
//! awaits `registerLws` for XMR/WOW). Non-custodial guarantee preserved: the
//! backend forwards only the `rewind_hash` and stores nothing; grin-lws holds
//! the `rewind_hash` for scanning just as monero-lws holds the view key. NEVER a
//! spend key.
//! HOW A WALLET BACKEND PROXIES TO IT
//! ----------------------------------
//! Identical wiring to a Monero LWS client: the backend adds a grin-lws client
//! (`lws_url`, optional `admin_url` + `admin_key`); behind a feature flag, its
//! grin scan endpoint forwards the `rewind_hash` to this service's
//! `/get_unspent_outs` (and registers via `/register` at balance-fetch time,
//! idempotently, exactly as it awaits LWS registration for Monero). Non-custodial
//! guarantee preserved: the backend forwards only the `rewind_hash` and stores
//! nothing; grin-lws holds the `rewind_hash` for scanning just as monero-lws
//! holds the view key. NEVER a spend key.
//!
//! STATUS: SCAFFOLD. Routes, DTOs, config, DB layer, and the scanner loop
//! structure are real; the two chain-crypto seams — block parsing
+1 -1
View File
@@ -1,5 +1,5 @@
//! A tiny redacting wrapper so secrets (DB URL, node auth, admin key) never leak
//! into `Debug` output or tracing spans. Mirrors smirk-backend-core's `Secret`.
//! into `Debug` output or tracing spans.
#[derive(Clone)]
pub struct Secret(String);