mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +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:
@@ -20,7 +20,6 @@ import { LoginUriExport } from "@bitwarden/common/models/export/login-uri.export
|
||||
import { LoginExport } from "@bitwarden/common/models/export/login.export";
|
||||
import { SecureNoteExport } from "@bitwarden/common/models/export/secure-note.export";
|
||||
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 { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
@@ -33,6 +32,7 @@ import { TotpService } from "@bitwarden/common/vault/abstractions/totp.service";
|
||||
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
|
||||
import { KeyService } from "@bitwarden/key-management";
|
||||
|
||||
import { OrganizationCollectionRequest } from "../admin-console/models/request/organization-collection.request";
|
||||
import { OrganizationCollectionResponse } from "../admin-console/models/response/organization-collection.response";
|
||||
@@ -56,7 +56,7 @@ export class GetCommand extends DownloadCommand {
|
||||
private collectionService: CollectionService,
|
||||
private totpService: TotpService,
|
||||
private auditService: AuditService,
|
||||
private cryptoService: CryptoService,
|
||||
private keyService: KeyService,
|
||||
encryptService: EncryptService,
|
||||
private stateService: StateService,
|
||||
private searchService: SearchService,
|
||||
@@ -377,7 +377,7 @@ export class GetCommand extends DownloadCommand {
|
||||
const key =
|
||||
attachments[0].key != null
|
||||
? attachments[0].key
|
||||
: await this.cryptoService.getOrgKey(cipher.organizationId);
|
||||
: await this.keyService.getOrgKey(cipher.organizationId);
|
||||
return await this.saveAttachmentToFile(url, key, attachments[0].fileName, options.output);
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ export class GetCommand extends DownloadCommand {
|
||||
if (Utils.isGuid(id)) {
|
||||
const collection = await this.collectionService.get(id);
|
||||
if (collection != null) {
|
||||
const orgKeys = await firstValueFrom(this.cryptoService.activeUserOrgKeys$);
|
||||
const orgKeys = await firstValueFrom(this.keyService.activeUserOrgKeys$);
|
||||
decCollection = await collection.decrypt(
|
||||
orgKeys[collection.organizationId as OrganizationId],
|
||||
);
|
||||
@@ -445,7 +445,7 @@ export class GetCommand extends DownloadCommand {
|
||||
return Response.badRequest("`" + options.organizationId + "` is not a GUID.");
|
||||
}
|
||||
try {
|
||||
const orgKey = await this.cryptoService.getOrgKey(options.organizationId);
|
||||
const orgKey = await this.keyService.getOrgKey(options.organizationId);
|
||||
if (orgKey == null) {
|
||||
throw new Error("No encryption key for this organization.");
|
||||
}
|
||||
@@ -553,13 +553,13 @@ export class GetCommand extends DownloadCommand {
|
||||
const activeUserId = await firstValueFrom(
|
||||
this.accountService.activeAccount$.pipe(map((a) => a?.id)),
|
||||
);
|
||||
const publicKey = await firstValueFrom(this.cryptoService.userPublicKey$(activeUserId));
|
||||
fingerprint = await this.cryptoService.getFingerprint(activeUserId, publicKey);
|
||||
const publicKey = await firstValueFrom(this.keyService.userPublicKey$(activeUserId));
|
||||
fingerprint = await this.keyService.getFingerprint(activeUserId, publicKey);
|
||||
} else if (Utils.isGuid(id)) {
|
||||
try {
|
||||
const response = await this.apiService.getUserPublicKey(id);
|
||||
const pubKey = Utils.fromB64ToArray(response.publicKey);
|
||||
fingerprint = await this.cryptoService.getFingerprint(id, pubKey);
|
||||
fingerprint = await this.keyService.getFingerprint(id, pubKey);
|
||||
} catch {
|
||||
// eslint-disable-next-line
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user