From 5e27a1b53dcc67900392daebe386cb0ba210ae70 Mon Sep 17 00:00:00 2001 From: Local Dev Date: Wed, 21 Oct 2026 17:21:16 +0300 Subject: [PATCH] hermes: phone discovery (opt-in), lookup contacts by number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users can link one or more phone numbers to their Hermes identity by publishing a kind:30078 claim event whose d-tag is a SHA-256 hash of the E.164 number. The number itself never leaves the device. Add-contact and message-send now also accept a +phone input directly — the client hashes it and queries relays for the matching Hermes identity. - lib/hermes.js: normalisePhone(str) strips separators + a leading 00 into E.164, rejects anything that doesn't fit +[country][7-15 digits]. hashPhone(str) → base64url-truncated-to-32 SHA-256 digest, used as the d-tag suffix under PHONE_DTAG_PREFIX. buildPhoneClaimEvent / buildPhoneRetractEvent emit the signed kind:30078 / NIP-09 kind:5. - main.js: _hermesAPI.getPhone / setPhone / clearPhone / findByPhones. Plaintext phone persists in the identity meta (locally only) so the user can see what's linked and retract it; event ids are kept so a retract can reference the exact wire event. hermesResolveTo takes a phone-shaped input and does the discovery lookup transparently, so contactsAdd and send accept phones without a new entry point. - panel.html: Settings → Phone discovery (link / unlink + privacy note), add-contact placeholder now lists +phone alongside the other forms. Privacy stance stated in the UI: "anyone who already knows your number can find you — same tradeoff as number-based messengers." No PSI tricks yet; plain hash. Users who don't want it just don't link, which is the default. Future slice can add a pepper if operators want to narrow the brute-force window. --- bundled-addons/hermes/index.js | 1 + bundled-addons/hermes/panel.html | 63 ++++++++++++- lib/hermes.js | 71 +++++++++++++++ main.js | 147 +++++++++++++++++++++++++++++++ 4 files changed, 281 insertions(+), 1 deletion(-) diff --git a/bundled-addons/hermes/index.js b/bundled-addons/hermes/index.js index 8236c268..019c9564 100644 --- a/bundled-addons/hermes/index.js +++ b/bundled-addons/hermes/index.js @@ -20,6 +20,7 @@ const { ipcMain } = require("electron"); const PANEL_METHODS = [ "status", "canUseVault", "close", "init", "signOut", "getBackup", "hasBackup", "getProfile", "updateProfile", + "getPhone", "setPhone", "clearPhone", "findByPhones", "inbox", "send", "markThreadRead", "contactsList", "contactsAdd", "contactsUpdate", "contactsRemove", ]; diff --git a/bundled-addons/hermes/panel.html b/bundled-addons/hermes/panel.html index 951cc224..bb961b76 100644 --- a/bundled-addons/hermes/panel.html +++ b/bundled-addons/hermes/panel.html @@ -210,6 +210,20 @@ +
Phone discovery
+ +
+ + +
+
+
+ We hash the number locally and publish a Nostr claim for the hash. Anyone who already knows your number can find you — same tradeoff as number-based messengers. Unlink any time. +
+
Backup
No seed phrase stored for this account.
(created-elsewhere / vault / mnemonic signins don't retain the words)
@@ -295,7 +309,7 @@