1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-28 10:33:31 +00:00
This commit is contained in:
Bernd Schoolmann
2025-10-29 12:53:22 +01:00
parent 397d86a181
commit dd0e1227ae

View File

@@ -2,6 +2,7 @@ import { ConditionalExcept, ConditionalKeys } from "type-fest";
import { EncString } from "../../../key-management/crypto/models/enc-string";
import { View } from "../../../models/view/view";
import { Utils } from "../../misc/utils";
import { SymmetricCryptoKey } from "./symmetric-crypto-key";
@@ -69,23 +70,22 @@ export default class Domain {
}
}
/** @deprecated - Domain encryption must be implemented in the SDK */
protected async decryptObj<D extends Domain, V extends View>(
domain: DomainEncryptableKeys<D>,
viewModel: ViewEncryptableKeys<V>,
props: EncryptableKeys<D, V>[],
orgId: string | null,
key: SymmetricCryptoKey | null = null,
orgId: null,
key: SymmetricCryptoKey | null,
objectContext: string = "No Domain Context",
): Promise<V> {
const encryptService = Utils.getContainerService().getEncryptService();
for (const prop of props) {
viewModel[prop] =
(await domain[prop]?.decrypt(
orgId,
key,
`Property: ${prop as string}; ObjectContext: ${objectContext}`,
)) ?? null;
if (domain[prop] == null) {
continue;
}
viewModel[prop] = await encryptService.decryptString(domain[prop]!, key!);
}
return viewModel as V;
}
}