Skip to Content
OpenE2EEDocs

API reference

The curated client surface — createSignalProtocolClient options, every SignalProtocolClient method by category, properties, hooks, and the standalone modules.

Applies to @open-e2ee/signal-protocol-sdk 15.0.x. Public APIs and persisted formats follow semantic versioning.

This page is the curated surface: the shapes you compose against, grouped so you can scan them. It is not the generated reference. For exhaustive signatures and type parameters, see the TypeDoc output at docs/api/README.md. It also lists every exported symbol. The TypeDoc generator builds that output from exported declarations.

There are no client.device.* namespaces

The only namespace-shaped property on the client is client.media. There is no client.device, no client.keys, no client.safety, and no client.sealedSender. Everything else is either a flat method on the client or a standalone module at its own package subpath.

client.safety.generate(...) and client.device.link(...) do not exist. Use client.verify(userId) for the safety number. For the managed device link, use the functions from the package root, such as joinHostedSignalProtocolRelayAccount() and approveHostedSignalProtocolRelayDeviceLink().

The managed device link, device management, device transfer, key generation primitives, safety-number rendering data, and sealed-sender access-key derivation all live outside the client object. See Standalone modules below and Package subpaths.

createSignalProtocolClient()

import { createSignalProtocolClient } from '@open-e2ee/signal-protocol-sdk';

const signal = await createSignalProtocolClient({
  identity: { userId },
  adapters: { storage, relay },
});

Returns Promise<SignalProtocolClient>. Initialization is complete when the promise resolves.

identity

Required. One client instance represents one account on one device.

FieldTypeRequiredDefaultNotes
userIdstringyes—Canonical account identifier
deviceIdnumberno11 is primary; 2–5 are backend-allocated linked slots
enablePniKeysbooleannofalseGenerate and sync both ACI and PNI key material

A linked-device client with deviceId: 2–5 needs the account identity in the supplied storage first. Put it there by device transfer or by a channel that your application owns. On the OpenE2EE Signal Protocol Relay, the one-process link, linkHostedSignalProtocolRelayDevice(), then joins the device and returns its client. The two-device link needs no identity in the store: the new device calls joinHostedSignalProtocolRelayAccount() with an empty store, and device 1 approves it. See multi-device.

adapters

FieldTypeRequiredNotes
storageSignalProtocolLocalStoreyesDevice-local protocol state
relaySignalProtocolRelayServernoOmit for local-only mode; required for sync, prekeys, delivery
remoteObjectStoreSignalProtocolRemoteObjectStorenoRequired only for encrypted attachments
protocolManagerSignalProtocolManagernoAdvanced override for tests and specialized integrations

Interfaces and their obligations are in Adapter interfaces.

protocol

FieldTypeDefaultNotes
postQuantum'required''required'The only value. Every new session uses PQXDH. 'compatible' throws Unsupported postQuantum policy at creation
braid'required' | 'disabled''required''disabled' selects the local direct ML-KEM SPQR mode
contentRecoveryContentRecoveryPolicy{ mode: 'require-protected' }Whether the local store may keep the plaintext of resendable messages. mode is 'require-protected', 'allow-co-located-key', or 'off'. retentionMs is at most 30 days, 14 days by default. isCurrentMember answers for an ad hoc group
receiveQueueReceiveQueuePolicymaxItems 3000, maxBytes 786432000 (750 MiB), blockedGroupShare 0.25, receiveHookTimeoutMs 120000Bounds the received content that waits on this device. Content that waits 30 days expires. No setting changes that age

There is no postQuantum: 'disabled' or 'compatible' mode. The root package exports constants as PostQuantumPolicy, which has only Required, and BraidPolicy. client.contentRecoveryStatus reports the content recovery decision that the client made at creation. Full semantics: Security and protocol policy.

Top-level options

Everything below sits at the top level of the composition object, alongside identity, adapters, and protocol.

