Signal Protocol
Core concepts

Composition boundaries

Keep protocol state, local storage, delivery, and encrypted objects independently replaceable.

The SDK separates portable protocol behavior from application infrastructure.

BoundaryContainsMust not contain
Local storeIdentity private keys, sessions, sender keysRemote service credentials
Delivery adapterPublic prekeys and encrypted envelopesDevice private keys or plaintext
Object adapterOpaque encrypted attachment bytesAttachment plaintext or message keys
ApplicationAccount policy and user experienceUnvalidated protocol-state mutation

Adapters are security boundaries, not convenience callbacks. Validate data returned by an adapter before committing it to live protocol state.