5.1. Server
For simplicity of presentation this document discusses a single server that handles all user and device records, and all messages. In a real system these functions might be distributed across multiple entities.
For example, different servers might handle different groups of users. In this case, Alice would send a message to Bob by contacting Bob's server, and Bob would send a message to Alice by contacting Alice's server.
For another example, the server(s) that handle user and device records might be separate from the server(s) that handle mailboxes.
Other divisions of labor might be possible; analyzing all the possibilities is outside the scope of this document.
5.2. X3DH and the Double Ratchet
Sesame was designed for use with Double Ratchet sessions [2] created via X3DH key agreement [1].
In this instantiation, devices will publish one-time prekeys and signed prekeys to the server, alongside their identity public key.
To create an initiating session, a sending device will contact the server and fetch a prekey bundle containing the recipient device's identity public key, signed prekey, and a one-time prekey (if one is available). These values will be used by the X3DH algorithm to create both a secret key that initializes a Double Ratchet session, and an X3DH initial message.
The X3DH initial message is attached to every initiation message, so that the recipient can use it to create a matching Double Ratchet session. Once a response to an initiation message is received, the original sender ceases attaching the X3DH initial message to future messages, so the devices henceforth communicate using only the Double Ratchet.