FieldTypeDefaultPurpose
loggerLoggerenvironment-aware consoleAll methods optional; console works directly
enableDebugLoggingbooleanfalseVerbose protocol logging
throwDetailedErrorsbooleanfalseDetailed messages instead of generic ones
hooksSignalProtocolClientHooks—Lifecycle callbacks; client creation throws for a name that is not a hook; see Hooks
onProgressProgressCallback—{ stage, percent, message, detail? } during init and sync
mediaSignalProtocolClientMediaConfig—App-owned attachment byte callbacks
contentAdapterSignalProtocolContentAdapterdefault adapterBoundary between protocol and app content shape
ratchetConfigDoubleRatchetConfigmaxSkip 25000, maxMessageKeysStored 2000 for each receiver chain, keyExpirationMs 604800000Double Ratchet bounds
senderKeysSenderKeysConfig—Group HKDF info string and DoS limits
protocolStrategyProtocolStrategyConfig—Diagnostics and telemetry seam; prefer protocol
onPreKeyLow(remaining: number) => void—Fires below preKeyLowThreshold
preKeyLowThresholdnumber50Product-facing low-watermark
keyRefreshIntervalMsnumber172800000 (2 days)Signed and Kyber prekey rotation interval
maxPreKeyAgeMsnumber1209600000 (14 days)Sending is blocked above this age
preKeyCheckThrottleMsnumber43200000 (12 hours)Activation-check throttle
preKeyMaintenancePreKeyMaintenanceStore—Replaced-prekey bookkeeping for SQLite adapters
onGroupSenderKeyRotated(groupId, newGeneration) => void—Sender-key rotation notification
sealedSenderSealedSenderConfig—trustRoots, certificateProvider?, accessMode?, contactStateStore?
deliveryReceipts'auto' | 'always' | 'off''auto'The received messages that get a delivery receipt; see Delivery receipts
groupsobject—trustRoot, profileKey, and optional authorityKeyId, resolveAuthority, store, server, issueCredential, issueProfileKeyCredential, allowUnauthenticatedGroupHistory, onConfigurationWarning, endorsementManager, resolveAciBytesByUserIds

Lower-level factory

DefaultSignalProtocolClient.create(userId, config) takes the flattened SignalProtocolClientConfig: storage, relay, deviceId, protocol, and the rest at one level. The constructor is private. createSignalProtocolClientConfig(options) converts the composition shape into that flattened config without constructing a client.

Properties

PropertyTypeNotes
loggerRequired<Logger>Resolved logger, never undefined
userIdstringGetter
deviceIdnumber1 primary, 2–5 linked
mediaSignalProtocolClientMediaThe one namespace-shaped property
syncStatus'synced' | 'failed' | 'none'Result of the initial sync during create(); 'none' means no relay was configured
isSealedSenderEnabledbooleanGetter
relayConnectionStateSignalProtocolRelayConnectionStateGetter; stopped before startRelaySubscription(), after stopRelaySubscription(), after the Relay refuses the protocol version of the SDK, and when no relay is configured

Methods

Session and lifecycle

MethodReturns
isInitialized()Promise<boolean>
getIdentityPublicKey()Promise<PublicKey>
address()ProtocolAddress
syncToServer(onProgress?)Promise<void>
establishSession(remoteAddress, prekeyBundle, recipientIdentityType?)Promise<void>
hasSession(remoteAddress)Promise<boolean>
deleteSession(remoteAddress)Promise<void>
archiveSession(remoteAddress)Promise<void>
fetchSenderCertificate()Promise<string>
rotateAccountIdentity(expectedCurrentCommitment, identityType?)Promise<void>
forceCompleteKeyReset()Promise<ForceKeyResetResult>
stop()Promise<void>

Its JSDoc limits forceCompleteKeyReset() to development and debugging. Treat it as break-glass, not as a production recovery step. It clears and regenerates key material. Peers will see an identity change.

syncToServer() replenishes and uploads prekeys. The SDK normally establishes sessions implicitly. send() establishes what it needs, and establishSession() is for callers that already hold a bundle.

Messaging

