mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 21:33:27 +00:00
[PM-21001] Move KM usage of encrypt service (#14541)
* Add new encrypt service functions * Undo changes * Cleanup * Fix build * Fix comments * Move KM usage of encrypt service * Fix build
This commit is contained in:
@@ -357,7 +357,7 @@ export class NativeMessagingBackground {
|
||||
await this.secureCommunication();
|
||||
}
|
||||
|
||||
return await this.encryptService.encrypt(
|
||||
return await this.encryptService.encryptString(
|
||||
JSON.stringify(message),
|
||||
this.secureChannel!.sharedSecret!,
|
||||
);
|
||||
@@ -401,10 +401,9 @@ export class NativeMessagingBackground {
|
||||
return;
|
||||
}
|
||||
message = JSON.parse(
|
||||
await this.encryptService.decryptToUtf8(
|
||||
await this.encryptService.decryptString(
|
||||
rawMessage as EncString,
|
||||
this.secureChannel.sharedSecret,
|
||||
"ipc-desktop-ipc-channel-key",
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -347,7 +347,7 @@ describe("BiometricMessageHandlerService", () => {
|
||||
trusted: false,
|
||||
}),
|
||||
);
|
||||
encryptService.decryptToUtf8.mockResolvedValue(
|
||||
encryptService.decryptString.mockResolvedValue(
|
||||
JSON.stringify({
|
||||
command: "biometricUnlock",
|
||||
messageId: 0,
|
||||
@@ -382,7 +382,7 @@ describe("BiometricMessageHandlerService", () => {
|
||||
ngZone.run.mockReturnValue({
|
||||
closed: of(true),
|
||||
});
|
||||
encryptService.decryptToUtf8.mockResolvedValue(
|
||||
encryptService.decryptString.mockResolvedValue(
|
||||
JSON.stringify({
|
||||
command: BiometricsCommands.UnlockWithBiometricsForUser,
|
||||
messageId: 0,
|
||||
@@ -433,7 +433,7 @@ describe("BiometricMessageHandlerService", () => {
|
||||
ngZone.run.mockReturnValue({
|
||||
closed: of(false),
|
||||
});
|
||||
encryptService.decryptToUtf8.mockResolvedValue(
|
||||
encryptService.decryptString.mockResolvedValue(
|
||||
JSON.stringify({
|
||||
command: BiometricsCommands.UnlockWithBiometricsForUser,
|
||||
messageId: 0,
|
||||
@@ -480,7 +480,7 @@ describe("BiometricMessageHandlerService", () => {
|
||||
trusted: true,
|
||||
}),
|
||||
);
|
||||
encryptService.decryptToUtf8.mockResolvedValue(
|
||||
encryptService.decryptString.mockResolvedValue(
|
||||
JSON.stringify({
|
||||
command: BiometricsCommands.UnlockWithBiometricsForUser,
|
||||
messageId: 0,
|
||||
|
||||
@@ -175,7 +175,7 @@ export class BiometricMessageHandlerService {
|
||||
}
|
||||
|
||||
const message: LegacyMessage = JSON.parse(
|
||||
await this.encryptService.decryptToUtf8(
|
||||
await this.encryptService.decryptString(
|
||||
rawMessage as EncString,
|
||||
SymmetricCryptoKey.fromString(sessionSecret),
|
||||
),
|
||||
@@ -365,7 +365,7 @@ export class BiometricMessageHandlerService {
|
||||
throw new Error("Session secret is missing");
|
||||
}
|
||||
|
||||
const encrypted = await this.encryptService.encrypt(
|
||||
const encrypted = await this.encryptService.encryptString(
|
||||
JSON.stringify(message),
|
||||
SymmetricCryptoKey.fromString(sessionSecret),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user