mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
[PM-21001] Move autofill code to new encrypt service interface (#14548)
* Move autofill code to new encrypt service interface * Fix test runner
This commit is contained in:
@@ -220,7 +220,7 @@ export default class NativeMessageService {
|
|||||||
|
|
||||||
const sharedKey = await this.getSharedKeyForKey(key);
|
const sharedKey = await this.getSharedKeyForKey(key);
|
||||||
|
|
||||||
return this.encryptService.encrypt(commandDataString, sharedKey);
|
return this.encryptService.encryptString(commandDataString, sharedKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async decryptResponsePayload(
|
private async decryptResponsePayload(
|
||||||
@@ -228,11 +228,7 @@ export default class NativeMessageService {
|
|||||||
key: string,
|
key: string,
|
||||||
): Promise<DecryptedCommandData> {
|
): Promise<DecryptedCommandData> {
|
||||||
const sharedKey = await this.getSharedKeyForKey(key);
|
const sharedKey = await this.getSharedKeyForKey(key);
|
||||||
const decrypted = await this.encryptService.decryptToUtf8(
|
const decrypted = await this.encryptService.decryptString(payload, sharedKey);
|
||||||
payload,
|
|
||||||
sharedKey,
|
|
||||||
"native-messaging-session",
|
|
||||||
);
|
|
||||||
|
|
||||||
return JSON.parse(decrypted);
|
return JSON.parse(decrypted);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ export class DuckDuckGoMessageHandlerService {
|
|||||||
payload: DecryptedCommandData,
|
payload: DecryptedCommandData,
|
||||||
key: SymmetricCryptoKey,
|
key: SymmetricCryptoKey,
|
||||||
): Promise<EncString> {
|
): Promise<EncString> {
|
||||||
return await this.encryptService.encrypt(JSON.stringify(payload), key);
|
return await this.encryptService.encryptString(JSON.stringify(payload), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async decryptPayload(message: EncryptedMessage): Promise<DecryptedCommandData> {
|
private async decryptPayload(message: EncryptedMessage): Promise<DecryptedCommandData> {
|
||||||
@@ -188,10 +188,9 @@ export class DuckDuckGoMessageHandlerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let decryptedResult = await this.encryptService.decryptToUtf8(
|
let decryptedResult = await this.encryptService.decryptString(
|
||||||
message.encryptedCommand as EncString,
|
message.encryptedCommand as EncString,
|
||||||
this.duckduckgoSharedSecret,
|
this.duckduckgoSharedSecret,
|
||||||
"ddg-shared-key",
|
|
||||||
);
|
);
|
||||||
|
|
||||||
decryptedResult = this.trimNullCharsFromMessage(decryptedResult);
|
decryptedResult = this.trimNullCharsFromMessage(decryptedResult);
|
||||||
|
|||||||
Reference in New Issue
Block a user