RatchetSession class

A forward-secret symmetric ratchet for a peer-to-peer transport session.

The session root is derived from the shared group key and an X25519 agreement between per-connection ephemeral keys, each signed by its device's roster identity (see deriveRatchetRoot), so every connection gets a fresh chain that no long-term key can rebuild, and a reconnect starts over. Each direction has its own hash chain: a message key is derived from the current chain key, then the chain key is advanced and the previous one is wiped. A key extracted after step n therefore cannot derive any message key from before step n.

Within one connection this is a hash ratchet: it gives forward secrecy, not post-compromise security. A Diffie-Hellman re-key on a schedule inside a long-lived connection (full double ratchet) is a later addition behind this same seam.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Wipes both chains' key material.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(List<int> framed) → Future<List<int>?>
Decrypts a counter(4) ‖ ciphertext frame, or returns null if the frame is malformed, the key has already been ratcheted past, or authentication fails.
seal(List<int> plaintext) → Future<List<int>>
Encrypts plaintext with the next sending message key. The returned bytes are counter(4) ‖ ciphertext.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

establish({required List<int> root, required bool thisNodeIsLow, required Cipher cipherFactory(List<int> key)}) → RatchetSession
Establishes a session from root. thisNodeIsLow must be true on the side whose node id sorts first, so the two sides pick opposite send / receive chains.