forked from mystiq/hydrogen-web
Migrate OutboundGroupSessionStore to TypeScript
This commit is contained in:
parent
5d4454734a
commit
33d94b9497
2 changed files with 16 additions and 7 deletions
|
@ -30,7 +30,7 @@ import {UserIdentityStore} from "./stores/UserIdentityStore.js";
|
||||||
import {DeviceIdentityStore} from "./stores/DeviceIdentityStore.js";
|
import {DeviceIdentityStore} from "./stores/DeviceIdentityStore.js";
|
||||||
import {OlmSessionStore} from "./stores/OlmSessionStore.js";
|
import {OlmSessionStore} from "./stores/OlmSessionStore.js";
|
||||||
import {InboundGroupSessionStore} from "./stores/InboundGroupSessionStore.js";
|
import {InboundGroupSessionStore} from "./stores/InboundGroupSessionStore.js";
|
||||||
import {OutboundGroupSessionStore} from "./stores/OutboundGroupSessionStore.js";
|
import {OutboundGroupSessionStore} from "./stores/OutboundGroupSessionStore";
|
||||||
import {GroupSessionDecryptionStore} from "./stores/GroupSessionDecryptionStore.js";
|
import {GroupSessionDecryptionStore} from "./stores/GroupSessionDecryptionStore.js";
|
||||||
import {OperationStore} from "./stores/OperationStore.js";
|
import {OperationStore} from "./stores/OperationStore.js";
|
||||||
import {AccountDataStore} from "./stores/AccountDataStore.js";
|
import {AccountDataStore} from "./stores/AccountDataStore.js";
|
||||||
|
|
|
@ -13,21 +13,30 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import {Store} from "../Store";
|
||||||
|
|
||||||
|
interface OutboundSession {
|
||||||
|
roomId: string;
|
||||||
|
session: string;
|
||||||
|
createdAt: number;
|
||||||
|
}
|
||||||
|
|
||||||
export class OutboundGroupSessionStore {
|
export class OutboundGroupSessionStore {
|
||||||
constructor(store) {
|
private _store: Store<OutboundSession>;
|
||||||
|
|
||||||
|
constructor(store: Store<OutboundSession>) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(roomId) {
|
remove(roomId: string): Promise<undefined> {
|
||||||
this._store.delete(roomId);
|
return this._store.delete(roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
get(roomId) {
|
get(roomId: string): Promise<OutboundSession | null> {
|
||||||
return this._store.get(roomId);
|
return this._store.get(roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set(session) {
|
set(session: OutboundSession): Promise<IDBValidKey> {
|
||||||
this._store.put(session);
|
return this._store.put(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue