Class IndexedDBCryptoStore

An implementation of CryptoStore, which is normally backed by an indexeddb, but with fallback to MemoryCryptoStore.

Implements

Constructors

Properties

Methods

Constructors

Properties

STORE_ACCOUNT: string = "account"
STORE_BACKUP: string = "sessions_needing_backup"
STORE_DEVICE_DATA: string = "device_data"
STORE_INBOUND_GROUP_SESSIONS: string = "inbound_group_sessions"
STORE_INBOUND_GROUP_SESSIONS_WITHHELD: string = "inbound_group_sessions_withheld"
STORE_PARKED_SHARED_HISTORY: string = "parked_shared_history"
STORE_ROOMS: string = "rooms"
STORE_SESSIONS: string = "sessions"
STORE_SHARED_HISTORY_INBOUND_GROUP_SESSIONS: string = "shared_history_inbound_group_sessions"

Methods

  • 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.

    Type Parameters

    • T

    Parameters

    • mode: Mode

      'readwrite' if you need to call setter functions with this transaction. Otherwise, 'readonly'.

    • stores: Iterable<string, any, any>

      List IndexedDBCryptoStore.STORE_* options representing all types of object that will be accessed or written to with this transaction.

    • func: (txn: IDBTransaction) => T

      Function called with the transaction object: an opaque object that should be passed to store functions.

    • Optionallog: Logger

      A possibly customised log

    Returns Promise<T>

    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.

  • Retrieve a specific end-to-end session between the logged-in user and another device.

    Parameters

    • deviceKey: string

      The public key of the other device.

    • sessionId: string

      The ID of the session to retrieve

    • txn: IDBTransaction

      An active transaction. See doTxn().

    • func: (session: null | ISessionInfo) => void

      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.

    Returns void

  • Retrieve the end-to-end sessions between the logged-in user and another device.

    Parameters

    • deviceKey: string

      The public key of the other device.

    • txn: IDBTransaction

      An active transaction. See doTxn().

    • func: (sessions: { [sessionId: string]: ISessionInfo }) => void

      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.

    Returns void