1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[PM-24745] Decrypt ciphers using decryptManyWithFailures from SDK (#16190)

* Add SDK call to decryptManyWithFailures instead of decryptMany

* Move logic back to decryptCiphersWithSdk

* Fix return type of decryptCiphersWithSdk

* Add unit tests for decryptCiphers()

* Add unit tests for decryptManyWithFailures

* Filter out undefined objects from failedCiphers

* Update name for failed-decryption ciphers

* Fix type checking errors in tests

* Fix tests with new changes from main

* Migrate decryptMany call to use decryptManyWithFailures

* Remove deprecated decryptMany function, along with all calls ot the function
This commit is contained in:
Nik Gilmore
2025-09-19 13:51:20 -07:00
committed by GitHub
parent fb7b29d6b3
commit 8af3e025e3
5 changed files with 155 additions and 44 deletions

View File

@@ -69,14 +69,19 @@ export abstract class CipherEncryptionService {
*/
abstract decryptManyLegacy(ciphers: Cipher[], userId: UserId): Promise<CipherView[]>;
/**
* Decrypts many ciphers using the SDK for the given userId.
* Decrypts many ciphers using the SDK for the given userId, and returns a list of
* failures.
*
* @param ciphers The encrypted cipher objects
* @param userId The user ID whose key will be used for decryption
*
* @returns A promise that resolves to an array of decrypted cipher list views
* @returns A promise that resolves to a tuple containing an array of decrypted
* cipher list views, and an array of ciphers that failed to decrypt.
*/
abstract decryptMany(ciphers: Cipher[], userId: UserId): Promise<CipherListView[]>;
abstract decryptManyWithFailures(
ciphers: Cipher[],
userId: UserId,
): Promise<[CipherListView[], Cipher[]]>;
/**
* Decrypts an attachment's content from a response object.
*