Class SessionBuilder
-
- All Implemented Interfaces:
public class SessionBuilderSessionBuilder is responsible for setting up encrypted sessions. Once a session has been established, org.signal.libsignal.protocol.SessionCipher can be used to encrypt/decrypt messages in that session.
Sessions are built from one of two different possible vectors:
- A org.signal.libsignal.protocol.state.PreKeyBundle retrieved from a server.
- A org.signal.libsignal.protocol.message.PreKeySignalMessage received from a client.
Sessions are constructed per recipientId + deviceId tuple. Remote logical users are identified by their recipientId, and each logical recipientId can have multiple physical devices.
This class is not thread-safe.
Moxie Marlinspike
-
-
Constructor Summary
Constructors Constructor Description SessionBuilder(SessionStore sessionStore, PreKeyStore preKeyStore, SignedPreKeyStore signedPreKeyStore, IdentityKeyStore identityKeyStore, SignalProtocolAddress remoteAddress)Constructs a SessionBuilder. SessionBuilder(SignalProtocolStore store, SignalProtocolAddress remoteAddress)Constructs a SessionBuilder
-
Method Summary
Modifier and Type Method Description voidprocess(PreKeyBundle preKey, UsePqRatchet usePqRatchet)Build a new session from a org.signal.libsignal.protocol.state.PreKeyBundle retrieved from a server. voidprocess(PreKeyBundle preKey, Instant now, UsePqRatchet usePqRatchet)Build a new session from a org.signal.libsignal.protocol.state.PreKeyBundle retrieved from a server. -
-
Constructor Detail
-
SessionBuilder
SessionBuilder(SessionStore sessionStore, PreKeyStore preKeyStore, SignedPreKeyStore signedPreKeyStore, IdentityKeyStore identityKeyStore, SignalProtocolAddress remoteAddress)
Constructs a SessionBuilder.- Parameters:
sessionStore- The org.signal.libsignal.protocol.state.SessionStore to store the constructed session in.preKeyStore- The org.signal.libsignal.protocol.state.PreKeyStore where the client's local org.signal.libsignal.protocol.state.PreKeyRecords are stored.identityKeyStore- The org.signal.libsignal.protocol.state.IdentityKeyStore containing the client's identity key information.remoteAddress- The address of the remote user to build a session with.
-
SessionBuilder
SessionBuilder(SignalProtocolStore store, SignalProtocolAddress remoteAddress)
Constructs a SessionBuilder- Parameters:
store- The SignalProtocolStore to store all state information in.remoteAddress- The address of the remote user to build a session with.
-
-
Method Detail
-
process
void process(PreKeyBundle preKey, UsePqRatchet usePqRatchet)
Build a new session from a org.signal.libsignal.protocol.state.PreKeyBundle retrieved from a server.
- Parameters:
preKey- A PreKey for the destination recipient, retrieved from a server.
-
process
void process(PreKeyBundle preKey, Instant now, UsePqRatchet usePqRatchet)
Build a new session from a org.signal.libsignal.protocol.state.PreKeyBundle retrieved from a server.
You should only use this overload if you need to test session expiration explicitly.
- Parameters:
preKey- A PreKey for the destination recipient, retrieved from a server.now- The current time, used later to check if the session is stale.
-
-
-
-