feat(phone-psi): bind blinded E.164 phone tokens to DIDs and resolve phone contacts in POST /v1/contacts/psi
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with handle_psi_json in src/psi_service.rs, then the identity and contacts routes in src/http_server.rs, to see how NodeState stores DIDs and how evaluate_psi_batch is called. Run tests/milestone10_node_test.rs to see the current contract. Done means a registered phone token resolves to its DID through /v1/contacts/psi and the by-phone lookup, and the existing evaluated_tokens field still returns. The issue names both matched_dids and matches for the response, so settle that with a maintainer first.
Written by the indexing model from the issue text.
Description
Description
In sonaraim-node/src/psi_service.rs:77-90 and src/http_server.rs:199-235, POST /v1/identity registers a did and key_commitment, while POST /v1/contacts/psi evaluates blinded_tokens, but sonaraim-node does not store a mapping from phone_token (blinded E.164 phone number, e.g. +51999888777) to the user's did:sonaraim:.... Because of this, users and businesses cannot resolve an E.164 phone number to an active Sonaraim DID mailbox like WhatsApp does.
Affected Files
src/psi_service.rs:29-90src/http_server.rs:198-235
Evidence (Current Code Snippet)
// src/psi_service.rs:78-89
pub fn handle_psi_json(body: &str, secret: &[u8]) -> (u16, &'static str, String) {
let tokens = extract_json_str_array(body, "blinded_tokens");
let quoted: Vec<String> = evaluate_psi_batch(&tokens, secret)
.into_iter()
.map(|t| format!(""{t}""))
.collect();
(
200,
"OK",
format!("{{"evaluated_tokens":[{}]}}", quoted.join(",")),
)
}
Impact & Historical Context
- Impact: For Sonaraim to work like WhatsApp connected to a phone number, registering a phone number (
phone_e164orphone_token) alongsidePOST /v1/identitymust index the blind-evaluated phone token soPOST /v1/contacts/psireturns bothevaluated_tokensandmatched_dids: [{"token": "...", "did": "did:sonaraim:..."}]. - Historical Context: Parent Meta-Issue
alfonsodg/sonaraim#15. Extendsalfonsodg/sonaraim-node#5.
Proposed Solution
- Allow
POST /v1/identityto accept an optional"phone_token"(or"phone_e164"), computing its blind PSI evaluation and indexingevaluated_token -> didinNodeState. - In
POST /v1/contacts/psi, return"evaluated_tokens": [...]AND"matches": [{"blinded_token": "...", "evaluated_token": "...", "did": "did:sonaraim:..."}]for all registered phone numbers. - Also allow
GET /v1/identity/by-phone/<phone_token>sosonaraim-b2bandsonaraim-appcan check whether an E.164 phone number is onboarded on Sonaraim and route directly to itsdid:sonaraim:...mailbox.
Acceptance Criteria
- Functional: Registering an identity with a phone number binds its PSI token to the DID;
POST /v1/contacts/psiandGET /v1/identity/by-phone/<token>resolve the phone token to the registereddid:sonaraim:.... - Code Quality: All files in
src/strictly< 300lines;cargo fmt --checkandcargo clippy -- -D warningspass. - Tests: TDD tests in
tests/milestone10_node_test.rsverify phone registration and contact book discovery returning the matcheddid:sonaraim:.... - Regression: Existing
evaluated_tokensresponse field is preserved for backward compatibility.
- 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