feat(psi): expose PSI blind contact discovery endpoint and periodic L2 Merkle root anchor

Aperta
#5 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start with the L2 flags in src/config.rs (lines 29-31) and the Merkle root code in src/merkle.rs, then read src/http_server.rs to see how routes are wired. The new src/psi_service.rs module must blind contact tokens against registered identity hashes and produce anchor receipts. Done means POST /v1/contacts/psi and GET /v1/identity/anchors/latest return the specified responses, with cargo test, fmt and clippy passing in tests/node_test.rs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area::node effort::m impact::high priority::high source::user status::review type::feature

Part of Meta-Issue alfonsodg/sonaraim#7
Ref alfonsodg/sonaraim-protocol#4, Ref alfonsodg/sonaraim-node#3

Problem

src/config.rs:29-31 parses l2_anchor_enabled and l2_rpc_url, and src/merkle.rs:42-269 computes Merkle roots, but sonaraim-node does not yet expose the Private Set Intersection (PSI) endpoint (POST /v1/contacts/psi) for Phase 2 social graph discovery or the optional periodic L2 state-root anchoring receipt generator (GET /v1/identity/anchors/latest).

Affected Files & Locations

  • src/config.rs:29-31
  • src/merkle.rs:42-269
  • src/psi_service.rs (new PSI blind evaluation & L2 anchor receipt module, < 300 lines)
  • src/http_server.rs
  • tests/node_test.rs:1-167

Evidence

// src/config.rs:29-31
pub l2_anchor_enabled: bool,
pub l2_rpc_url: Option<String>,

Impact and Blast Radius

Allows sonaraim-app users to privately discover which contacts already have Sonaraim installed (POST /v1/contacts/psi) and allows external auditors to verify hourly L2 state-root anchors of the Key Transparency log.

Historical Context and Anti-Regression

Builds on e62fca0 / 6eda03b (Issue #1) and Issues #2–#4. All pre-existing tests in tests/node_test.rs must remain 100% green.

Proposed Solution

  1. Implement src/psi_service.rs evaluating blinded contact tokens against registered identity hashes and generating verifiable L2 state-root anchor receipts when NODE_L2_ANCHOR_ENABLED=true.
  2. Expose POST /v1/contacts/psi and GET /v1/identity/anchors/latest in src/http_server.rs.

Acceptance Criteria

  • POST /v1/contacts/psi returns blinded tokens and never logs or accepts plaintext phone numbers (400 on invalid payload).
  • GET /v1/identity/anchors/latest returns the latest anchored Merkle root_hash, tree_size, and anchor receipt metadata.
  • cargo fmt --check, cargo clippy -- -D warnings, and cargo test pass with 0 warnings.

Validation Criteria

Level Applies Test Scenario Pass
Unit Yes tests/node_test.rs PSI batch evaluation & L2 anchor receipt verification 100% pass (cargo test)
Integration Yes tests/node_test.rs Live HTTP POST /v1/contacts/psi & GET /v1/identity/anchors/latest Status 200/400 verified
Contract Yes docs/API.md JSON request/response contract parity Verified
E2E Yes Sandbox container validation (REMOTE.md) Live PSI discovery query against sonaraim-node:8040 HTTP 200 verified
Lingua principale
Rust
Stelle
0
Fork
0
Merge medio
4m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di alfonsodg/sonaraim-node

Tutte le issue di alfonsodg/sonaraim-node

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.