diff --git a/src/matrix/ssss/index.ts b/src/matrix/ssss/index.ts index 8c2d126b..6443d70a 100644 --- a/src/matrix/ssss/index.ts +++ b/src/matrix/ssss/index.ts @@ -22,7 +22,7 @@ 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 {Olm} from "./recoveryKey"; +import type * as Olm from "@matrix-org/olm" const SSSS_KEY = `${SESSION_E2EE_KEY_PREFIX}ssssKey`; @@ -67,7 +67,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: Olm): Promise { +export async function keyFromCredential(type: KeyType, credential: string, storage: Storage, platform: Platform, olm: typeof 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 +75,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: Olm): Promise { +export async function keyFromCredentialAndDescription(type: KeyType, credential: string, keyDescription: KeyDescription, platform: Platform, olm: typeof 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 1271a814..e194ae52 100644 --- a/src/matrix/ssss/recoveryKey.ts +++ b/src/matrix/ssss/recoveryKey.ts @@ -16,11 +16,7 @@ limitations under the License. import {Key} from "./common"; import {KeyDescription} from "./common"; import type {Platform} from "../../platform/web/Platform.js"; - -export type Olm = { - PRIVATE_KEY_LENGTH: number; - [key: string]: any; -}; +import type * as Olm from "@matrix-org/olm" const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01] as const; @@ -30,7 +26,7 @@ const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01] as const; * @param {string} recoveryKey * @return {Key} */ -export function keyFromRecoveryKey(keyDescription: KeyDescription, recoveryKey: string, olm: Olm, platform: Platform): Key { +export function keyFromRecoveryKey(keyDescription: KeyDescription, recoveryKey: string, olm: typeof Olm, platform: Platform): Key { const result = platform.encoding.base58.decode(recoveryKey.replace(/ /g, '')); let parity = 0; diff --git a/tsconfig.json b/tsconfig.json index e09e7cc5..e3fae938 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "strictNullChecks": true, "noEmit": true, - "target": "ES2020" + "target": "ES2020", + "moduleResolution": "node" }, "exclude": [ "src/sdk/paths/*"