mirror of
https://github.com/bitwarden/browser
synced 2026-02-06 11:43:51 +00:00
Merge branch 'km/decrypt-obj' of github.com:bitwarden/clients into km/decrypt-obj
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ConditionalExcept, ConditionalKeys } from "type-fest";
|
||||
|
||||
import { EncString } from "../../../key-management/crypto/models/enc-string";
|
||||
import { DECRYPT_ERROR, EncString } from "../../../key-management/crypto/models/enc-string";
|
||||
import { View } from "../../../models/view/view";
|
||||
import { Utils } from "../../misc/utils";
|
||||
|
||||
@@ -81,16 +81,19 @@ export default class Domain {
|
||||
const encryptService = Utils.getContainerService().getEncryptService();
|
||||
for (const prop of props) {
|
||||
if (domain[prop] == null) {
|
||||
viewModel[prop] = null;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
viewModel[prop] = await encryptService.decryptString(domain[prop]!, key!);
|
||||
viewModel[prop] = await encryptService.decryptString(domain[prop]!, key);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
`Failed to decrypt property '${String(
|
||||
prop,
|
||||
)}' of domain. Context: ${objectContext}. Error: ${"message" in e ? e.message : String(e)}`, // In case the SDK maps to a non-Error type, this is defensive
|
||||
);
|
||||
viewModel[prop] = DECRYPT_ERROR;
|
||||
}
|
||||
}
|
||||
return viewModel as V;
|
||||
|
||||
Reference in New Issue
Block a user