Convert passphrase.js to ts

This commit is contained in:
RMidhunSuresh 2021-11-29 15:18:04 +05:30
parent dd4704b818
commit e45f66a199
3 changed files with 5 additions and 2 deletions

View file

@ -22,6 +22,7 @@ export interface IKeyDescription {
algorithm: string;
iterations: number;
salt: string;
bits?: number;
};
mac: string;
iv: string;

View file

@ -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";

View file

@ -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");