fix(inbox): a failed PUT no longer lets the next message overtake it (4.13.1)
Some checks failed
Docker build and publish / docker (push) Has been cancelled
Publish / publish (push) Has been cancelled
Cross-platform vectors / TypeScript vectors (bun) (push) Has been cancelled
Cross-platform vectors / Kotlin vectors (gradle) (push) Has been cancelled
Test / test (push) Has been cancelled

flushOnce drained a recipient's bucket in order but carried on past a
failure, delivering N+1 before N's retry. For sender-key broadcasts the
receiver cannot open N once past it — frozen terminal output in Prism.
Stop the bucket at the first failure; other recipients still drain in
parallel. Also corrects senderKeyDecrypt's doc, which claimed a
skipped-key cache that never existed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-06 09:08:52 +02:00
parent f6e4ac8aeb
commit 5d04e18482
30 changed files with 113 additions and 28 deletions

View File

@@ -138,8 +138,13 @@ export async function senderKeyEncrypt(
* Decrypt a sender key message. Verifies signature then advances the
* appropriate chain key.
*
* Handles out-of-order delivery via skipped-key cache (simpler than Double
* Ratchet since there's no DH ratchet).
* Out-of-order delivery is NOT handled: the chain only moves forward and
* the keys of skipped iterations are discarded, so a message that arrives
* after its successor throws "Stale iteration". (This comment used to
* claim a skipped-key cache that never existed.) Senders must therefore
* deliver in iteration order — `Inbox` keeps per-recipient order across
* retries for this reason. Prism's Android receiver keeps skipped keys;
* porting that here needs a `skippedKeys` field in every storage backend.
*/
export async function senderKeyDecrypt(
crypto: CryptoProvider,