Client

A connected client: one signed-in user on one device. Every call is async. The calls take turns on the client, but a pending receive waits for mail outside that turn, so a send on the same client from another task goes through meanwhile. The Config/AccountConfig constructors below are the address layer under the `Tenant` handle, for callers that know their addresses.

Constructors

Link copied to clipboard
constructor(pointer: Pointer)
constructor(noPointer: NoPointer)

This constructor can be used to instantiate a fake object. Only used for tests. Any attempt to actually use an object constructed this way will fail as there is no connected Rust object.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun address(): Address

This client's own address.

Link copied to clipboard
open suspend override fun attachSecureStore(store: SecureStore)

Turn on per-send rollback protection: hold store so every send and every ratchet-advancing receive commits a monotonic counter to it, and exportStateSealed binds that counter. Call once, before sending, on a client made by connect / signIn; the sealed restore constructors attach the store themselves. This is what closes EX-03's per-send window — use the same platform store across restarts so the counter is monotone.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun destroy()
Link copied to clipboard
open suspend override fun exportIdentity(): ByteArray

The device identity secret, to persist and reuse via signInWithIdentity (and connectWithIdentity) on later runs. Carries a private key — store it as a secret.

Link copied to clipboard
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.

Link copied to clipboard
open suspend override fun exportStateSealed(): ByteArray

The sealed resumable state (decision 0078, anchor B): the same bytes as exportState, authenticated under the attached SecureStore key so that an attacker who can rewrite the state file cannot forge the anti-rollback generation, with the store's rollback counter bound alongside. Restore with connectWithStateSealed or signInWithStateSealed. Requires attachSecureStore first (or a sealed restore, which attaches it); errors otherwise. Against a file-rewriter this refuses a forged generation and, via the per-send counter, a state older than the latest send.

Link copied to clipboard
open suspend override fun find(username: String): Contact?

Resolve a username within this client's tenant to a contact, or None if no such user is registered. Exact resolution only.

Link copied to clipboard
open override fun inbound(): Inbound

Inbound messages one at a time, as they arrive: see `Inbound`.

Link copied to clipboard
open suspend override fun receive(): List<Message>

Await the next mail, then return every pending message decrypted and attributed to its sender.

Link copied to clipboard
open suspend override fun restoreOutcome(): RestoreOutcome

What the sign-in found: whether restored sessions are in use or were discarded as a rollback; see `RestoreOutcome`.

Link copied to clipboard
open suspend override fun send(to: Address, message: ByteArray)

Encrypt and send a message to a peer; returns once routed.

Link copied to clipboard
fun uniffiClonePointer(): Pointer