PreKeyStore
The local device's private prekeys.
Signed prekeys follow a lifecycle (docs/signed-prekey-lifecycle.md): the current one is published; storeCurrentSignedPreKey moves it into a grace period in which an incoming PreKeyMessage may still name it; the client deletes it with removeSignedPreKey once the grace period is over. Storage only records the timestamps, the client makes the decisions.
IDs are allocated upward from a persisted high-water mark (the highest ID ever stored, see highestSignedPreKeyId and highestOneTimePreKeyId). Removing a key does not lower it, so IDs are never reused. Storing a key whose ID is not above the high-water mark throws IllegalArgumentException.
Functions
The signed prekey to publish, or null if none was stored yet.
Public halves of all stored one-time prekeys, ordered by ID.
Deletes a one-time prekey after a session was accepted with it.
Deletes the signed prekey id, private key included. Throws IllegalArgumentException for the current one. Deleting a key that is not stored does nothing. The high-water mark is kept.
Any stored signed prekey, current or replaced.
Metadata of the stored signed prekey id, or null if it is not stored.
Metadata of all stored signed prekeys, ordered by ID.
Gives keys stored before milestone 7 their timestamps: a missing SignedPreKeyInfo.createdAt becomes at, and so does a missing SignedPreKeyInfo.replacedAt of a key that is not current. Keys that have timestamps are not changed.
Stores preKey, created at createdAt, and makes it current. The previous current key stays available by ID; its SignedPreKeyInfo.replacedAt becomes createdAt.