split out Entry type for OlmSessionStore

This commit is contained in:
Bruno Windels 2021-09-06 12:46:44 +02:00
parent f34ee53a12
commit cd98cac4e4

View file

@ -29,13 +29,14 @@ interface OlmSession {
sessionId: string;
senderKey: string;
lastUsed: number;
key: string;
}
export class OlmSessionStore {
private _store: Store<OlmSession>;
type OlmSessionEntry = OlmSession & { key: string };
constructor(store: Store<OlmSession>) {
export class OlmSessionStore {
private _store: Store<OlmSessionEntry>;
constructor(store: Store<OlmSessionEntry>) {
this._store = store;
}
@ -66,8 +67,8 @@ export class OlmSessionStore {
}
set(session: OlmSession): void {
session.key = encodeKey(session.senderKey, session.sessionId);
this._store.put(session);
(session as OlmSessionEntry).key = encodeKey(session.senderKey, session.sessionId);
this._store.put(session as OlmSessionEntry);
}
remove(senderKey: string, sessionId: string): Promise<undefined> {