You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
add jsdoc and implementation for memory crypto store
This commit is contained in:
@@ -582,14 +582,25 @@ export class IndexedDBCryptoStore {
|
|||||||
return this._backend.markSessionsNeedingBackup(sessions, txn);
|
return this._backend.markSessionsNeedingBackup(sessions, txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: jsdoc
|
/**
|
||||||
|
* Add a shared-history group session for a room.
|
||||||
|
* @param {string} roomId The room that the key belongs to
|
||||||
|
* @param {string} senderKey The sender's curve 25519 key
|
||||||
|
* @param {string} sessionId The ID of the session
|
||||||
|
* @param {*} txn An active transaction. See doTxn(). (optional)
|
||||||
*/
|
*/
|
||||||
addSharedHistoryInboundGroupSession(roomId, senderKey, sessionId, txn) {
|
addSharedHistoryInboundGroupSession(roomId, senderKey, sessionId, txn) {
|
||||||
return this._backend.addSharedHistoryInboundGroupSession(
|
this._backend.addSharedHistoryInboundGroupSession(
|
||||||
roomId, senderKey, sessionId, txn,
|
roomId, senderKey, sessionId, txn,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the shared-history group session for a room.
|
||||||
|
* @param {string} roomId The room that the key belongs to
|
||||||
|
* @param {*} txn An active transaction. See doTxn(). (optional)
|
||||||
|
* @returns {Promise} Resolves to an array of [senderKey, sessionId]
|
||||||
|
*/
|
||||||
getSharedHistoryInboundGroupSessions(roomId, txn) {
|
getSharedHistoryInboundGroupSessions(roomId, txn) {
|
||||||
return this._backend.getSharedHistoryInboundGroupSessions(roomId, txn);
|
return this._backend.getSharedHistoryInboundGroupSessions(roomId, txn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ export class MemoryCryptoStore {
|
|||||||
this._rooms = {};
|
this._rooms = {};
|
||||||
// Set of {senderCurve25519Key+'/'+sessionId}
|
// Set of {senderCurve25519Key+'/'+sessionId}
|
||||||
this._sessionsNeedingBackup = {};
|
this._sessionsNeedingBackup = {};
|
||||||
|
// roomId -> array of [senderKey, sessionId]
|
||||||
|
this._sharedHistoryInboundGroupSessions = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -467,6 +469,16 @@ export class MemoryCryptoStore {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addSharedHistoryInboundGroupSession(roomId, senderKey, sessionId) {
|
||||||
|
const sessions = this._sharedHistoryInboundGroupSessions[roomId] || [];
|
||||||
|
sessions.push([senderKey, sessionId]);
|
||||||
|
this._sharedHistoryInboundGroupSessions[roomId] = sessions;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSharedHistoryInboundGroupSessions(roomId) {
|
||||||
|
return Promise.resolve(this._sharedHistoryInboundGroupSessions[roomId] || []);
|
||||||
|
}
|
||||||
|
|
||||||
// Session key backups
|
// Session key backups
|
||||||
|
|
||||||
doTxn(mode, stores, func) {
|
doTxn(mode, stores, func) {
|
||||||
|
|||||||
Reference in New Issue
Block a user