forked from mystiq/hydrogen-web
add @internal and other comments to Session
This commit is contained in:
parent
62c8d6574c
commit
f214c53fa9
1 changed files with 15 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue