mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Remove typeof
This commit is contained in:
parent
6dcebde69d
commit
9bffd31ee3
@ -22,7 +22,9 @@ import type {Storage} from "../storage/idb/Storage";
|
|||||||
import type {Transaction} from "../storage/idb/Transaction";
|
import type {Transaction} from "../storage/idb/Transaction";
|
||||||
import type {KeyDescriptionData} from "./common";
|
import type {KeyDescriptionData} from "./common";
|
||||||
import type {Platform} from "../../platform/web/Platform.js";
|
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`;
|
const SSSS_KEY = `${SESSION_E2EE_KEY_PREFIX}ssssKey`;
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ export async function removeKey(txn: Transaction): Promise<void> {
|
|||||||
txn.session.remove(SSSS_KEY);
|
txn.session.remove(SSSS_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function keyFromCredential(type: KeyType, credential: string, storage: Storage, platform: Platform, olm: typeof Olm): Promise<Key> {
|
export async function keyFromCredential(type: KeyType, credential: string, storage: Storage, platform: Platform, olm: Olm): Promise<Key> {
|
||||||
const keyDescription = await readDefaultKeyDescription(storage);
|
const keyDescription = await readDefaultKeyDescription(storage);
|
||||||
if (!keyDescription) {
|
if (!keyDescription) {
|
||||||
throw new Error("Could not find a default secret storage key in account data");
|
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);
|
return await keyFromCredentialAndDescription(type, credential, keyDescription, platform, olm);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function keyFromCredentialAndDescription(type: KeyType, credential: string, keyDescription: KeyDescription, platform: Platform, olm: typeof Olm): Promise<Key> {
|
export async function keyFromCredentialAndDescription(type: KeyType, credential: string, keyDescription: KeyDescription, platform: Platform, olm: Olm): Promise<Key> {
|
||||||
let key: Key;
|
let key: Key;
|
||||||
if (type === KeyType.Passphrase) {
|
if (type === KeyType.Passphrase) {
|
||||||
key = await keyFromPassphrase(keyDescription, credential, platform);
|
key = await keyFromPassphrase(keyDescription, credential, platform);
|
||||||
|
@ -27,7 +27,7 @@ const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01] as const;
|
|||||||
* @param {string} recoveryKey
|
* @param {string} recoveryKey
|
||||||
* @return {Key}
|
* @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, ''));
|
const result = platform.encoding.base58.decode(recoveryKey.replace(/ /g, ''));
|
||||||
|
|
||||||
let parity = 0;
|
let parity = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user