From 0e18247184f0d041659cc46b07da197b17569bea Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 17 Nov 2021 14:36:15 +0530 Subject: [PATCH] Use constant type --- src/utils/crypto/hkdf.ts | 2 +- src/utils/crypto/pbkdf2.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/crypto/hkdf.ts b/src/utils/crypto/hkdf.ts index 25c1faf6..44f66029 100644 --- a/src/utils/crypto/hkdf.ts +++ b/src/utils/crypto/hkdf.ts @@ -9,7 +9,7 @@ import type {Crypto} from "../../platform/web/dom/Crypto.js"; // forked this code to make it use the cryptoDriver for HMAC that is more backwards-compatible -export async function hkdf(cryptoDriver: Crypto, key: Uint8Array, salt: Uint8Array, info: Uint8Array, hash: string, length: number): Promise { +export async function hkdf(cryptoDriver: Crypto, key: Uint8Array, salt: Uint8Array, info: Uint8Array, hash: "SHA-256" | "SHA-512", length: number): Promise { length = length / 8; const len = cryptoDriver.digestSize(hash); diff --git a/src/utils/crypto/pbkdf2.ts b/src/utils/crypto/pbkdf2.ts index 6a8b8495..a9108377 100644 --- a/src/utils/crypto/pbkdf2.ts +++ b/src/utils/crypto/pbkdf2.ts @@ -18,7 +18,7 @@ const nwbo = (num: number, len: number): Uint8Array => { return arr; }; -export async function pbkdf2(cryptoDriver: Crypto, password: Uint8Array, iterations: number, salt: Uint8Array, hash: string, length: number): Promise { +export async function pbkdf2(cryptoDriver: Crypto, password: Uint8Array, iterations: number, salt: Uint8Array, hash: "SHA-256" | "SHA-512", length: number): Promise { const dkLen = length / 8; if (iterations <= 0) { throw new Error('InvalidIterationCount');