MethodReturns
send(recipientId, content, options?)Promise<SendResult>
forgetSentContent(clientMessageId)Promise<boolean>
getPendingRecipients(clientMessageId)Promise<SendLogDevice[]>
encryptMessage(remoteAddress, plaintext)Promise<Ciphertext>
decryptMessage(remoteAddress, ciphertext)Promise<string>
encryptMessages(remoteAddress, plaintexts)Promise<Ciphertext[]>
decryptMessages(remoteAddress, ciphertexts)Promise<string[]>
processIncomingEnvelope(envelope, options?)Promise<ReceiveOutcome>
processIncomingEnvelopes(envelopes, options?)Promise<Array<{ envelope, outcome } | { envelope, error }>>
completeReceive(messageId)Promise<void>
listPendingReceives(query?)Promise<{ items: PendingReceive[], next? }>
discardPendingReceive(messageId)Promise<PendingReceive | null>
processPendingReceives(options?)Promise<{ processed, remaining }>
decryptEnvelope(envelope)Promise<{ plaintext, groupContext? }>
receiveIncomingEnvelopes(envelopes)Promise<{ processedMessageIds, failedMessageIds }>
encryptFile(remoteAddress, fileBlob, mimeType?)Promise<{ … }>
decryptFile(remoteAddress, encryptedBlob, encryptedKey)Promise<Blob>
encryptFiles(remoteAddress, files)Promise<Array<{ … }>>
decryptFiles(remoteAddress, files)Promise<Blob[]>
uploadAttachment(data, options)Promise<PreparedAttachmentUpload>
downloadAttachment(attachment, options?)Promise<DownloadedAttachment>
deleteRemoteAttachment(attachment, options?)Promise<void>

content on send() is DataMessageInput | string | Uint8Array. processIncomingEnvelopes() resolves per-envelope: outcomes and failures come back in the same array rather than one rejection aborting the batch.

forgetSentContent() deletes the resendable content of one group send, so a later retry request gets no content. It does not delete pairwise message records. getPendingRecipients() lists the recipient devices of a resendable group send that have not confirmed it with an E2EE delivery receipt.

Receive outcomes

processIncomingEnvelope() commits the decrypted content as a receive record with the ratchet step. The content stays recoverable until you call completeReceive(), or until the onPersist option resolves. The kind of the outcome tells you what to do with the envelope:

kindMeaningAcknowledge the envelope
processedGives plaintext, messageId, and groupId?. Save the content, then call completeReceive(messageId). A redelivery before that gives the same outcome with no second decryptyes
pendingThe content is stored and waits for its group state. listPendingReceives({ ready: true }) lists it when it is readyyes
duplicateThis client processed the envelope before, or the application already has its contentyes
null-messageThe envelope carries no content, or a GroupKeySync from an own device that the client consumedyes
deniedThe client refused the content. The ratchet step is spentyes
refusedThe receive queue has no room. Nothing is decrypted or storedno, give it again later

listPendingReceives() pages through the stored receives. discardPendingReceive() removes one that the application gives up on, and a redelivery of its envelope is then a duplicate. processPendingReceives({ deadlineMs }) runs one pass of the receive queue. decryptEnvelope() stores no content: the decrypt spends the ratchet step, so a lost plaintext is gone. Prefer processIncomingEnvelope().

Retry requests

When a message fails to decrypt with a retryable error, the client asks the sender device for a resend. It does not ask for an IMPLICIT message such as a receipt. A resend or a null message that answers an earlier retry request is the exception. It does not ask for a message with no known sender device, for a message from its own device, or past its rate limit. It sends a retry_request envelope through the relay send(). The client seals the request when it holds the access key of the sender, and follows the deliveryMode of sealedSender as a delivery receipt does. The sender resends the message only to the device that asked. A retry request ends 14 days after the first failure.

Without a relay, pass sendRetryRequest in the options of processIncomingEnvelope(). It receives an identified retry_request envelope, so 'required' sealed-sender mode never calls it. Deliver that envelope to the sender device like any other envelope.

A retry_request envelope holds no plaintext. processIncomingEnvelope() refuses it, identified or sealed, with INVALID_CIPHERTEXT and sends no retry request. The relay subscription and receiveIncomingEnvelopes() handle it. receiveIncomingEnvelopes() requires the onMessageDecrypted hook. It returns the IDs that are ready for acknowledgment as processedMessageIds.

The client gives the content of a failed message to the application at most once, from the failed envelope or from one resend. It drops a later copy. processIncomingEnvelope() acknowledges a dropped envelope and returns the duplicate outcome for it. The exception is a local store write that fails after the application got the content. The client then writes a warning with the behavior RETRY_FULFILL_WRITE_FAILED. A later redelivery can give the content again.

A sender that no longer has the plaintext answers with a null message. A null message carries no content. The client consumes it. It never gives a null message to onMessageDecrypted. processIncomingEnvelope() returns the null-message outcome for a null message. A custom contentAdapter must set nullMessage on each inspectContent() result, and set it to true for its own null encoding. It must also implement serializeGroupKeySync(input: GroupKeySyncInput): Uint8Array, and its inspectContent() must report the result as a sync of type 'groupKeySync' with its groupKey. GroupKeySyncInput is { masterKey, revision }. An adapter that spreads the result of createDefaultSignalProtocolContentAdapter() into itself gets the default method.

