mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Convert recoveryKey.js to ts
This commit is contained in:
parent
e45f66a199
commit
814c0bed2e
@ -16,17 +16,13 @@ limitations under the License.
|
||||
|
||||
import {KeyDescription, Key} from "./common";
|
||||
import {keyFromPassphrase} from "./passphrase";
|
||||
import {keyFromRecoveryKey} from "./recoveryKey.js";
|
||||
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 {Platform} from "../../platform/web/Platform.js";
|
||||
|
||||
type Olm = {
|
||||
PRIVATE_KEY_LENGTH: number;
|
||||
[key: string]: any
|
||||
};
|
||||
import type { Olm } from "./recoveryKey";
|
||||
|
||||
const SSSS_KEY = `${SESSION_E2EE_KEY_PREFIX}ssssKey`;
|
||||
|
||||
|
@ -14,8 +14,15 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import {Key} from "./common";
|
||||
import {KeyDescription} from "./common";
|
||||
import type {Platform} from "../../platform/web/Platform.js";
|
||||
|
||||
const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01];
|
||||
export type Olm = {
|
||||
PRIVATE_KEY_LENGTH: number;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01] as const;
|
||||
|
||||
/**
|
||||
* @param {Olm} olm
|
||||
@ -23,7 +30,7 @@ const OLM_RECOVERY_KEY_PREFIX = [0x8B, 0x01];
|
||||
* @param {string} recoveryKey
|
||||
* @return {Key}
|
||||
*/
|
||||
export function keyFromRecoveryKey(keyDescription, recoveryKey, olm, platform) {
|
||||
export function keyFromRecoveryKey(keyDescription: KeyDescription, recoveryKey: string, olm: Olm, platform: Platform): Key {
|
||||
const result = platform.encoding.base58.decode(recoveryKey.replace(/ /g, ''));
|
||||
|
||||
let parity = 0;
|
Loading…
Reference in New Issue
Block a user