Nostr Identity + Trust Engine — cryptographic memory for every user #64
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & Why
Give Timmy a cryptographic memory. Users identify themselves with a Nostr keypair (secp256k1, same curve as Lightning). Timmy stores a trust score per identity that grows from reliable interactions. Trust scores become the input to the cost-routing gate — this is the foundational identity layer.
Done looks like
nostr_identitiestable tracks pubkey, trust score, interaction count, free-tier budget consumed, last seen, and tier label (anonymous / new / established / trusted / elite)GET /sessions/:idandGET /jobs/:idso the frontend can display itOut of scope
Tasks
nostr_identitiestable (pubkey PK, trust_score, tier, interaction_count, sats_absorbed_today, last_seen, created_at) and nullablenostr_pubkeyFK columns onsessionsandjobstables. Rundb:push.POST /api/identity/challengereturns a time-limited nonce;POST /api/identity/verifyaccepts pubkey + Nostr-signed event, verifies signature vianostr-tools, upserts identity row, returns a signed session token.POST /api/sessionsandPOST /api/jobsto accept optionalnostr_tokenin request body. Validate token, resolve pubkey, record it on the row. Anonymous requests getnostr_pubkey = null.TrustServicewithgetTier(pubkey),recordSuccess(pubkey, satsCost),recordFailure(pubkey, reason). Tier boundaries and decay rate env-var configurable. Call from job/session completion paths.trust_tierin JSON fromGET /sessions/:idandGET /jobs/:id.Relevant files
lib/db/src/schema/sessions.tslib/db/src/schema/jobs.tslib/db/src/schema/index.tsartifacts/api-server/src/routes/sessions.tsartifacts/api-server/src/routes/jobs.tsartifacts/api-server/src/lib/trust.tsPR created. All tasks for this issue were found to be already implemented in the codebase. PR #95 has been created to reflect this.