SendResult

send() resolves only after every device post, the sync copies, and the outbox record complete. The result holds no message plaintext.

FieldTypeMeaning
clientMessageIdstringStable identifier of the logical send; pass it to send() again after an unknown result
messageIdstringMessage identifier that the relay assigned
timestampnumberServer time at which the relay accepted the message
clientTimestampnumberClient timestamp of the message: the timestamp that the application gave, or the one that the SDK picked. It is unique per sender device. Store it to match receipts
recipientDeviceCountnumberRecipient devices that the relay accepted a copy for; acceptance is not delivery
duplicateboolean, optionalTrue only when the relay had already accepted every device post, so the send stored no new copy
expiresAtnumber, optionalEarliest time, in milliseconds since the epoch, at which the relay drops the copy of a device post that the device has not acknowledged
groupIdstring, optionalGroup ID of a group send
refusedDestinationCountnumber, optionalFor a group send over a group token, the destination devices that the relay refused when it accepted the shared post
syncPendingtrue, optionalThe relay accepted the send for every recipient device, but the copies for this account's other devices are not posted yet. The send is delivered. Call send() again with the same clientMessageId to post the copies
storageId, aesKey, segmentSize, digest, contentTypeoptionalPresent only for an attachment send

duplicate is true when the application repeats send() with the clientMessageId of a send whose posts the relay accepted but whose result did not arrive. duplicate and expiresAt are each present only when every device post reported the field. A relay that does not report them gives neither field.

A group send also counts its shared sealed post. For a group send over a group token, duplicate on the shared post means that the relay had already accepted its fan-out, not that each destination stored a copy. The sync copies to the other devices of this account do not count. The sender key pre-messages of a group send do not count. A send that the outbox had already completed returns the result that it stored.

Trust and safety

MethodReturns
verify(userId, identityType?)Promise<SafetyNumber>
confirmSafetyNumber(confirmation)Promise<void>
acceptIdentityRotation(userId, identity, identityType?)Promise<ContactIdentityRecord>

There are two different SafetyNumber shapes and they do not merge.

client.verify() returns { numeric, fingerprint, userId, identityType, trustState, confirmation }: no emojis, no scannable.

generateCompositeSafetyNumber() from /safety returns { numeric, emojis, hex, qrData, scannable }: no confirmation.

signal.trustIdentity(...) does not exist. Use acceptIdentityRotation(). Details in identity change and safety numbers.

Read state

MethodReturns
markAsRead(messageId)Promise<void>
sendReadReceipt(recipientUserId, timestamps)Promise<void>
sendViewedReceipt(recipientUserId, timestamps)Promise<void>

Relay and subscriptions

MethodReturns
startRelaySubscription()void
stopRelaySubscription()void
subscribeRelayConnectionState(listener)Unsubscribe
stop()Promise<void>

stop() tears down every subscription and in-flight timer. Call it before the process or screen goes away.

The relay subscription also carries retry requests. There is no separate retry subscription.

stop() and stopRelaySubscription() send each batched delivery receipt once before the relay subscription closes. stop() also sends each delivery receipt that still waits for a Relay reply, once. stop() then waits for the delivery receipt sends, with their app hooks, until a deadline 5 s after it starts. At the deadline, a send that waits in an app hook stops, and that receipt is not sent. A send that is in its relay call at the deadline is waited for. A hook of a delivery receipt send that awaits stop() holds stop() until the deadline. stop() does not wait for read and viewed receipt sends.

While stop() runs, a call to startRelaySubscription() is refused and logged. Start again after stop() resolves. A stop() call that overlaps a running stop() waits for it and settles as it settles.

relayConnectionState is the state of the relay subscription on this device. Its state is stopped, connecting, connected, or reconnecting. since is the Unix time in milliseconds of the transition. On reconnecting, reason names the site that failed: handshake, protocol, closed, error, frame, authentication, silent, or protocol-unsupported.

For protocol-unsupported, the Relay closed the socket with code 4400 and the reason PROTOCOL_UNSUPPORTED. The Relay does not serve the protocol version of the SDK yet. The subscription reconnects with its usual backoff. A stopped state that the Relay caused has one of these reasons:

