mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-02 13:23:29 +01:00
da47992a22
* Add item decryption to encryptService * Create multithreadEncryptService subclass to handle web workers * Create encryption web worker * Refactor cipherService to use new interface * Update dependencies
22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
import { IEncrypted } from "../interfaces/IEncrypted";
|
|
import { Decryptable } from "../interfaces/decryptable.interface";
|
|
import { InitializerMetadata } from "../interfaces/initializer-metadata.interface";
|
|
import { EncArrayBuffer } from "../models/domain/enc-array-buffer";
|
|
import { EncString } from "../models/domain/enc-string";
|
|
import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key";
|
|
|
|
export abstract class EncryptService {
|
|
abstract encrypt(plainValue: string | ArrayBuffer, key: SymmetricCryptoKey): Promise<EncString>;
|
|
abstract encryptToBytes: (
|
|
plainValue: ArrayBuffer,
|
|
key?: SymmetricCryptoKey
|
|
) => Promise<EncArrayBuffer>;
|
|
abstract decryptToUtf8: (encString: EncString, key: SymmetricCryptoKey) => Promise<string>;
|
|
abstract decryptToBytes: (encThing: IEncrypted, key: SymmetricCryptoKey) => Promise<ArrayBuffer>;
|
|
abstract resolveLegacyKey: (key: SymmetricCryptoKey, encThing: IEncrypted) => SymmetricCryptoKey;
|
|
abstract decryptItems: <T extends InitializerMetadata>(
|
|
items: Decryptable<T>[],
|
|
key: SymmetricCryptoKey
|
|
) => Promise<T[]>;
|
|
}
|