feat(psi): expose PSI blind contact discovery endpoint and periodic L2 Merkle root anchor
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 15/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- api, backend, blockchain, cryptography
Research direction
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.
Written by the indexing model from the issue text.
Description
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-31src/merkle.rs:42-269src/psi_service.rs(new PSI blind evaluation & L2 anchor receipt module, < 300 lines)src/http_server.rstests/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
- Implement
src/psi_service.rsevaluating blinded contact tokens against registered identity hashes and generating verifiable L2 state-root anchor receipts whenNODE_L2_ANCHOR_ENABLED=true. - Expose
POST /v1/contacts/psiandGET /v1/identity/anchors/latestinsrc/http_server.rs.
Acceptance Criteria
-
POST /v1/contacts/psireturns blinded tokens and never logs or accepts plaintext phone numbers (400on invalid payload). -
GET /v1/identity/anchors/latestreturns the latest anchored Merkleroot_hash,tree_size, and anchor receipt metadata. -
cargo fmt --check,cargo clippy -- -D warnings, andcargo testpass 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 |
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from alfonsodg/sonaraim-node
-
bug(node): SigV4 presign date applies the epoch offset twice — media uploads can never validateOpenarea::node effort::s impact::medium priority::medium source::auto status::review type::bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
alfonsodg/sonaraim-node#29 · 1 comment ·
-
area::node effort::xs impact::low priority::low source::auto status::review type::docs
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
alfonsodg/sonaraim-node#28 · 1 comment ·
-
area::node effort::s impact::medium priority::low source::auto status::review type::docs
Difficulty 3/5 1-2 days Newbie friendliness 72/100
alfonsodg/sonaraim-node#27 · 1 comment ·
-
area::node effort::m impact::medium priority::medium source::user status::review type::refactor
Difficulty 1/5 Under an hour Newbie friendliness 20/100
alfonsodg/sonaraim-node#26 · 1 comment ·
-
area::node effort::m impact::high priority::medium source::auto status::review type::bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
alfonsodg/sonaraim-node#25 · 2 comments ·
All issues in alfonsodg/sonaraim-node
Similar issues
-
O-windows relnotes relnotes-needs-review relnotes-tracking-issue T-libs
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
marketing
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
num_ode_rk4_adaptive rejects atol = 0 while accepting rtol = 0 and while num_ode_dopri5 accepts bothOpenarea/ode-pde good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#383 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Maintainers usually reply within 1 day
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day