Class: WebStorageSessionStore

store/session/webstorage~WebStorageSessionStore

new WebStorageSessionStore(webStore)

Construct a web storage session store, capable of storing account keys, session keys and access tokens.
Parameters:
Name Type Description
webStore WebStorage A web storage implementation, e.g. 'window.localStorage' or 'window.sessionStorage' or a custom implementation.
Source:
Throws:
if the supplied 'store' does not meet the Storage interface of the WebStorage API.

Methods

getDeviceAnnounced() → {boolean}

Check if the "device announced" flag is set
Source:
Returns:
true if the "device announced" flag has been set.
Type
boolean

getEndToEndAccount() → (nullable) {string}

Load the end to end account for the logged-in user.
Source:
Returns:
Base64 encoded account.
Type
string

getEndToEndDevicesForUser(userId) → {object}

Retrieves the known devices for a user.
Parameters:
Name Type Description
userId string The user's ID.
Source:
Returns:
A map from device ID to keys for the device.
Type
object

getEndToEndRoom(roomId) → {object}

Get the end-to-end state for a room
Parameters:
Name Type Description
roomId string The room's ID.
Source:
Returns:
The end-to-end info for the room.
Type
object

getEndToEndSessions(deviceKey) → {object}

Retrieve the end-to-end sessions between the logged-in user and another device.
Parameters:
Name Type Description
deviceKey string The public key of the other device.
Source:
Returns:
A map from sessionId to Base64 end-to-end session.
Type
object

setDeviceAnnounced()

Store a flag indicating that we have announced the new device.
Source:

storeEndToEndAccount(account)

Store the end to end account for the logged-in user.
Parameters:
Name Type Description
account string Base64 encoded account.
Source:

storeEndToEndDevicesForUser(userId, devices)

Stores the known devices for a user.
Parameters:
Name Type Description
userId string The user's ID.
devices object A map from device ID to keys for the device.
Source:

storeEndToEndRoom(roomId, roomInfo)

Store the end-to-end state for a room.
Parameters:
Name Type Description
roomId string The room's ID.
roomInfo object The end-to-end info for the room.
Source:

storeEndToEndSession(deviceKey, sessionId, session)

Store a session between the logged-in user and another device
Parameters:
Name Type Description
deviceKey string The public key of the other device.
sessionId string The ID for this end-to-end session.
session string Base64 encoded end-to-end session.
Source: