1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 21:50:15 +00:00

Updated references to use decrypt with feature flag

This commit is contained in:
gbubemismith
2025-04-09 17:58:31 -04:00
parent 6f3cbd1c62
commit 9f29cefb78
29 changed files with 85 additions and 98 deletions

View File

@@ -50,8 +50,9 @@ export class CollectionsComponent implements OnInit {
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
this.cipherDomain = await this.loadCipher(activeUserId);
this.collectionIds = this.loadCipherCollections();
this.cipher = await this.cipherDomain.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain, activeUserId),
this.cipher = await this.cipherService.decryptCipherWithSdkOrLegacy(
this.cipherDomain,
activeUserId,
);
this.collections = await this.loadCollections();

View File

@@ -76,9 +76,7 @@ export class ShareComponent implements OnInit, OnDestroy {
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
const cipherDomain = await this.cipherService.get(this.cipherId, activeUserId);
this.cipher = await cipherDomain.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(cipherDomain, activeUserId),
);
this.cipher = await this.cipherService.decryptCipherWithSdkOrLegacy(cipherDomain, activeUserId);
}
filterCollections() {
@@ -105,8 +103,9 @@ export class ShareComponent implements OnInit, OnDestroy {
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
const cipherDomain = await this.cipherService.get(this.cipherId, activeUserId);
const cipherView = await cipherDomain.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(cipherDomain, activeUserId),
const cipherView = await this.cipherService.decryptCipherWithSdkOrLegacy(
cipherDomain,
activeUserId,
);
const orgs = await firstValueFrom(this.organizations$);
const orgName =

View File

@@ -509,6 +509,7 @@ const safeProviders: SafeProvider[] = [
stateProvider: StateProvider,
accountService: AccountServiceAbstraction,
sdkService: SdkService,
cipherEncryptionService: CipherEncryptionService,
) =>
new CipherService(
keyService,
@@ -525,6 +526,7 @@ const safeProviders: SafeProvider[] = [
stateProvider,
accountService,
sdkService,
cipherEncryptionService,
),
deps: [
KeyService,
@@ -541,6 +543,7 @@ const safeProviders: SafeProvider[] = [
StateProvider,
AccountServiceAbstraction,
SdkService,
CipherEncryptionService,
],
}),
safeProvider({

View File

@@ -269,9 +269,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
if (this.cipher == null) {
if (this.editMode) {
const cipher = await this.loadCipher(activeUserId);
this.cipher = await cipher.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(cipher, activeUserId),
);
this.cipher = await this.cipherService.decryptCipherWithSdkOrLegacy(cipher, activeUserId);
// Adjust Cipher Name if Cloning
if (this.cloneMode) {

View File

@@ -88,8 +88,9 @@ export class AttachmentsComponent implements OnInit {
const activeUserId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
this.formPromise = this.saveCipherAttachment(files[0], activeUserId);
this.cipherDomain = await this.formPromise;
this.cipher = await this.cipherDomain.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain, activeUserId),
this.cipher = await this.cipherService.decryptCipherWithSdkOrLegacy(
this.cipherDomain,
activeUserId,
);
this.toastService.showToast({
variant: "success",
@@ -130,9 +131,7 @@ export class AttachmentsComponent implements OnInit {
const updatedCipher = await this.deletePromises[attachment.id];
const cipher = new Cipher(updatedCipher);
this.cipher = await cipher.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(cipher, activeUserId),
);
this.cipher = await this.cipherService.decryptCipherWithSdkOrLegacy(cipher, activeUserId);
this.toastService.showToast({
variant: "success",
@@ -228,8 +227,9 @@ export class AttachmentsComponent implements OnInit {
protected async init() {
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
this.cipherDomain = await this.loadCipher(activeUserId);
this.cipher = await this.cipherDomain.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain, activeUserId),
this.cipher = await this.cipherService.decryptCipherWithSdkOrLegacy(
this.cipherDomain,
activeUserId,
);
const canAccessPremium = await firstValueFrom(
@@ -292,8 +292,9 @@ export class AttachmentsComponent implements OnInit {
activeUserId,
admin,
);
this.cipher = await this.cipherDomain.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(this.cipherDomain, activeUserId),
this.cipher = await this.cipherService.decryptCipherWithSdkOrLegacy(
this.cipherDomain,
activeUserId,
);
// 3. Delete old

View File

@@ -42,9 +42,7 @@ export class PasswordHistoryComponent implements OnInit {
protected async init() {
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
const cipher = await this.cipherService.get(this.cipherId, activeUserId);
const decCipher = await cipher.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(cipher, activeUserId),
);
const decCipher = await this.cipherService.decryptCipherWithSdkOrLegacy(cipher, activeUserId);
this.history = decCipher.passwordHistory == null ? [] : decCipher.passwordHistory;
}
}