ReasonCause
upgrade-requiredThe Relay closed the socket with code 4426 and the reason UPGRADE_REQUIRED. The Relay no longer serves the protocol version of the SDK, and only a newer SDK can connect again. A close 4400 with the reason PROTOCOL_UNSUPPORTED stays retryable.
authority-refusedThe Relay refused the socket token request or a pull conclusively, with retryable false and the code AUTHORITY_DENIED, NOT_FOUND, or OPERATION_EXPIRED. A deleted account gets this refusal.
device-revokedAn account recovery revoked this device, or the device was removed from the account, for example by idle expiry.
device-unknownThe Relay has no device for the stored session. A NOT_FOUND on the socket token request gives this reason, not authority-refused.

After each of these reasons, the subscription does not reconnect and does not pull. A switch over SignalProtocolRelayConnectionReason must handle each of these values. See when the Relay refuses this device.

The reason is never an error message. The state is local to this device and is not presence.

subscribeRelayConnectionState(listener) calls the listener once for each new state. It does not call the listener with the current state, and it never sends the same value twice. A token renewal on a live connection is not a transition.

Linked-device sync

Each of these sends a sync message to the account's other devices. All return Promise<void>.

MethodInput
syncReadToLinkedDevices(entries)ReadSyncEntryInput[]
syncViewOnceOpenToLinkedDevices(entry)ViewOnceOpenSyncInput
syncMediaAttachmentDeleteToLinkedDevices(entry)MediaAttachmentDeleteSyncInput
syncConfigurationToLinkedDevices(configuration)ConfigurationSyncInput
syncUsernameStateToLinkedDevices(usernameState)UsernameStateSyncInput
syncRecipientUsernameToLinkedDevices(recipientUsername)RecipientUsernameSyncInput
syncVerificationStateToLinkedDevices(verificationState)VerificationStateSyncInput
syncTaskNotificationAckToLinkedDevices(input)TaskNotificationAckSyncInput without acknowledgedOnDevice
syncBlockedRecipientsToLinkedDevices(blocked)BlockedRecipientsSyncInput

Typing and Sesame

MethodReturns
sendTypingIndicator(recipientUserId, recipientDeviceId, conversationId, action, groupId?)Promise<void>
receive(message)Promise<string>
getSesameStats()Promise<SesameStats>
cleanupExpiredSesameSessions()Promise<number>

action is a TypingAction. receive() takes a SesameMessage and returns the decrypted plaintext.

Prekeys

MethodReturns
checkPreKeyStatus()Promise<{ oneTimePreKeysRemaining, needsReplenishment }>
rotatePreKeys()Promise<PreKeyRotationResult>: signedRotated, kyberRotated, oneTimeReplenished, errors

Replenishment happens inside syncToServer() and rotatePreKeys(). See key rotation.

Sender-key groups

MethodReturns
createGroupSenderKey(groupId)Promise<{ … }>
getGroupSenderKeyDistribution(groupId)Promise<SenderKeyDistributionMessage | null>
processGroupSenderKeyDistribution(groupId, senderId, senderDeviceId, message)Promise<void>
distributeSenderKeyToUser(groupId, recipientUserId)Promise<void>
distributeGroupSenderKey(groupId, memberUserIds)Promise<void>
encryptGroupMessage(groupId, plaintext)Promise<Uint8Array>. For a managed group, a receiver denies the output unless the plaintext carries a group context: use send()
rotateGroupSenderKey(groupId)Promise<{ … }>
deleteGroupSenderKey(groupId)Promise<void>
hasGroupSenderKey(groupId)Promise<boolean>
getGroupSenderKeyStats(groupId, senderId, senderDeviceId)Promise<{ … }>
handleGroupMembershipChange(groupId, change)Promise<{ rotated, distributionMessage }>

change is 'member_added' | 'member_removed' | 'metadata_changed'.

Encrypted group state

MethodReturns
createGroup(creatorAci, creatorProfileKey, members, title, options?)Promise<{ groupId, masterKey }>
getGroupState(groupId)Promise<DecryptedGroup>
getGroupInitStatus(groupId)Promise<GroupInitStatus | null>
syncGroup(groupId)Promise<DecryptedGroup>
addGroupMember(groupId, editorAci, member)Promise<void>
acceptGroupMemberInvitation(groupId)Promise<void>
declineGroupMemberInvitation(groupId, identity?)Promise<void>
removeGroupMember(groupId, editorAci, targetAci)Promise<void>
leaveGroup(groupId, userAci)Promise<void>
updateGroupTitle(groupId, editorAci, title)Promise<void>
updateGroupDescription(groupId, editorAci, description)Promise<void>
updateGroupAccessControl(groupId, editorAci, updates)Promise<void>
createGroupInviteLink(groupId, editorAci)Promise<string>
joinGroupViaInviteLink(url, userAci, userProfileKey)Promise<{ groupId, status }>

