From f214c53fa96f8fda4d7de1326e409e3a4e2a6b55 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 23 Oct 2020 12:59:40 +0200 Subject: [PATCH] add @internal and other comments to Session --- src/matrix/Session.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index f83dda95..e0ee215e 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -98,6 +98,8 @@ export class Session { // called once this._e2eeAccount is assigned _setupEncryption() { console.log("loaded e2ee account with keys", this._e2eeAccount.identityKeys); + // TODO: this should all go in a wrapper in e2ee/ that is bootstrapped by passing in the account + // and can create RoomEncryption objects and handle encrypted to_device messages and device list changes. const senderKeyLock = new LockMap(); const olmDecryption = new OlmDecryption({ account: this._e2eeAccount, @@ -241,6 +243,7 @@ export class Session { } } + /** @internal */ async load() { const txn = this._storage.readTxn([ this._storage.storeNames.session, @@ -284,6 +287,12 @@ export class Session { } } + /** + * @internal called when coming back online + * @param {Object} lastVersionResponse a response from /versions, which is polled while offline, + * and useful to store so we can later tell what capabilities + * our homeserver has. + */ async start(lastVersionResponse) { if (lastVersionResponse) { // store /versions response @@ -342,6 +351,7 @@ export class Session { return this._rooms; } + /** @internal */ createRoom(roomId, pendingEvents) { const room = new Room({ roomId, @@ -359,6 +369,7 @@ export class Session { return room; } + /** @internal */ async writeSync(syncResponse, syncFilterId, txn) { const changes = { syncInfo: null, @@ -403,6 +414,7 @@ export class Session { return changes; } + /** @internal */ afterSync({syncInfo, e2eeAccountChanges}) { if (syncInfo) { // sync transaction succeeded, modify object state now @@ -413,6 +425,7 @@ export class Session { } } + /** @internal */ async afterSyncCompleted(changes, isCatchupSync) { const promises = []; if (changes.deviceMessageDecryptionPending) { @@ -434,10 +447,12 @@ export class Session { } } + /** @internal */ get syncToken() { return this._syncInfo?.token; } + /** @internal */ get syncFilterId() { return this._syncInfo?.filterId; }