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

Tools/specify-clearon-conditions (#8596)

* Specify user clear events for event upload

* Specify generator clear events

* Specify clear events for user send data

* Specify generic clear on logout for encrypted secret state

* Allow `clearOn`event to be passed into secret state

* Match current data persistence rules

* Clear ui memory on lock + logout
This commit is contained in:
Matt Gibson
2024-04-08 07:26:22 -05:00
committed by GitHub
parent 759e48728e
commit 1308b326fd
8 changed files with 64 additions and 35 deletions

View File

@@ -1,13 +1,23 @@
import { KeyDefinition, SEND_DISK, SEND_MEMORY } from "../../../platform/state";
import { SEND_DISK, SEND_MEMORY, UserKeyDefinition } from "../../../platform/state";
import { SendData } from "../models/data/send.data";
import { SendView } from "../models/view/send.view";
/** Encrypted send state stored on disk */
export const SEND_USER_ENCRYPTED = KeyDefinition.record<SendData>(SEND_DISK, "sendUserEncrypted", {
deserializer: (obj: SendData) => obj,
});
export const SEND_USER_ENCRYPTED = UserKeyDefinition.record<SendData>(
SEND_DISK,
"sendUserEncrypted",
{
deserializer: (obj: SendData) => obj,
clearOn: ["logout"],
},
);
/** Decrypted send state stored in memory */
export const SEND_USER_DECRYPTED = new KeyDefinition<SendView[]>(SEND_MEMORY, "sendUserDecrypted", {
deserializer: (obj) => obj,
});
export const SEND_USER_DECRYPTED = new UserKeyDefinition<SendView[]>(
SEND_MEMORY,
"sendUserDecrypted",
{
deserializer: (obj) => obj,
clearOn: ["lock"],
},
);