From 025963371ffa7d735e0411292b77bee630486b5e Mon Sep 17 00:00:00 2001 From: randogoth Date: Sat, 26 Sep 2026 16:27:40 +0300 Subject: [PATCH] fix: name unknown senders by fingerprint --- web/js/app.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/web/js/app.js b/web/js/app.js index 6b81d64..27c22ca 100644 --- a/web/js/app.js +++ b/web/js/app.js @@ -131,16 +131,20 @@ async function renderFolder() { } // Open an envelope and split its body; anything unreadable shows as such -// rather than throwing, so one bad message cannot blank the list. +// rather than throwing, so one bad message cannot blank the list. The wire +// carries no sender name, so an unknown key can only be shown as its +// fingerprint until the user imports the sender's smol:// address. function describe(row) { try { const opened = unseal(store.identities(), row.envelope); const { fields, body } = parseFrontmatter(new TextDecoder().decode(opened.body)); + const known = store.addressForKey(opened.sender); return { ...opened, fields, body, subject: fields.Subject || "", - from: store.addressForKey(opened.sender) ?? `<${b32encode(opened.sender).slice(0, 16)}…>`, + from: known ?? `unknown · ${fingerprint(opened.sender)}`, + knownSender: Boolean(known), }; } catch (err) { return { error: err.message }; @@ -170,6 +174,13 @@ async function openMessage(id) { : `from: ${opened.from}\nkey: ${b32encode(opened.sender)}\nid: ${row.id}\ndate: ${fmtTime(opened.time)}`; view.querySelector(".fields").textContent = fields.map(([k, v]) => `${k}: ${v}`).join("\n"); view.querySelector("pre").textContent = opened.body; + if (folder === "inbox" && !opened.knownSender) { + const note = document.createElement("p"); + note.className = "placeholder"; + note.textContent = "The wire carries no sender name, only this signed key. " + + "Import the sender's smol:// address in settings to name future mail."; + view.append(note); + } if (folder === "inbox") { const reply = document.createElement("button"); reply.textContent = "reply";