Class IndexedDBCryptoStore

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

Hierarchy

  • IndexedDBCryptoStore

Implements

Constructors

Properties

backend?: CryptoStore
backendPromise?: Promise<CryptoStore>
dbName: string

name of db to connect to

indexedDB: IDBFactory

global indexedDB instance

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.

    Returns

    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.

    Type Parameters

    • T

    Parameters

    • mode: Mode

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

    • stores: Iterable<string>

      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.

    • Optional log: PrefixedLogger

      A possibly customised log

    Returns Promise<T>

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

        • (sessions: {
              [sessionId: string]: ISessionInfo;
          }): void
        • Parameters

          Returns void

    Returns void

Generated using TypeDoc