mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
Use olm type from dependency
This commit is contained in:
parent
7362e38413
commit
e06a0e9e5a
@ -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<void> {
|
||||
txn.session.remove(SSSS_KEY);
|
||||
}
|
||||
|
||||
export async function keyFromCredential(type: KeyType, credential: string, storage: Storage, platform: Platform, olm: Olm): Promise<Key> {
|
||||
export async function keyFromCredential(type: KeyType, credential: string, storage: Storage, platform: Platform, olm: typeof Olm): Promise<Key> {
|
||||
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<Key> {
|
||||
export async function keyFromCredentialAndDescription(type: KeyType, credential: string, keyDescription: KeyDescription, platform: Platform, olm: typeof Olm): Promise<Key> {
|
||||
let key: Key;
|
||||
if (type === KeyType.Passphrase) {
|
||||
key = await keyFromPassphrase(keyDescription, credential, platform);
|
||||
|
@ -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;
|
||||
|
@ -2,7 +2,8 @@
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": true,
|
||||
"noEmit": true,
|
||||
"target": "ES2020"
|
||||
"target": "ES2020",
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"exclude": [
|
||||
"src/sdk/paths/*"
|
||||
|
Loading…
Reference in New Issue
Block a user