Package-level declarations
Types
Nonces of accepted authenticated requests, per device, for replay protection (docs/server-authentication.md). Entries only need to live as long as their request timestamp is inside the server's validity window.
Client storage boundary.
The local device's authentication key pair (docs/server-authentication.md), separate from the messaging identity. There is at most one active key. It is replaced only by promoting a pending key after the server accepted it: the pending recovery key of a device recovery (docs/device-recovery.md), the pending rotation key of a routine rotation (docs/device-authentication-rotation.md) or the pending last-device recovery key of a last-device recovery (docs/last-device-recovery.md). The three pending slots are separate, and at most one of them is filled at a time.
A rejected device registration. Nothing was stored. Messages never contain key bytes.
Device authentication public keys, one per DeviceAddress (docs/server-authentication.md). A registration is added by register and replaced only by replaceForRecovery (docs/device-recovery.md) or replaceForRotation (docs/device-authentication-rotation.md); it is never removed. Atomic; byte arrays are copied at the boundary.
A stored registration: registration with its authEpoch, the server time authKeyInstalledAt its key was installed at, and the transition that installed the key: recoveryId for a device recovery, rotationId for a routine rotation, lastDeviceRecoveryId for a last-device recovery, none for a key from first registration. At most one of them is set.
The local device's long-term identity key pair. There is at most one.
Outcome of LastDeviceRecoveryRepository.issueChallenge.
A request for a challenge for target: the server-chosen random candidateId and candidateNonce (used only if a new challenge is stored), the server time now and the new challenge's expiresAt.
A rejected recovery key registration. Nothing was stored. Messages never contain key bytes.
A verified last-device recovery for DeviceRegistrationRepository.replaceForLastDeviceRecovery: replace the key of expected with replacementPublicKey, authorized by the recovery key expectedRecoveryPublicKey over the challenge challengeId / challengeNonce. expected is the state the signatures were verified against. now is the server time: the challenge must not have expired before it, and it becomes the new key's installation time.
Last-device recovery state (docs/last-device-recovery.md, docs/recovery-key-lifecycle.md): per user the state of its offline recovery key (public key, recovery key epoch, transition metadata), and per device at most one outstanding server-issued challenge. Shares its atomicity with DeviceRegistrationRepository and AuthenticationNonceRepository: DeviceRegistrationRepository.replaceForLastDeviceRecovery consumes a challenge in the same step as it replaces the key, and a recovery key rotation or revocation claims its nonce, compares the authorizing device's registration and removes every challenge of the user in the same step as it changes the recovery key. Never holds private key material.
Queues opaque envelopes per recipient device. See docs/transport-ordering.md for why the order matters.
A received application message the application has not finalized (committed or discarded) yet (docs/application-delivery.md).
Received application messages kept until the application commits or discards them, so they can be delivered again, also after a restart. Keyed by (sender, logical ID).
A sent application message the recipient has not acknowledged yet (docs/message-reliability.md).
Sent application messages kept until the recipient acknowledges them, so they can be encrypted and sent again. Keyed by (recipient, logical ID).
A rejected publication. The repository state is unchanged. Messages never contain key bytes.
Public prekey material of each device, as published by the devices. Holds public keys only; the server never sees private keys. State is kept per DeviceAddress: one identity key, one current signed prekey, an inventory of available one-time prekeys and the IDs of consumed one-time prekeys.
The local device's private prekeys.
A finalized received message: its terminal tombstone (docs/application-delivery.md, docs/message-discard.md).
Terminal tombstones of the logical messages the application committed or discarded, for duplicate suppression (docs/message-reliability.md, docs/application-delivery.md, docs/message-discard.md). Keyed by (sender, logical ID): the same ID from another sender is a different message. An entry is never replaced, so its outcome never changes; entries are removed only by pruneFinalizedAtOrBefore.
Who cancels a pending reset: see RecoveryKeyResetCancellation.
A verified reset completion for LastDeviceRecoveryRepository.completeRecoveryKeyReset: the pending reset resetId of userId's key expectedPublicKey at expectedEpoch (requested at requestedAt, eligible from eligibleAt) is completed with newPublicKey by expectedCompleter (the registration the ServerAuth request was verified with). now is the server time, compared with the eligibility time and stored as installation time.
A reset request for LastDeviceRecoveryRepository.requestRecoveryKeyReset by requester (the registration the ServerAuth request was verified with): the server-chosen random candidateId (used only if a new reset is stored), the server time now and the policy's eligibleAt. The key and epoch the reset binds are read by the repository in the same step, never supplied.
A verified recovery key revocation for LastDeviceRecoveryRepository.revokeRecoveryKey: revoke userId's key expectedPublicKey at expectedEpoch. The other fields as in RecoveryKeyRotationTransition; now becomes the revocation time.
A verified recovery key rotation for LastDeviceRecoveryRepository.rotateRecoveryKey: replace userId's key expectedPublicKey at expectedEpoch with newPublicKey. expectedAuthorizer is the authorizing device's registration the ServerAuth request was verified with; the rotation only happens while it is still current. nonce / timestamp are the statement's (client-supplied, used for replay protection only); now is the server time stored as installation time.
A user's stored recovery key state (docs/recovery-key-lifecycle.md): epoch, the publicKey and its server installation time installedAt (both only while status is RecoveryKeyStatus.ACTIVE), the server time of the last transition transitionedAt (registration, rotation, reset completion or revocation; for a revoked key the revocation time), and the transition that produced this state: rotationId for a rotation, revocationId for a revocation, resetCompletionId for a completed delayed reset, none for a registration. At most one of them is set.
Whether a user's recovery key is ACTIVE or REVOKED. A user that never registered one has no RecoveryKeyState.
A verified recovery for DeviceRegistrationRepository.replaceForRecovery: replace expectedTarget's key with replacementPublicKey, authorized by expectedAuthorizer. Both expected states are what the signatures were verified against; the replacement only happens if they are still current. timestamp is the request's (client-supplied) time, used for the nonce; installedAt is the server time stored as the new key's installation time.
A pinned remote identity key and whether the user verified exactly this key (docs/identity-verification.md). identityKey is a copy.
Remote identity keys pinned on first contact (trust on first use, see docs/identity-trust.md). One public identity key per remote DeviceAddress; two devices of the same user have separate entries.
A verified routine rotation for DeviceRegistrationRepository.replaceForRotation: replace the key of expected with replacementPublicKey. expected is the state the signatures were verified against; the replacement only happens if it is still current. timestamp is the statement's (client-supplied) time, used for the nonce; installedAt is the server time stored as the new key's installation time.
Session initiations from a remote device that must never become the current session again (see docs/session-lifecycle.md): initiations whose session was replaced, and initiations that lost a simultaneous-initiation collision. Kept per remote DeviceAddress. IDs are public values.
Lifecycle metadata of one stored signed prekey. Holds no key material.
A stored challenge: the public challenge, the registered key it was issued for (authPublicKey, server-side only, never returned to clients) and the recovery key epoch it was issued under (recoveryKeyEpoch; a rotation or revocation of the recovery key invalidates it).