exportState

open suspend override fun exportState(): ByteArray

The resumable session state: the device identity, every live ratchet session with a peer this device already talks to, and the published prekey secrets. Restore it with signInWithState or connectWithState.

First contact is covered. A message a new peer sends while this device is offline is encrypted to a one-time prekey from the published bundle; the private half of that prekey travels in this blob, so after a restore the queued first-contact message still decrypts, and live conversations resume mid-ratchet. (Prekeys were added to the blob when the prekey-restoration finding was closed; an earlier version of this note said first contact was not covered — it is.)

Carries private keys, and it is not a backup. Restoring an older copy rewinds ratchets that have already moved. This unsealed export has no rollback defence: its generation counter is plaintext a file-rewriter can forge (EX-03 / internal audit AR-1). Store the most recent one, replace it in place, and do not keep a history of them. For the rollback-resistant form, use exportStateSealed with a SecureStore — it authenticates the state under a platform-secure-storage key so a rewritten file is refused on restore.