Use constant type

This commit is contained in:
RMidhunSuresh 2021-11-17 14:36:15 +05:30
parent a945edfe07
commit 0e18247184
2 changed files with 2 additions and 2 deletions

View File

@ -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<Uint8Array> {
export async function hkdf(cryptoDriver: Crypto, key: Uint8Array, salt: Uint8Array, info: Uint8Array, hash: "SHA-256" | "SHA-512", length: number): Promise<Uint8Array> {
length = length / 8;
const len = cryptoDriver.digestSize(hash);

View File

@ -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<Uint8Array> {
export async function pbkdf2(cryptoDriver: Crypto, password: Uint8Array, iterations: number, salt: Uint8Array, hash: "SHA-256" | "SHA-512", length: number): Promise<Uint8Array> {
const dkLen = length / 8;
if (iterations <= 0) {
throw new Error('InvalidIterationCount');