release(v4.8.0): sender-fingerprint attribution + Inbox.start race fix
Two unblocking changes for first-contact flows.
Sender attribution: relay captures shortHash(senderSigningKey) at
PUT time (after signature verification, no new trust surface) and
surfaces it on bridge push (IncomingMessage.from) + inbox-fetch
(FetchedBlob.from) + DecryptHandler raw arg. Apps receiving a prekey
envelope from a never-before-seen peer can now bootstrap X3DH via
shade.receive('fp:<hex>', env) — pre-4.8 the wire envelope didn't
authenticate the sender and there was no out-of-band hint to use.
Idempotent ALTER TABLE migrations for SQLite + Postgres add a
sender_fp TEXT column; legacy rows surface as from=undefined
(inter-version compat).
Inbox.start() race: pre-4.8 start() called register() fire-and-forget
AND schedulePoll(0) synchronously, so the first poll on a fresh
address often beat the register HTTP RTT and got SHADE_NOT_FOUND.
start() now defers; register() success kicks schedulePoll(0). Manual
tick() is unaffected (deliberate user action, no gating).
Both reported by Prism. Tests cover all five acceptance criteria
from the sender-attribution request (PUT capture, bridge surface,
fetch surface, inter-version compat, end-to-end pair smoke) plus
the three from the race-fix request.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,16 @@ export interface FetchedBlob {
|
||||
receivedAt: number;
|
||||
/** Absolute expiry time (ms since epoch) reported by the server. */
|
||||
expiresAt: number;
|
||||
/**
|
||||
* Sender fingerprint — 8-byte hex of SHA-256(senderSigningKey),
|
||||
* captured by the relay at PUT time when the sender's signature was
|
||||
* verified. Empty/undefined when the relay is pre-4.8 or the blob
|
||||
* predates sender-fingerprint tracking. Use as an unknown-sender
|
||||
* bootstrap label (`fp:<hex>`) for X3DH first-contact; the
|
||||
* authoritative sender identity is recovered post-decrypt from the
|
||||
* envelope itself, so `from` is a hint, not a trust anchor.
|
||||
*/
|
||||
from?: string;
|
||||
}
|
||||
|
||||
export interface FetchResult {
|
||||
@@ -151,12 +161,18 @@ export class InboxClient {
|
||||
);
|
||||
const blobs = Array.isArray(json.blobs) ? json.blobs : [];
|
||||
return {
|
||||
blobs: blobs.map((b: any) => ({
|
||||
msgId: String(b.msgId),
|
||||
ciphertext: fromBase64(String(b.ciphertext)),
|
||||
receivedAt: Number(b.receivedAt),
|
||||
expiresAt: Number(b.expiresAt),
|
||||
})),
|
||||
blobs: blobs.map((b: any): FetchedBlob => {
|
||||
const out: FetchedBlob = {
|
||||
msgId: String(b.msgId),
|
||||
ciphertext: fromBase64(String(b.ciphertext)),
|
||||
receivedAt: Number(b.receivedAt),
|
||||
expiresAt: Number(b.expiresAt),
|
||||
};
|
||||
// V4.8 — relay-supplied sender fingerprint hint. Optional; absent
|
||||
// on pre-4.8 relays or for blobs persisted before tracking landed.
|
||||
if (typeof b.from === 'string' && b.from.length > 0) out.from = b.from;
|
||||
return out;
|
||||
}),
|
||||
cursor: Number(json.cursor ?? sinceCursor),
|
||||
hasMore: Boolean(json.hasMore),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user