From 9bffd31ee3f3464f9737a33cf24451d5d66f166b Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 3 Dec 2021 11:30:57 +0530 Subject: [PATCH] Remove typeof --- src/matrix/ssss/index.ts | 8 +++++--- src/matrix/ssss/recoveryKey.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/matrix/ssss/index.ts b/src/matrix/ssss/index.ts index 6443d70a..37f47963 100644 --- a/src/matrix/ssss/index.ts +++ b/src/matrix/ssss/index.ts @@ -22,7 +22,9 @@ import type {Storage} from "../storage/idb/Storage"; import type {Transaction} from "../storage/idb/Transaction"; import type {KeyDescriptionData} from "./common"; import type {Platform} from "../../platform/web/Platform.js"; -import type * as Olm from "@matrix-org/olm" +import type * as OlmNamespace from "@matrix-org/olm" + +type Olm = typeof OlmNamespace; const SSSS_KEY = `${SESSION_E2EE_KEY_PREFIX}ssssKey`; @@ -67,7 +69,7 @@ export async function removeKey(txn: Transaction): Promise { txn.session.remove(SSSS_KEY); } -export async function keyFromCredential(type: KeyType, credential: string, storage: Storage, platform: Platform, olm: typeof Olm): Promise { +export async function keyFromCredential(type: KeyType, credential: string, storage: Storage, platform: Platform, olm: Olm): Promise { const keyDescription = await readDefaultKeyDescription(storage); if (!keyDescription) { throw new Error("Could not find a default secret storage key in account data"); @@ -75,7 +77,7 @@ export async function keyFromCredential(type: KeyType, credential: string, stora return await keyFromCredentialAndDescription(type, credential, keyDescription, platform, olm); } -export async function keyFromCredentialAndDescription(type: KeyType, credential: string, keyDescription: KeyDescription, platform: Platform, olm: typeof Olm): Promise { +export async function keyFromCredentialAndDescription(type: KeyType, credential: string, keyDescription: KeyDescription, platform: Platform, olm: Olm): Promise { let key: Key; if (type === KeyType.Passphrase) { key = await keyFromPassphrase(keyDescription, credential, platform); diff --git a/src/matrix/ssss/recoveryKey.ts b/src/matrix/ssss/recoveryKey.ts index 739f19a9..c619ed37 100644 --- a/src/matrix/ssss/recoveryKey.ts +++ b/src/matrix/ssss/recoveryKey.ts @@ -27,7 +27,7 @@ const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01] as const; * @param {string} recoveryKey * @return {Key} */ -export function keyFromRecoveryKey(keyDescription: KeyDescription, recoveryKey: string, olm: typeof Olm, platform: Platform): Key { +export function keyFromRecoveryKey(keyDescription: KeyDescription, recoveryKey: string, olm: Olm, platform: Platform): Key { const result = platform.encoding.base58.decode(recoveryKey.replace(/ /g, '')); let parity = 0;