members is GroupMemberInput[], and member is one GroupMemberInput: { aciBytes, profileKey, profileKeyCredential, role? } adds a member immediately, and { serviceIdBytes, role? } invites one. status is 'joined' | 'pending_approval'. A GroupInitStatus is 'ready', 'stale', 'pending', 'no-key', or 'denied'. getGroupInitStatus() returns null when this device has no record of the group. These methods require the groups config block. Both group APIs are real and coexist: see groups.

Misc

MethodReturns
getStats()Promise<{ … }>
getSessionHealth(userId)Promise<SessionHealthResult>
cleanupExpiredKeys(remoteAddress)Promise<boolean>
clearAllData()Promise<void>
registerHook(name, callback)void

Hooks

registerHook(name, callback) attaches one lifecycle callback. Hook errors are caught internally and do not affect protocol operation, which also means a throwing hook fails silently: log inside it. registerHook() and the hooks option throw for a name that is not a hook.

signal.registerHook('onMessageDecrypted', async (message) => {
  await appMessages.insert({ senderId: message.senderId, body: message.content });
});
HookSignature
onSessionEstablished(sessionId, remoteAddress)
onSessionDeleted(sessionId)
onSessionArchived(sessionId)
onKeyRotated(keyType: 'ecSignedPreKey' | 'kemLastResortPreKey')
onMessageEncrypted(sessionId, counter)
onMessageDecrypted(envelope: DecryptedEnvelope)
onDecryptionError(sessionId, error)
onEncryptionError(sessionId, error)
onKeysCleanedUp(sessionId, removedCount)
onDelivered(event: DeliveredEvent)
onReadReceiptReceived(senderId, timestamps)
onViewedReceiptReceived(senderId, timestamps)
onTypingIndicatorReceived(senderId, conversationId, action)
onRetryTerminal(event: RetryTerminalEvent)
onDeliveryError(event: DeliveryErrorEvent)
onDeliveryRecovered(event: DeliveryRecoveredEvent)
onReceiveExpired(event: ReceiveExpiredEvent)
onGroupInitStatus(groupId: GroupId, status: GroupInitStatus)
onRelayProtocolError(error: SignalProtocolRelayProtocolError)

DecryptedEnvelope carries messageId, sessionId, senderId, senderDeviceId, conversationId, content, timestamp, serverTimestamp?, receivedAt, isGroup, arrivedSealed, and messageType?. arrivedSealed is true when the message arrived through sealed sender. DeliveredEvent carries clientMessageId, recipientId, recipientDeviceId, source, sources, decryptionConfirmed, deliveredAt, clientTimestamp, and groupId?. A DeliverySource is 'signal-relay', 'relay', or 'e2ee'. The SDK reports 'signal-relay' for a Relay delivery receipt. It does not report 'relay'. The type keeps 'relay', so code that compares the source with both values compiles. RetryTerminalEvent carries class, failedEnvelopeId, and recovery?. A posting-deadline end of a client with a relay has recovery. A request-expired end that the SDK moved from an SDK 13.x record can also have it. onRetryTerminal runs once when a retry request ends with no resend. See when a retry request ends with no resend. onDeliveryError runs for a failed incoming message whose decrypt asked the sender for a resend. A failure that no resend can repair goes to onDecryptionError instead. The content hint of the message sets the time. With the Default hint or no hint, the event runs at the first failure. With the Resendable hint, it runs at the retry deadline after the first failure. With the Implicit hint, it never runs. A rate limit that refuses the retry request, or the end of the request, makes the event due at once. onDeliveryRecovered runs when the content arrives after onDeliveryError ran for it. Make both idempotent for one failedEnvelopeId. onReceiveExpired runs before the client drops received content that waited 30 days. onGroupInitStatus runs when a client write changes the init status of a group. It does not run when the status stays the same. See groups. onRelayProtocolError reports a relay defect, such as a declared post that the relay accepted without the deviceSetChecked mark (DEVICE_SET_UNCHECKED). You can supply the same set through the hooks config option.

