1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 23:33:31 +00:00

[PM-8868] only deserialize org invite if not nullish (#9644)

* only deserialize org invite if not nullish

* add null check to OrganizationInvite init methods

* PR feedback
This commit is contained in:
Jake Fink
2024-06-25 15:00:27 -04:00
committed by GitHub
parent 41e1d91558
commit d7bf0fe536
5 changed files with 27 additions and 14 deletions

View File

@@ -28,13 +28,18 @@ import {
} from "../models/request/update-devices-trust.request";
/** Uses disk storage so that the device key can persist after log out and tab removal. */
export const DEVICE_KEY = new UserKeyDefinition<DeviceKey>(DEVICE_TRUST_DISK_LOCAL, "deviceKey", {
deserializer: (deviceKey) => SymmetricCryptoKey.fromJSON(deviceKey) as DeviceKey,
clearOn: [], // Device key is needed to log back into device, so we can't clear it automatically during lock or logout
});
export const DEVICE_KEY = new UserKeyDefinition<DeviceKey | null>(
DEVICE_TRUST_DISK_LOCAL,
"deviceKey",
{
deserializer: (deviceKey) =>
deviceKey ? (SymmetricCryptoKey.fromJSON(deviceKey) as DeviceKey) : null,
clearOn: [], // Device key is needed to log back into device, so we can't clear it automatically during lock or logout
},
);
/** Uses disk storage so that the shouldTrustDevice bool can persist across login. */
export const SHOULD_TRUST_DEVICE = new UserKeyDefinition<boolean>(
export const SHOULD_TRUST_DEVICE = new UserKeyDefinition<boolean | null>(
DEVICE_TRUST_DISK_LOCAL,
"shouldTrustDevice",
{

View File

@@ -29,7 +29,7 @@ import { KeyConnectorUserKeyRequest } from "../models/request/key-connector-user
import { SetKeyConnectorKeyRequest } from "../models/request/set-key-connector-key.request";
import { IdentityTokenResponse } from "../models/response/identity-token.response";
export const USES_KEY_CONNECTOR = new UserKeyDefinition<boolean>(
export const USES_KEY_CONNECTOR = new UserKeyDefinition<boolean | null>(
KEY_CONNECTOR_DISK,
"usesKeyConnector",
{
@@ -38,7 +38,7 @@ export const USES_KEY_CONNECTOR = new UserKeyDefinition<boolean>(
},
);
export const CONVERT_ACCOUNT_TO_KEY_CONNECTOR = new UserKeyDefinition<boolean>(
export const CONVERT_ACCOUNT_TO_KEY_CONNECTOR = new UserKeyDefinition<boolean | null>(
KEY_CONNECTOR_DISK,
"convertAccountToKeyConnector",
{