mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
* Rename service-factory folder * Move cryptographic service factories * Move crypto models * Move crypto services * Move domain base class * Platform code owners * Move desktop log services * Move log files * Establish component library ownership * Move background listeners * Move background background * Move localization to Platform * Move browser alarms to Platform * Move browser state to Platform * Move CLI state to Platform * Move Desktop native concerns to Platform * Move flag and misc to Platform * Lint fixes * Move electron state to platform * Move web state to Platform * Move lib state to Platform * Fix broken tests * Rename interface to idiomatic TS * `npm run prettier` 🤖 * Resolve review feedback * Set platform as owners of web core and shared * Expand moved services * Fix test types --------- Co-authored-by: Hinton <hinton@users.noreply.github.com>
71 lines
2.4 KiB
TypeScript
71 lines
2.4 KiB
TypeScript
import { CsprngArray } from "../../types/csprng";
|
|
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<CsprngArray>;
|
|
}
|