mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 13:23:34 +00:00
Move asymmetric crypto functions out of crypto service (#10903)
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
} from "@bitwarden/admin-console/common";
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
|
||||
import { Response } from "../../models/response";
|
||||
@@ -12,6 +13,7 @@ export class ConfirmCommand {
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private cryptoService: CryptoService,
|
||||
private encryptService: EncryptService,
|
||||
private organizationUserApiService: OrganizationUserApiService,
|
||||
) {}
|
||||
|
||||
@@ -53,7 +55,7 @@ export class ConfirmCommand {
|
||||
}
|
||||
const publicKeyResponse = await this.apiService.getUserPublicKey(orgUser.userId);
|
||||
const publicKey = Utils.fromB64ToArray(publicKeyResponse.publicKey);
|
||||
const key = await this.cryptoService.rsaEncrypt(orgKey.key, publicKey);
|
||||
const key = await this.encryptService.rsaEncrypt(orgKey.key, publicKey);
|
||||
const req = new OrganizationUserConfirmRequest();
|
||||
req.key = key.encryptedString;
|
||||
await this.organizationUserApiService.postOrganizationUserConfirm(
|
||||
|
||||
@@ -117,6 +117,7 @@ export class OssServeConfigurator {
|
||||
this.confirmCommand = new ConfirmCommand(
|
||||
this.serviceContainer.apiService,
|
||||
this.serviceContainer.cryptoService,
|
||||
this.serviceContainer.encryptService,
|
||||
this.serviceContainer.organizationUserApiService,
|
||||
);
|
||||
this.restoreCommand = new RestoreCommand(this.serviceContainer.cipherService);
|
||||
|
||||
@@ -534,6 +534,7 @@ export class ServiceContainer {
|
||||
this.accountService,
|
||||
this.masterPasswordService,
|
||||
this.cryptoService,
|
||||
this.encryptService,
|
||||
this.apiService,
|
||||
this.stateProvider,
|
||||
);
|
||||
|
||||
@@ -415,6 +415,7 @@ export class VaultProgram extends BaseProgram {
|
||||
const command = new ConfirmCommand(
|
||||
this.serviceContainer.apiService,
|
||||
this.serviceContainer.cryptoService,
|
||||
this.serviceContainer.encryptService,
|
||||
this.serviceContainer.organizationUserApiService,
|
||||
);
|
||||
const response = await command.run(object, id, cmd);
|
||||
|
||||
Reference in New Issue
Block a user