Skip to main content

Module state

Module state 

Source
Expand description

Per-chat state and the store that keeps it (in memory, optionally on disk).

§Store file format

The optional on-disk store (conventionally <session_name>.e2e) is a small binary file, all integers little-endian:

magic    "FGE2E\0"            6 bytes
version  u8                   currently 1
count    u32                  number of chats
chat*    count records        see `SecretChatState::encode`
checksum SHA-256 of all preceding bytes (32 bytes)

The file is replaced atomically (write to a temp file, then rename) and, on Unix, created with mode 0600, because it holds every chat’s auth_key. Only established chats are stored; pending exchanges and the resend buffer live in memory only.

Structs§

ChatStore
In-memory store for established and pending secret chats.
SecretChatState
Per-chat state stored in memory (and optionally persisted to disk).
TempChatState
Temporary state held while waiting for the peer to accept (User A side).

Enums§

RekeyingState
Progress of a key re-exchange (forward secrecy) for one chat.

Functions§

store_path_for_session
Default store path for a session: the session path with its extension replaced by e2e (mybot.session becomes mybot.e2e, mybot becomes mybot.e2e).