mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
Initialize SDK even when orgKeys is null (#11748)
This commit is contained in:
parent
9d2848d0f1
commit
65074b0d12
@ -96,7 +96,7 @@ export class DefaultSdkService implements SdkService {
|
|||||||
let client: BitwardenClient;
|
let client: BitwardenClient;
|
||||||
|
|
||||||
const createAndInitializeClient = async () => {
|
const createAndInitializeClient = async () => {
|
||||||
if (privateKey == null || userKey == null || orgKeys == null) {
|
if (privateKey == null || userKey == null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ export class DefaultSdkService implements SdkService {
|
|||||||
kdfParams: KdfConfig,
|
kdfParams: KdfConfig,
|
||||||
privateKey: EncryptedString,
|
privateKey: EncryptedString,
|
||||||
userKey: UserKey,
|
userKey: UserKey,
|
||||||
orgKeys: Record<OrganizationId, EncryptedOrganizationKeyData>,
|
orgKeys?: Record<OrganizationId, EncryptedOrganizationKeyData>,
|
||||||
) {
|
) {
|
||||||
await client.crypto().initialize_user_crypto({
|
await client.crypto().initialize_user_crypto({
|
||||||
email: account.email,
|
email: account.email,
|
||||||
@ -169,9 +169,12 @@ export class DefaultSdkService implements SdkService {
|
|||||||
},
|
},
|
||||||
privateKey,
|
privateKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// We initialize the org crypto even if the org_keys are
|
||||||
|
// null to make sure any existing org keys are cleared.
|
||||||
await client.crypto().initialize_org_crypto({
|
await client.crypto().initialize_org_crypto({
|
||||||
organizationKeys: new Map(
|
organizationKeys: new Map(
|
||||||
Object.entries(orgKeys)
|
Object.entries(orgKeys ?? {})
|
||||||
.filter(([_, v]) => v.type === "organization")
|
.filter(([_, v]) => v.type === "organization")
|
||||||
.map(([k, v]) => [k, v.key]),
|
.map(([k, v]) => [k, v.key]),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user