1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 02:03:39 +00:00

[PM-6146] generator history (#8497)

* introduce `GeneratorHistoryService` abstraction
* implement generator history service with `LocalGeneratorHistoryService` 
* cache decrypted data using `ReplaySubject` instead of `DerivedState`
* move Jsonification from `DataPacker` to `SecretClassifier` because the classifier 
  is the only component that has full type information. The data packer still handles 
  stringification.
This commit is contained in:
✨ Audrey ✨
2024-03-28 12:19:12 -04:00
committed by GitHub
parent 65353ae71d
commit df058ba399
22 changed files with 691 additions and 212 deletions

View File

@@ -1,8 +1,10 @@
import { GENERATOR_DISK, KeyDefinition } from "../../platform/state";
import { GeneratedCredential } from "./history/generated-credential";
import { PassphraseGenerationOptions } from "./passphrase/passphrase-generation-options";
import { GeneratedPasswordHistory } from "./password/generated-password-history";
import { PasswordGenerationOptions } from "./password/password-generation-options";
import { SecretClassifier } from "./state/secret-classifier";
import { SecretKeyDefinition } from "./state/secret-key-definition";
import { CatchallGenerationOptions } from "./username/catchall-generator-options";
import { EffUsernameGenerationOptions } from "./username/eff-username-generator-options";
import {
@@ -107,10 +109,11 @@ export const SIMPLE_LOGIN_FORWARDER = new KeyDefinition<SelfHostedApiOptions>(
);
/** encrypted password generation history */
export const ENCRYPTED_HISTORY = new KeyDefinition<GeneratedPasswordHistory>(
export const GENERATOR_HISTORY = SecretKeyDefinition.array(
GENERATOR_DISK,
"passwordGeneratorHistory",
"localGeneratorHistory",
SecretClassifier.allSecret<GeneratedCredential>(),
{
deserializer: (value) => value,
deserializer: GeneratedCredential.fromJSON,
},
);