mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
add @internal and other comments to Session
This commit is contained in:
parent
62c8d6574c
commit
f214c53fa9
@ -98,6 +98,8 @@ export class Session {
|
|||||||
// called once this._e2eeAccount is assigned
|
// called once this._e2eeAccount is assigned
|
||||||
_setupEncryption() {
|
_setupEncryption() {
|
||||||
console.log("loaded e2ee account with keys", this._e2eeAccount.identityKeys);
|
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 senderKeyLock = new LockMap();
|
||||||
const olmDecryption = new OlmDecryption({
|
const olmDecryption = new OlmDecryption({
|
||||||
account: this._e2eeAccount,
|
account: this._e2eeAccount,
|
||||||
@ -241,6 +243,7 @@ export class Session {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
async load() {
|
async load() {
|
||||||
const txn = this._storage.readTxn([
|
const txn = this._storage.readTxn([
|
||||||
this._storage.storeNames.session,
|
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) {
|
async start(lastVersionResponse) {
|
||||||
if (lastVersionResponse) {
|
if (lastVersionResponse) {
|
||||||
// store /versions response
|
// store /versions response
|
||||||
@ -342,6 +351,7 @@ export class Session {
|
|||||||
return this._rooms;
|
return this._rooms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
createRoom(roomId, pendingEvents) {
|
createRoom(roomId, pendingEvents) {
|
||||||
const room = new Room({
|
const room = new Room({
|
||||||
roomId,
|
roomId,
|
||||||
@ -359,6 +369,7 @@ export class Session {
|
|||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
async writeSync(syncResponse, syncFilterId, txn) {
|
async writeSync(syncResponse, syncFilterId, txn) {
|
||||||
const changes = {
|
const changes = {
|
||||||
syncInfo: null,
|
syncInfo: null,
|
||||||
@ -403,6 +414,7 @@ export class Session {
|
|||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
afterSync({syncInfo, e2eeAccountChanges}) {
|
afterSync({syncInfo, e2eeAccountChanges}) {
|
||||||
if (syncInfo) {
|
if (syncInfo) {
|
||||||
// sync transaction succeeded, modify object state now
|
// sync transaction succeeded, modify object state now
|
||||||
@ -413,6 +425,7 @@ export class Session {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
async afterSyncCompleted(changes, isCatchupSync) {
|
async afterSyncCompleted(changes, isCatchupSync) {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
if (changes.deviceMessageDecryptionPending) {
|
if (changes.deviceMessageDecryptionPending) {
|
||||||
@ -434,10 +447,12 @@ export class Session {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
get syncToken() {
|
get syncToken() {
|
||||||
return this._syncInfo?.token;
|
return this._syncInfo?.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
get syncFilterId() {
|
get syncFilterId() {
|
||||||
return this._syncInfo?.filterId;
|
return this._syncInfo?.filterId;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user