The Signal protocol answers the following question at any point during
messaging:
"What encryption key should I use for the next message?"
(Connell and Schmidt, 2025)Graeme Connell and Rolfe Schmidt, 2025. “Signal Protocol and Post-Quantum Ratchets” . In Signal Blog.
That includes when:
[PQXDH] a session is first established between two interlocutors who
have never spoken to one another before;
[Triple Ratchet: SPQR/ML-KEM Braid + Double Ratchet] an ongoing session
is in progress between two people.
Because the Signal protocol involves two or more users continuously agreeing
on the keys they should use to encrypt their messages, it makes sense to think
of the Signal protocol in terms of a state machine that: (1) transitions
between states whenever a message is received and (2) determines what keys and
headers should be used for the next message.
Additionally, because the post-quantum (PQ) variant of Signal now involves a
sparse continuous key agreement protocol (SPQR/ML-KEM Braid) that gets mixed
into the user's encryption key material after a certain period of time, this state machine also tracks and
dictates when a new epoch begins, where an epoch is associated with each SPQR
shared secret, and how the next SPQR shared secret is constructed between epochs.
In what follows, we focus on the transition of this state machine between the
different sub-protocols of the overall Signal protocol: i.e. PQXDH, Double
Ratchet, and SPQR/ML-KEM Braid.
3.1.1. PQXDH → Triple Ratchet 🔗
The Signal docs describe the transition from the initial handshake (PQXDH) to
the ratcheting stage (SPQR/ML-KEM Braid + Double Ratchet); see sections 3.3,
3.4, and 4 of the PQXDH specification (Kret and Schmidt, 2023)Ehren Kret and Rolfe Schmidt (2023). “The PQXDH Key Agreement Protocol” . Signal Documentation. Revision 3 . .
At the beginning of time, Alice wants to communicate with Bob for the very
first time but does not have any shared secret with him. This lack of a shared
secret, and really a first key to ratchet from, defines this very first state.
In order to agree on the first key that will be in the
Double Ratchet chain, as well as the secret material for SPQR, Alice fetches
one of Bob's pre-key bundles from the Signal server and performs the initial
handshake (PQXDH) with him. By doing so, Alice
➤ src/ratchet.rs:44-107 and Bob
➤ src/ratchet.rs:118-169 know which keys to
use for their first messages.
Note that this initial ratcheting state includes both the first Double Ratchet
key and state, as well as the secret material necessary to initialize the SPQR
chain in the code base
➤ src/ratchet.rs:48-64 ,
➤ src/ratchet.rs:77-107
➤ src/lib.rs:210-234 . Alice's initial SPQR state, described in
detail in the ML-KEM Braid specification
(Schmidt, 2025)Rolfe Schmidt (2025). “The ML-KEM Braid Protocol” . Signal Documentation. Revision 1 . , is set to KeysUnsampled
➤ src/lib.rs:196-202 ,
➤ chunked/states.rs:57-60 , while Bob's is set to
NoHeaderReceived
➤ src/lib.rs:203-205 ,
➤ chunked/states.rs:62-64 .