Class IndexedDBCryptoStore

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

Implements

Constructors

Properties

Methods

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

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

    Parameters

    • senderCurve25519Key: string

      The sender's curve 25519 key

    • sessionId: string

      The ID of the session

    • sessionData: InboundGroupSessionData

      The session data structure

    • txn: IDBTransaction

      An active transaction. See doTxn().

    Returns void

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

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

    • func: ((txn) => T)

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

    • Optional log: 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 the end-to-end inbound group session for a given server key and session ID

    Parameters

    • senderCurve25519Key: string

      The sender's curve 25519 key

    • sessionId: string

      The ID of the session

    • txn: IDBTransaction

      An active transaction. See doTxn().

    • func: ((groupSession, groupSessionWithheld) => void)

      Called with A map from sessionId to Base64 end-to-end session.

    Returns void

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

        • (session): void
        • Parameters

          Returns void

    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) => 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): void
        • Parameters

          Returns void

    Returns void

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

    Parameters

    Returns void

Generated using TypeDoc