From 7362e38413359bbd2398dadceeeacb906c65a409 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 2 Dec 2021 12:01:03 +0530 Subject: [PATCH] Convert interface to type --- src/matrix/ssss/common.ts | 8 ++++---- src/matrix/ssss/index.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/matrix/ssss/common.ts b/src/matrix/ssss/common.ts index b7c06192..2bb5e8b5 100644 --- a/src/matrix/ssss/common.ts +++ b/src/matrix/ssss/common.ts @@ -16,7 +16,7 @@ limitations under the License. import type {Platform} from "../../platform/web/Platform.js"; -export interface IKeyDescription { +export type KeyDescriptionData = { algorithm: string; passphrase: { algorithm: string; @@ -30,9 +30,9 @@ export interface IKeyDescription { export class KeyDescription { private readonly _id: string; - private readonly _keyDescription: IKeyDescription; + private readonly _keyDescription: KeyDescriptionData; - constructor(id: string, keyDescription: IKeyDescription) { + constructor(id: string, keyDescription: KeyDescriptionData) { this._id = id; this._keyDescription = keyDescription; } @@ -41,7 +41,7 @@ export class KeyDescription { return this._id; } - get passphraseParams(): IKeyDescription["passphrase"] { + get passphraseParams(): KeyDescriptionData["passphrase"] { return this._keyDescription?.passphrase; } diff --git a/src/matrix/ssss/index.ts b/src/matrix/ssss/index.ts index c82729f2..8c2d126b 100644 --- a/src/matrix/ssss/index.ts +++ b/src/matrix/ssss/index.ts @@ -20,7 +20,7 @@ import {keyFromRecoveryKey} from "./recoveryKey"; import {SESSION_E2EE_KEY_PREFIX} from "../e2ee/common.js"; import type {Storage} from "../storage/idb/Storage"; import type {Transaction} from "../storage/idb/Transaction"; -import type {IKeyDescription} from "./common"; +import type {KeyDescriptionData} from "./common"; import type {Platform} from "../../platform/web/Platform.js"; import type {Olm} from "./recoveryKey"; @@ -44,7 +44,7 @@ async function readDefaultKeyDescription(storage: Storage): Promise { @@ -58,7 +58,7 @@ export async function readKey(txn: Transaction): Promise { } const keyAccountData = await txn.accountData.get(`m.secret_storage.key.${keyData.id}`); if (keyAccountData) { - return new Key(new KeyDescription(keyData.id, keyAccountData.content as IKeyDescription), keyData.binaryKey); + return new Key(new KeyDescription(keyData.id, keyAccountData.content as KeyDescriptionData), keyData.binaryKey); } }