Merged into main with --no-ff as 4f78101735ddd9f66c085b27a30844eb48006f9e (remote hash verified). The self-review is review 376 on this PR (its summary says R1–R7; there are eight, R8 is on…
R8 — the library has no clock. An unclaimed invite's welcome mailbox would be fetched for ever: wasted requests, and one more mailbox linked by timing (PROTOCOL.md section 1). forget_invite lets the app stop it after the relay's 7 days, or when the user cancels.
R4 — an equivalent planted bug. Removing this guard is not caught, because OpenMLS deletes the KeyPackage when it joins from a Welcome, so a second copy of the Welcome already fails. The guard stays as defence in depth, for a last-resort KeyPackage or a change in OpenMLS.
R5 — a partial receive. If the relay fails after some mailboxes were processed, the client's state already includes them. Returning an error here would lose those messages: the app would not save them, and fetching them again gives MLS replays that are dropped. So receive returns what it has, with interrupted set.
Adversarial self-review — F22a, client state
R3 — found while building, fixed. The used welcome mailbox was first dropped inside receive. A snapshot saved between receive and finish then forgot it, so after a crash the Welcome and hello stayed on the relay for 30 days. Test a crash between receive and finish… failed on it (3 blobs waiting instead of 1). The drop now happens in finish, after acknowledging.
R1 — the snapshot is the identity. It holds every secret: MLS private keys, fetch and post tokens. It must live only in encrypted storage (Amicitia: SQLCipher), never in a log or a backup in the clear. The library writes no file and implements no Debug for it. Encrypting it again inside the library would need a second key stored somewhere; not done, stated in the analysis.
R2 — written whole after every change. A few KB per contact. Fine for 1:1 chats with dozens of people; a table per key would scale better. Not measured with many contacts; for later, when measured.
R6 — a claimed invite is used up before anything is saved. If the app dies between the claim and saving, the link no longer works; the person asks for a new one. Unavoidable with a one-time claim, and harmless: nothing readable is exposed.
R7 — an Outgoing carries a post token. An app that keeps an outbox must keep it in encrypted storage too. Debug prints only the size. The blob itself is MLS ciphertext.