Delivery receipts

A received message can ask for a delivery receipt. After the onMessageDecrypted hook resolves for it, the client can send an E2EE receipt to each device of the sender. An E2EE receipt is an end-to-end encrypted delivery receipt. The deliveryReceipts option selects the messages:

ValueReceipt
'auto' (default)On the Signal Protocol Relay, an E2EE receipt unless the Relay reply to the acknowledgment lists the message as receipted. On any other relay, the same receipts as 'always'
'always'An E2EE receipt for each message that asks for one, sealed or identified
'off'None

Any other value makes client creation throw. Read receipts are not affected.

With 'auto' on the Signal Protocol Relay, the Relay can list an identified message as receipted in its reply to the acknowledgment. The client then sends no E2EE receipt for that message. The client sends the E2EE receipt when the reply omits the message or the acknowledgment fails. It also sends it when no reply comes in 30 s, or when the connection closes first. A sealed message always gets the E2EE receipt, because the Relay does not know its sender.

The client seals an E2EE receipt when it holds the access key of the sender. Otherwise it sends the receipt identified. When sealedSender.deliveryMode is 'required', the client does not send a receipt that it cannot seal. In that mode, a Relay that refuses the access key does not make the receipt identified.

The client batches the delivery receipts for each sender. It sends a batch 3 s after its last message or 30 s after its first message, whichever comes first. A batch of 100 messages goes at once.

The client keeps each received message that owes an E2EE receipt in a receive queue in the local store. After the client sends the receipt, it marks the message as complete in the queue. While the client sends the receipt and marks the message as complete, it does not send a second receipt for that message.

The client can send the same receipt again in these cases:

  • The send fails with an error that is not permanent. The client sends the receipt again after a wait.
  • The write that marks the message as complete fails. The client sends the receipt again later.
  • The client or the process stops between the send and the write that marks the message as complete. The client sends the receipt again after the next start.

The client sends no E2EE receipt in these cases:

  • The Relay reply to the acknowledgment lists the message as receipted.
  • The Relay refuses the receipt send with a permanent error. The client then marks the message as complete.
  • One day passes, and the client has not sent the receipt. The day starts when the onMessageDecrypted hook resolves. When the client waits for the Relay reply, the day starts 30 s after the acknowledgment. The client then marks the message as complete.
  • The message waited 30 days in the receive queue of this device. The client then marks the message as complete.
  • The client uses the in-memory store and restarts. The in-memory store loses the receive queue at a restart.

The sender gets each delivery through the onDelivered hook. The hook runs once for each source of each recipient device. A Relay delivery receipt adds the source 'signal-relay'. It states only that the recipient device acknowledged the message to the Relay. It does not state that the device decrypted it. An E2EE receipt adds the source 'e2ee'. decryptionConfirmed is true when sources includes 'e2ee'. The status of a device only moves forward. sources holds each source of the device so far, in the order of arrival. A second receipt from the same source does not run the hook. A receipt for a send that has not resolved runs the hook after the send resolves. Relay delivery receipts and E2EE receipts describes the Relay side.

The client remembers the receipt ID of each Relay delivery receipt that it processed. It keeps the last 4,096 receipt IDs in memory. A replay with a receipt ID that the client remembers does not change the delivery state. The client acknowledges it to the Relay again. After a restart, or after 4,096 newer receipt IDs, the client applies a replay of that receipt to the delivery state again.

The sender keeps a copy of each resendable message that it sends, plaintext included, when protocol.contentRecovery allows the local store to hold it. With that copy, it can send the message again when the recipient asks for a retry. An E2EE receipt from a recipient device deletes that copy for that device. A Relay delivery receipt does not delete it. A resend that answers a retry request replaces the copy with the copy of the new encryption. An E2EE receipt from that recipient device, or the end of the retention, deletes the replacement too. A message that gets no E2EE receipt keeps its copy on the sender device until protocol.contentRecovery.retentionMs ends, 14 days by default. The client deletes such old copies at creation, at stop(), and before the first resendable group send of each day.

These are not the React hooks at /hooks. Those are useSessionHealth, useKeyRotation, and siblings. See Standalone modules.

client.media

A durable job facade over the configured local store. Jobs survive process restarts because store metadata persists the queue.

