Create a new IndexedDBCryptoStore
global indexedDB instance
name of db to connect to
Static
STORE_Static
STORE_Static
STORE_Static
STORE_Static
STORE_Static
STORE_Static
STORE_Static
STORE_Static
STORE_Adds an end-to-end inbound group session to the store. If there already exists an inbound group session with the same senderCurve25519Key and sessionID, the session will not be added.
The sender's curve 25519 key
The ID of the session
The session data structure
An active transaction. See doTxn().
Park a shared-history group session for a room we may be invited to later.
Optional
txn: IDBTransactionAdd a shared-history group session for a room.
The room that the key belongs to
The sender's curve 25519 key
The ID of the session
Optional
txn: IDBTransactionAn active transaction. See doTxn(). (optional)
Internal
Returns true if this CryptoStore has ever been initialised (ie, it might contain data).
Implementation of CryptoStore.containsData.
Internal
Count the number of Megolm sessions in the database.
Implementation of CryptoStore.countEndToEndInboundGroupSessions.
Returns the number of end-to-end sessions in the store
An active transaction. See doTxn().
Called with the count of sessions
Count the inbound group sessions that need to be backed up.
Optional
txn: IDBTransactionAn active transaction. See doTxn(). (optional)
resolves to the number of sessions
Internal
Delete a batch of Megolm sessions from the database.
Implementation of CryptoStore.deleteEndToEndInboundGroupSessionsBatch.
Internal
Delete a batch of Olm sessions from the database.
Implementation of CryptoStore.deleteEndToEndSessionsBatch.
Look for an existing room key request by id and state, and delete it if found
ID of request to update
state we expect to find the request in
resolves once the operation is completed
Perform a transaction on the crypto store. Any store methods that require a transaction (txn) object to be passed in may only be called within a callback of either this function or one of the store functions operating on the same transaction.
'readwrite' if you need to call setter functions with this transaction. Otherwise, 'readonly'.
List IndexedDBCryptoStore.STORE_* options representing all types of object that will be accessed or written to with this transaction.
Function called with the transaction object: an opaque object that should be passed to store functions.
Optional
log: LoggerA possibly customised log
Promise that resolves with the result of the func
when the transaction is complete. If the backend is
async (ie. the indexeddb backend) any of the callback
functions throwing an exception will cause this promise to
reject with that exception. On synchronous backends, the
exception will propagate to the caller of the getFoo method.
Fetches all inbound group sessions in the store
An active transaction. See doTxn().
Called once for each group session
in the store with an object having keys {senderKey, sessionId, sessionData}
,
then once with null to indicate the end of the list.
Retrieve all end-to-end sessions
An active transaction. See doTxn().
Called one for each session with an object with, deviceKey, lastReceivedMessageTs, sessionId and session keys.
Look for room key requests by state – unlike above, return a list of all entries in one state.
Returns an array of requests in the given state
Get the public part of the cross-signing keys (eg. self-signing key, user signing key).
An active transaction. See doTxn().
Called with the account keys object:
{ key_type: base64 encoded seed }
where key type = user_signing_key_seed or self_signing_key_seed
Get the state of all tracked devices
An active transaction. See doTxn().
Function called with the device data
Retrieve the end-to-end inbound group session for a given server key and session ID
The sender's curve 25519 key
The ID of the session
An active transaction. See doTxn().
Called with A map from sessionId to Base64 end-to-end session.
Internal
Fetch a batch of Megolm sessions from the database.
Implementation of CryptoStore.getEndToEndInboundGroupSessionsBatch.
Get an object of roomId->roomInfo
for all e2e rooms in the store
An active transaction. See doTxn().
Function called with the end-to-end encrypted rooms
Retrieve a specific end-to-end session between the logged-in user and another device.
The public key of the other device.
The ID of the session to retrieve
An active transaction. See doTxn().
Called with A map from sessionId to session information object with 'session' key being the Base64 end-to-end session and lastReceivedMessageTs being the timestamp in milliseconds at which the session last received a message.
Retrieve the end-to-end sessions between the logged-in user and another device.
The public key of the other device.
An active transaction. See doTxn().
Called with A map from sessionId to session information object with 'session' key being the Base64 end-to-end session and lastReceivedMessageTs being the timestamp in milliseconds at which the session last received a message.
Internal
Fetch a batch of Olm sessions from the database.
Implementation of CryptoStore.getEndToEndSessionsBatch.
Internal
Get data on how much of the libolm to Rust Crypto migration has been done.
Implementation of CryptoStore.getMigrationState.
Look for an existing outgoing room key request, and if none is found, add a new one
resolves to OutgoingRoomKeyRequest: either the same instance as passed in, or the existing one.
Look for an existing room key request
existing request to look for
resolves to the matching OutgoingRoomKeyRequest, or null if not found
Look for room key requests by state
list of acceptable states
resolves to the a OutgoingRoomKeyRequest, or null if there are no pending requests in those states. If there are multiple requests in those states, an arbitrary one is chosen.
Look for room key requests by target device and state
Target user ID
Target device ID
list of acceptable states
resolves to a list of all the OutgoingRoomKeyRequest
An active transaction. See doTxn().
Called with the private key
A key type
Get the shared-history group session for a room.
The room that the key belongs to
Optional
txn: IDBTransactionAn active transaction. See doTxn(). (optional)
Promise which resolves to an array of [senderKey, sessionId]
Mark sessions as needing to be backed up.
The sessions that need to be backed up.
Optional
txn: IDBTransactionAn active transaction. See doTxn(). (optional)
resolves when the sessions are marked
Internal
Set data on how much of the libolm to Rust Crypto migration has been done.
Implementation of CryptoStore.setMigrationState.
Ensure the database exists and is up-to-date, or fall back to a local storage or in-memory store.
This must be called before the store can be used.
resolves to either an IndexedDBCryptoStoreBackend.Backend, or a MemoryCryptoStore
Write the account pickle to the store. This requires an active transaction. See doTxn().
An active transaction. See doTxn().
The new account pickle to store.
Write the cross-signing keys back to the store
An active transaction. See doTxn().
keys object as getCrossSigningKeys()
Store the state of all tracked devices This contains devices for each user, a tracking state for each user and a sync token matching the point in time the snapshot represents. These all need to be written out in full each time such that the snapshot is always consistent, so they are stored in one object.
An active transaction. See doTxn().
Writes an end-to-end inbound group session to the store. If there already exists an inbound group session with the same senderCurve25519Key and sessionID, it will be overwritten.
The sender's curve 25519 key
The ID of the session
The session data structure
An active transaction. See doTxn().
Store the end-to-end state for a room.
The room's ID.
The end-to-end info for the room.
An active transaction. See doTxn().
Store a session between the logged-in user and another device
The public key of the other device.
The ID for this end-to-end session.
Session information object
An active transaction. See doTxn().
Write the cross-signing private keys back to the store
An active transaction. See doTxn().
The type of cross-signing private key to store
keys object as getCrossSigningKeys()
Pop out all shared-history group sessions for a room.
Optional
txn: IDBTransactionUnmark sessions as needing to be backed up.
The sessions that need to be backed up.
Optional
txn: IDBTransactionAn active transaction. See doTxn(). (optional)
resolves when the sessions are unmarked
Look for an existing room key request by id and state, and update it if found
ID of request to update
state we expect to find the request in
name/value map of updates to apply
resolves to OutgoingRoomKeyRequest updated request, or null if no matching row was found
Static
existsStatic
existsUtility to check if a legacy crypto store exists and has not been migrated. Returns true if the store exists and has not been migrated, false otherwise.
An implementation of CryptoStore, which is normally backed by an indexeddb, but with fallback to MemoryCryptoStore.