1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 19:23:52 +00:00

[Pm-13097] Rename cryptoservice to keyservice and move it to km ownership (#11358)

* Rename cryptoservice to keyservice

* Rename cryptoservice to keyservice

* Move key service to key management ownership

* Remove accidentally added file

* Fix cli build

* Fix browser build

* Run prettier

* Fix builds

* Fix cli build

* Fix tests

* Fix incorrect renames

* Rename webauthn-login-crypto-service

* Fix build errors due to merge conflicts

* Fix linting
This commit is contained in:
Bernd Schoolmann
2024-10-24 19:41:30 +02:00
committed by GitHub
parent 554171b688
commit b486fcc689
229 changed files with 1385 additions and 1446 deletions

View File

@@ -8,7 +8,6 @@ import {
CollectionWithIdExport,
FolderWithIdExport,
} from "@bitwarden/common/models/export";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
@@ -16,6 +15,7 @@ import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/sym
import { OrganizationId } from "@bitwarden/common/types/guid";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
import { KeyService } from "@bitwarden/key-management";
import {
BitwardenEncryptedIndividualJsonExport,
BitwardenEncryptedOrgJsonExport,
@@ -32,7 +32,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
private result: ImportResult;
protected constructor(
protected cryptoService: CryptoService,
protected keyService: KeyService,
protected encryptService: EncryptService,
protected i18nService: I18nService,
protected cipherService: CipherService,
@@ -63,11 +63,11 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
results: BitwardenEncryptedIndividualJsonExport | BitwardenEncryptedOrgJsonExport,
) {
if (results.encKeyValidation_DO_NOT_EDIT != null) {
let keyForDecryption: SymmetricCryptoKey = await this.cryptoService.getOrgKey(
let keyForDecryption: SymmetricCryptoKey = await this.keyService.getOrgKey(
this.organizationId,
);
if (keyForDecryption == null) {
keyForDecryption = await this.cryptoService.getUserKeyWithLegacySupport();
keyForDecryption = await this.keyService.getUserKeyWithLegacySupport();
}
const encKeyValidation = new EncString(results.encKeyValidation_DO_NOT_EDIT);
const encKeyValidationDecrypt = await this.encryptService.decryptToUtf8(
@@ -210,8 +210,8 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
if (data.encrypted) {
const collection = CollectionWithIdExport.toDomain(c);
collection.organizationId = this.organizationId;
collectionView = await firstValueFrom(this.cryptoService.activeUserOrgKeys$).then(
(orgKeys) => collection.decrypt(orgKeys[c.organizationId as OrganizationId]),
collectionView = await firstValueFrom(this.keyService.activeUserOrgKeys$).then((orgKeys) =>
collection.decrypt(orgKeys[c.organizationId as OrganizationId]),
);
} else {
collectionView = CollectionWithIdExport.toView(c);

View File

@@ -5,13 +5,13 @@ import {
KdfConfig,
PBKDF2KdfConfig,
} from "@bitwarden/common/auth/models/domain/kdf-config";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { KdfType } from "@bitwarden/common/platform/enums";
import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { KeyService } from "@bitwarden/key-management";
import { BitwardenPasswordProtectedFileFormat } from "@bitwarden/vault-export-core";
import { ImportResult } from "../../models/import-result";
@@ -23,7 +23,7 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im
private key: SymmetricCryptoKey;
constructor(
cryptoService: CryptoService,
keyService: KeyService,
encryptService: EncryptService,
i18nService: I18nService,
cipherService: CipherService,
@@ -31,7 +31,7 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im
accountService: AccountService,
private promptForPassword_callback: () => Promise<string>,
) {
super(cryptoService, encryptService, i18nService, cipherService, pinService, accountService);
super(keyService, encryptService, i18nService, cipherService, pinService, accountService);
}
async parse(data: string): Promise<ImportResult> {