forked from mystiq/hydrogen-web
Convert passphrase.js to ts
This commit is contained in:
parent
dd4704b818
commit
e45f66a199
3 changed files with 5 additions and 2 deletions
|
@ -22,6 +22,7 @@ export interface IKeyDescription {
|
|||
algorithm: string;
|
||||
iterations: number;
|
||||
salt: string;
|
||||
bits?: number;
|
||||
};
|
||||
mac: string;
|
||||
iv: string;
|
||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import {KeyDescription, Key} from "./common";
|
||||
import {keyFromPassphrase} from "./passphrase.js";
|
||||
import {keyFromPassphrase} from "./passphrase";
|
||||
import {keyFromRecoveryKey} from "./recoveryKey.js";
|
||||
import {SESSION_E2EE_KEY_PREFIX} from "../e2ee/common.js";
|
||||
import type {Storage} from "../storage/idb/Storage";
|
||||
|
|
|
@ -15,6 +15,8 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import {Key} from "./common";
|
||||
import type {KeyDescription} from "./common";
|
||||
import type {Platform} from "../../platform/web/Platform.js";
|
||||
|
||||
const DEFAULT_ITERATIONS = 500000;
|
||||
const DEFAULT_BITSIZE = 256;
|
||||
|
@ -25,7 +27,7 @@ const DEFAULT_BITSIZE = 256;
|
|||
* @param {Platform} platform
|
||||
* @return {Key}
|
||||
*/
|
||||
export async function keyFromPassphrase(keyDescription, passphrase, platform) {
|
||||
export async function keyFromPassphrase(keyDescription: KeyDescription, passphrase: string, platform: Platform): Promise<Key> {
|
||||
const {passphraseParams} = keyDescription;
|
||||
if (!passphraseParams) {
|
||||
throw new Error("not a passphrase key");
|
Loading…
Reference in a new issue