MethodSignature
upload(input, options?) => Promise<SignalProtocolClientMediaUploadResult>
download(input, options?) => Promise<SignalProtocolClientMediaDownloadResult>
cleanup(input, options?) => Promise<SignalProtocolClientMediaCleanupResult>
processPending(options?) => Promise<SignalProtocolClientMediaProcessResult>

Use status to discriminate results: 'completed', 'pending', 'failed', 'skipped'. This page does not reproduce input field shapes. Read them from the generated reference rather than guessing.

Media moves bytes if you supply the media config callbacks: loadLocalAttachment, saveUploadedAttachment, saveDownloadedAttachment, deleteLocalAttachment, and optionally syncDelete. Your app owns the bytes and the cache. Upload and download also require adapters.remoteObjectStore. See attachments and object storage.

Standalone modules

Everything the client does not expose as a method lives at an explicit subpath. Full list with export names: Package subpaths.

SubpathPrincipal exports
/keysgenerateIdentityKeyPair, generateEcSignedPreKey, createCompositeIdentityV1, type CompositeIdentityV1, type IdentityTrustState
/safetygenerateCompositeSafetyNumber, compareSafetyNumbers, isValidSafetyNumber, ScannableFingerprint, verify-link helpers
/device/expo, /device/react-nativegetTransferDeviceInfo, getDeviceLifecyclePlatform
/deviceprepareNewDeviceTransfer, prepareOldDeviceTransferWithBackup, createDeviceBackup, restoreDeviceBackup, encryptDeviceName, MAX_DEVICES
/device/device-idgetDeviceId, getDeviceIdSync, preloadDeviceId, clearDeviceIdCache
/device/lifecycleDeviceLifecycleManager, getLocalDeviceMetadata
/sealed-senderderiveAccessKey, ACCESS_KEY_BYTES
/blockingSignalProtocolBlockingManager — blockRecipient, unblockRecipient, isBlocked, listBlockedRecipients, applySyncSnapshot
/profileencryptProfileName, decryptProfileName, getOrCreateOwnProfileKey, setOwnProfileKey, updateEncryptedProfile
/username, /username/linkformatUsername, hashUsername, parseUsername; createUsernameLink, decryptUsernameLink
/groupsGroupManager, createGroupId, type GroupServer, type GroupStateStore
/zk/groups, /zk/credentialscomputeProfileKeyVersion, deriveGroupSecretParams, getGroupPublicParams; credential-key serialization
/clientbindSignalProtocolRelayLifecycle(signal, appState, { keepOpenInBackground? }), joinHostedSignalProtocolRelayAccount, approveHostedSignalProtocolRelayDeviceLink, linkHostedSignalProtocolRelayDevice, listHostedSignalProtocolRelayDevices, renameHostedSignalProtocolRelayDevice, removeHostedSignalProtocolRelayDevice
/hooksuseSessionHealth({ signal, userId }), useKeyRotation({ signal?, rateLimitMs?, enabled?, onRotationComplete?, onRotationError? }), useKeyRotationWithControls, useSignalProtocolRelayConnectionState({ signal }), useSignalProtocolRelayLifecycle({ signal, keepOpenInBackground? }), useGroupMembership, useSingleFlight
/filesstreamingEncrypt, streamingDecrypt, DEFAULT_SEGMENT_SIZE, secureZeroBytes
/encoding, /encoding/hexbytesToBase64, base64ToBytes, bytesToHex, hexToBytes
/utils/retrywithRetry, isRetryableError — see Errors
/logger, /server-clockcreateDefaultSignalProtocolLogger, resolveSignalProtocolLogger; recordServerClockSample, estimateServerTimestamp

useSessionHealth returns { health, isLoading, error, refresh }.

useSignalProtocolRelayConnectionState returns the current SignalProtocolRelayConnectionState and renders the component again on each transition. useSignalProtocolRelayLifecycle passes React Native's AppState to bindSignalProtocolRelayLifecycle and does nothing on web. bindSignalProtocolRelayLifecycle stops the relay subscription when the app goes to the background state, and starts it again when the app becomes active. See React Native app state.

Roadmap language in the SDK repository

The "Future Direction (Not Shipped)" section of docs/CLIENT_COMPOSITION.md in the SDK repository names deviceStorage, createExpoDeviceStorage, and signal.messages.subscribe. None of them exists in 15.0.x. They are design intent, not shipped API.

The real equivalents are adapters.storage, signal.send(), signal.registerHook() plus signal.startRelaySubscription(), and the store factories at /local/store/*.

Next

On this page