mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
[EC-272] Web workers using EncryptionService (#3532)
* Add item decryption to encryptService * Create multithreadEncryptService subclass to handle web workers * Create encryption web worker * Refactor cipherService to use new interface * Update dependencies
This commit is contained in:
12
libs/common/src/interfaces/decryptable.interface.ts
Normal file
12
libs/common/src/interfaces/decryptable.interface.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key";
|
||||
|
||||
import { InitializerMetadata } from "./initializer-metadata.interface";
|
||||
|
||||
/**
|
||||
* An object that contains EncStrings and knows how to decrypt them. This is usually a domain object with the
|
||||
* corresponding view object as the type argument.
|
||||
* @example Cipher implements Decryptable<CipherView>
|
||||
*/
|
||||
export interface Decryptable<TDecrypted extends InitializerMetadata> extends InitializerMetadata {
|
||||
decrypt: (key?: SymmetricCryptoKey) => Promise<TDecrypted>;
|
||||
}
|
||||
11
libs/common/src/interfaces/initializer-metadata.interface.ts
Normal file
11
libs/common/src/interfaces/initializer-metadata.interface.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { InitializerKey } from "../services/cryptography/initializer-key";
|
||||
|
||||
/**
|
||||
* This interface enables deserialization of arbitrary objects by recording their class name as an enum, which
|
||||
* will survive serialization. The enum can then be matched to a constructor or factory method for deserialization.
|
||||
* See get-class-initializer.ts for the initializer map.
|
||||
*/
|
||||
export interface InitializerMetadata {
|
||||
initializerKey: InitializerKey;
|
||||
toJSON?: () => { initializerKey: InitializerKey };
|
||||
}
|
||||
Reference in New Issue
Block a user