1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +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

@@ -5,7 +5,6 @@ import { BehaviorSubject } from "rxjs";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -15,6 +14,7 @@ import { CipherType } from "@bitwarden/common/vault/enums";
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { ToastService } from "@bitwarden/components";
import { KeyService } from "@bitwarden/key-management";
import { PasswordRepromptService } from "../../services/password-reprompt.service";
@@ -60,7 +60,7 @@ describe("DownloadAttachmentComponent", () => {
imports: [DownloadAttachmentComponent],
providers: [
{ provide: EncryptService, useValue: mock<EncryptService>() },
{ provide: CryptoService, useValue: mock<CryptoService>() },
{ provide: KeyService, useValue: mock<KeyService>() },
{ provide: I18nService, useValue: { t: (key: string) => key } },
{ provide: StateProvider, useValue: { activeUserId$ } },
{ provide: ToastService, useValue: { showToast } },

View File

@@ -6,7 +6,6 @@ import { NEVER, switchMap } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@@ -17,6 +16,7 @@ import { OrgKey } from "@bitwarden/common/types/key";
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { AsyncActionsModule, IconButtonModule, ToastService } from "@bitwarden/components";
import { KeyService } from "@bitwarden/key-management";
@Component({
standalone: true,
@@ -44,11 +44,11 @@ export class DownloadAttachmentComponent {
private toastService: ToastService,
private encryptService: EncryptService,
private stateProvider: StateProvider,
private cryptoService: CryptoService,
private keyService: KeyService,
) {
this.stateProvider.activeUserId$
.pipe(
switchMap((userId) => (userId !== null ? this.cryptoService.orgKeys$(userId) : NEVER)),
switchMap((userId) => (userId !== null ? this.keyService.orgKeys$(userId) : NEVER)),
takeUntilDestroyed(),
)
.subscribe((data: Record<OrganizationId, OrgKey> | null) => {

View File

@@ -3,7 +3,6 @@ import { Component } from "@angular/core";
import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import {
@@ -13,6 +12,7 @@ import {
FormFieldModule,
IconButtonModule,
} from "@bitwarden/components";
import { KeyService } from "@bitwarden/key-management";
/**
* Used to verify the user's Master Password for the "Master Password Re-prompt" feature only.
@@ -38,7 +38,7 @@ export class PasswordRepromptComponent {
});
constructor(
protected cryptoService: CryptoService,
protected keyService: KeyService,
protected platformUtilsService: PlatformUtilsService,
protected i18nService: I18nService,
protected formBuilder: FormBuilder,
@@ -46,11 +46,11 @@ export class PasswordRepromptComponent {
) {}
submit = async () => {
const storedMasterKey = await this.cryptoService.getOrDeriveMasterKey(
const storedMasterKey = await this.keyService.getOrDeriveMasterKey(
this.formGroup.value.masterPassword,
);
if (
!(await this.cryptoService.compareAndUpdateKeyHash(
!(await this.keyService.compareAndUpdateKeyHash(
this.formGroup.value.masterPassword,
storedMasterKey,
))