feat: carry a signed Reply-To address for first contact

This commit is contained in:
randogoth 2026-09-26 16:36:12 +03:00
parent fd2d9298f8
commit aab98ff598
6 changed files with 69 additions and 6 deletions

View file

@ -201,6 +201,9 @@ const commands = {
const fields = [["Subject", parseOption("--subject")], ["In-Reply-To", parseOption("--reply-to")]]
.filter(([, v]) => v);
if (state.account && !rest.includes("--anonymous"))
fields.push(["Reply-To", proto.parseAddress(`${state.account.user}@${state.account.host}` +
(state.account.port === proto.DEFAULT_PORT ? "" : `:${state.account.port}`)).uri(me.publicKey)]);
const body = utf8Bytes(proto.buildFrontmatter(fields, (parseOption("--body") || "") + "\n"));
const envelope = proto.seal(me, recipient, body);
const opened = await open(addr.host, addr.port, { requirePin: false });

View file

@ -107,6 +107,10 @@ def main() -> int:
alice_read = run(alice + ["read", reply_id[:8]])
check("alice reads bob's reply", "hello alice" in alice_read, alice_read)
check("reference client verifies the JS signature", "signature verified" in alice_read)
# bob's reply carries his signed smol:// address; a receiver that does
# not know the field must still preserve and display it (SPEC.md §5.5)
check("reference client preserves the signed reply address",
"reply-to:smol://bob@" in alice_read, alice_read)
# --- rotation: the JS client rotates, the reference client walks the chain
bob_rotated = run(bob + ["rotate"])