mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-13 10:24:20 +01:00
e055e68991
* Implement argon2 * Remove argon2 webassembly warning * Replace magic numbers by enum * move packages * cleanup call to argon2 * update call to node argon2 * don't need wasm-eval * revert config changes * Update libs/common/src/enums/kdfType.ts Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com> * Update kdfType.ts * apply DEFAULT_PBKDF2_ITERATIONS * checkIfWasmSupported Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com>
70 lines
2.3 KiB
TypeScript
70 lines
2.3 KiB
TypeScript
import { DecryptParameters } from "../models/domain/decrypt-parameters";
|
|
import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key";
|
|
|
|
export abstract class CryptoFunctionService {
|
|
pbkdf2: (
|
|
password: string | ArrayBuffer,
|
|
salt: string | ArrayBuffer,
|
|
algorithm: "sha256" | "sha512",
|
|
iterations: number
|
|
) => Promise<ArrayBuffer>;
|
|
argon2: (
|
|
password: string | ArrayBuffer,
|
|
salt: string | ArrayBuffer,
|
|
iterations: number,
|
|
memory: number,
|
|
parallelism: number
|
|
) => Promise<ArrayBuffer>;
|
|
hkdf: (
|
|
ikm: ArrayBuffer,
|
|
salt: string | ArrayBuffer,
|
|
info: string | ArrayBuffer,
|
|
outputByteSize: number,
|
|
algorithm: "sha256" | "sha512"
|
|
) => Promise<ArrayBuffer>;
|
|
hkdfExpand: (
|
|
prk: ArrayBuffer,
|
|
info: string | ArrayBuffer,
|
|
outputByteSize: number,
|
|
algorithm: "sha256" | "sha512"
|
|
) => Promise<ArrayBuffer>;
|
|
hash: (
|
|
value: string | ArrayBuffer,
|
|
algorithm: "sha1" | "sha256" | "sha512" | "md5"
|
|
) => Promise<ArrayBuffer>;
|
|
hmac: (
|
|
value: ArrayBuffer,
|
|
key: ArrayBuffer,
|
|
algorithm: "sha1" | "sha256" | "sha512"
|
|
) => Promise<ArrayBuffer>;
|
|
compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise<boolean>;
|
|
hmacFast: (
|
|
value: ArrayBuffer | string,
|
|
key: ArrayBuffer | string,
|
|
algorithm: "sha1" | "sha256" | "sha512"
|
|
) => Promise<ArrayBuffer | string>;
|
|
compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise<boolean>;
|
|
aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
|
aesDecryptFastParameters: (
|
|
data: string,
|
|
iv: string,
|
|
mac: string,
|
|
key: SymmetricCryptoKey
|
|
) => DecryptParameters<ArrayBuffer | string>;
|
|
aesDecryptFast: (parameters: DecryptParameters<ArrayBuffer | string>) => Promise<string>;
|
|
aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
|
rsaEncrypt: (
|
|
data: ArrayBuffer,
|
|
publicKey: ArrayBuffer,
|
|
algorithm: "sha1" | "sha256"
|
|
) => Promise<ArrayBuffer>;
|
|
rsaDecrypt: (
|
|
data: ArrayBuffer,
|
|
privateKey: ArrayBuffer,
|
|
algorithm: "sha1" | "sha256"
|
|
) => Promise<ArrayBuffer>;
|
|
rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise<ArrayBuffer>;
|
|
rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>;
|
|
randomBytes: (length: number) => Promise<ArrayBuffer>;
|
|
}
|