From 90e7e16df64e5a562baeb7622bd3680a47751913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Thu, 30 May 2024 15:37:40 -0400 Subject: [PATCH] move state provider extensions to tools folder (#9436) --- .../history/local-generator-history.service.ts | 8 ++++---- libs/common/src/tools/generator/key-definitions.ts | 6 +++--- .../username/forwarder-generator-strategy.spec.ts | 2 +- .../username/forwarder-generator-strategy.ts | 14 +++++++------- .../state/buffered-key-definition.spec.ts | 2 +- .../state/buffered-key-definition.ts | 4 ++-- .../{generator => }/state/buffered-state.spec.ts | 6 +++--- .../tools/{generator => }/state/buffered-state.ts | 2 +- .../{generator => }/state/classified-format.ts | 0 .../state/data-packer.abstraction.ts | 0 .../state/padded-data-packer.spec.ts | 0 .../{generator => }/state/padded-data-packer.ts | 2 +- .../state/secret-classifier.spec.ts | 0 .../{generator => }/state/secret-classifier.ts | 0 .../state/secret-key-definition.spec.ts | 2 +- .../{generator => }/state/secret-key-definition.ts | 4 ++-- .../{generator => }/state/secret-state.spec.ts | 8 ++++---- .../tools/{generator => }/state/secret-state.ts | 6 +++--- .../state/user-encryptor.abstraction.ts | 4 ++-- .../state/user-key-encryptor.spec.ts | 14 +++++++------- .../{generator => }/state/user-key-encryptor.ts | 8 ++++---- 21 files changed, 46 insertions(+), 46 deletions(-) rename libs/common/src/tools/{generator => }/state/buffered-key-definition.spec.ts (97%) rename libs/common/src/tools/{generator => }/state/buffered-key-definition.ts (97%) rename libs/common/src/tools/{generator => }/state/buffered-state.spec.ts (99%) rename libs/common/src/tools/{generator => }/state/buffered-state.ts (99%) rename libs/common/src/tools/{generator => }/state/classified-format.ts (100%) rename libs/common/src/tools/{generator => }/state/data-packer.abstraction.ts (100%) rename libs/common/src/tools/{generator => }/state/padded-data-packer.spec.ts (100%) rename libs/common/src/tools/{generator => }/state/padded-data-packer.ts (98%) rename libs/common/src/tools/{generator => }/state/secret-classifier.spec.ts (100%) rename libs/common/src/tools/{generator => }/state/secret-classifier.ts (100%) rename libs/common/src/tools/{generator => }/state/secret-key-definition.spec.ts (99%) rename libs/common/src/tools/{generator => }/state/secret-key-definition.ts (97%) rename libs/common/src/tools/{generator => }/state/secret-state.spec.ts (97%) rename libs/common/src/tools/{generator => }/state/secret-state.ts (97%) rename libs/common/src/tools/{generator => }/state/user-encryptor.abstraction.ts (93%) rename libs/common/src/tools/{generator => }/state/user-key-encryptor.spec.ts (90%) rename libs/common/src/tools/{generator => }/state/user-key-encryptor.ts (87%) diff --git a/libs/common/src/tools/generator/history/local-generator-history.service.ts b/libs/common/src/tools/generator/history/local-generator-history.service.ts index dd93e630ca..85aa599946 100644 --- a/libs/common/src/tools/generator/history/local-generator-history.service.ts +++ b/libs/common/src/tools/generator/history/local-generator-history.service.ts @@ -4,12 +4,12 @@ import { CryptoService } from "../../../platform/abstractions/crypto.service"; import { EncryptService } from "../../../platform/abstractions/encrypt.service"; import { SingleUserState, StateProvider } from "../../../platform/state"; import { UserId } from "../../../types/guid"; +import { BufferedState } from "../../state/buffered-state"; +import { PaddedDataPacker } from "../../state/padded-data-packer"; +import { SecretState } from "../../state/secret-state"; +import { UserKeyEncryptor } from "../../state/user-key-encryptor"; import { GeneratorHistoryService } from "../abstractions/generator-history.abstraction"; import { GENERATOR_HISTORY, GENERATOR_HISTORY_BUFFER } from "../key-definitions"; -import { BufferedState } from "../state/buffered-state"; -import { PaddedDataPacker } from "../state/padded-data-packer"; -import { SecretState } from "../state/secret-state"; -import { UserKeyEncryptor } from "../state/user-key-encryptor"; import { GeneratedCredential } from "./generated-credential"; import { LegacyPasswordHistoryDecryptor } from "./legacy-password-history-decryptor"; diff --git a/libs/common/src/tools/generator/key-definitions.ts b/libs/common/src/tools/generator/key-definitions.ts index 1ce2ec8ad1..ccf1ca0d52 100644 --- a/libs/common/src/tools/generator/key-definitions.ts +++ b/libs/common/src/tools/generator/key-definitions.ts @@ -1,6 +1,9 @@ import { Jsonify } from "type-fest"; import { GENERATOR_DISK, UserKeyDefinition } from "../../platform/state"; +import { BufferedKeyDefinition } from "../state/buffered-key-definition"; +import { SecretClassifier } from "../state/secret-classifier"; +import { SecretKeyDefinition } from "../state/secret-key-definition"; import { GeneratedCredential } from "./history/generated-credential"; import { LegacyPasswordHistoryDecryptor } from "./history/legacy-password-history-decryptor"; @@ -8,9 +11,6 @@ import { GeneratorNavigation } from "./navigation/generator-navigation"; import { PassphraseGenerationOptions } from "./passphrase/passphrase-generation-options"; import { GeneratedPasswordHistory } from "./password/generated-password-history"; import { PasswordGenerationOptions } from "./password/password-generation-options"; -import { BufferedKeyDefinition } from "./state/buffered-key-definition"; -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 { diff --git a/libs/common/src/tools/generator/username/forwarder-generator-strategy.spec.ts b/libs/common/src/tools/generator/username/forwarder-generator-strategy.spec.ts index d3bec745f1..7c1b4b9191 100644 --- a/libs/common/src/tools/generator/username/forwarder-generator-strategy.spec.ts +++ b/libs/common/src/tools/generator/username/forwarder-generator-strategy.spec.ts @@ -11,9 +11,9 @@ import { EncryptService } from "../../../platform/abstractions/encrypt.service"; import { StateProvider } from "../../../platform/state"; import { UserId } from "../../../types/guid"; import { UserKey } from "../../../types/key"; +import { BufferedState } from "../../state/buffered-state"; import { DefaultPolicyEvaluator } from "../default-policy-evaluator"; import { DUCK_DUCK_GO_FORWARDER, DUCK_DUCK_GO_BUFFER } from "../key-definitions"; -import { BufferedState } from "../state/buffered-state"; import { ForwarderGeneratorStrategy } from "./forwarder-generator-strategy"; import { DefaultDuckDuckGoOptions } from "./forwarders/duck-duck-go"; diff --git a/libs/common/src/tools/generator/username/forwarder-generator-strategy.ts b/libs/common/src/tools/generator/username/forwarder-generator-strategy.ts index 1abefcc23c..28ebcba4fd 100644 --- a/libs/common/src/tools/generator/username/forwarder-generator-strategy.ts +++ b/libs/common/src/tools/generator/username/forwarder-generator-strategy.ts @@ -5,16 +5,16 @@ import { CryptoService } from "../../../platform/abstractions/crypto.service"; import { EncryptService } from "../../../platform/abstractions/encrypt.service"; import { SingleUserState, StateProvider, UserKeyDefinition } from "../../../platform/state"; import { UserId } from "../../../types/guid"; +import { BufferedKeyDefinition } from "../../state/buffered-key-definition"; +import { BufferedState } from "../../state/buffered-state"; +import { PaddedDataPacker } from "../../state/padded-data-packer"; +import { SecretClassifier } from "../../state/secret-classifier"; +import { SecretKeyDefinition } from "../../state/secret-key-definition"; +import { SecretState } from "../../state/secret-state"; +import { UserKeyEncryptor } from "../../state/user-key-encryptor"; import { GeneratorStrategy } from "../abstractions"; import { DefaultPolicyEvaluator } from "../default-policy-evaluator"; import { NoPolicy } from "../no-policy"; -import { BufferedKeyDefinition } from "../state/buffered-key-definition"; -import { BufferedState } from "../state/buffered-state"; -import { PaddedDataPacker } from "../state/padded-data-packer"; -import { SecretClassifier } from "../state/secret-classifier"; -import { SecretKeyDefinition } from "../state/secret-key-definition"; -import { SecretState } from "../state/secret-state"; -import { UserKeyEncryptor } from "../state/user-key-encryptor"; import { ApiOptions } from "./options/forwarder-options"; diff --git a/libs/common/src/tools/generator/state/buffered-key-definition.spec.ts b/libs/common/src/tools/state/buffered-key-definition.spec.ts similarity index 97% rename from libs/common/src/tools/generator/state/buffered-key-definition.spec.ts rename to libs/common/src/tools/state/buffered-key-definition.spec.ts index b056cba397..709b961855 100644 --- a/libs/common/src/tools/generator/state/buffered-key-definition.spec.ts +++ b/libs/common/src/tools/state/buffered-key-definition.spec.ts @@ -1,4 +1,4 @@ -import { GENERATOR_DISK, UserKeyDefinition } from "../../../platform/state"; +import { GENERATOR_DISK, UserKeyDefinition } from "../../platform/state"; import { BufferedKeyDefinition } from "./buffered-key-definition"; diff --git a/libs/common/src/tools/generator/state/buffered-key-definition.ts b/libs/common/src/tools/state/buffered-key-definition.ts similarity index 97% rename from libs/common/src/tools/generator/state/buffered-key-definition.ts rename to libs/common/src/tools/state/buffered-key-definition.ts index 1f11280839..879c9d76e3 100644 --- a/libs/common/src/tools/generator/state/buffered-key-definition.ts +++ b/libs/common/src/tools/state/buffered-key-definition.ts @@ -1,6 +1,6 @@ -import { UserKeyDefinition, UserKeyDefinitionOptions } from "../../../platform/state"; +import { UserKeyDefinition, UserKeyDefinitionOptions } from "../../platform/state"; // eslint-disable-next-line -- `StateDefinition` used as an argument -import { StateDefinition } from "../../../platform/state/state-definition"; +import { StateDefinition } from "../../platform/state/state-definition"; /** A set of options for customizing the behavior of a {@link BufferedKeyDefinition} */ diff --git a/libs/common/src/tools/generator/state/buffered-state.spec.ts b/libs/common/src/tools/state/buffered-state.spec.ts similarity index 99% rename from libs/common/src/tools/generator/state/buffered-state.spec.ts rename to libs/common/src/tools/state/buffered-state.spec.ts index 46e132c1bd..09419207ca 100644 --- a/libs/common/src/tools/generator/state/buffered-state.spec.ts +++ b/libs/common/src/tools/state/buffered-state.spec.ts @@ -5,9 +5,9 @@ import { FakeStateProvider, awaitAsync, trackEmissions, -} from "../../../../spec"; -import { GENERATOR_DISK, KeyDefinition } from "../../../platform/state"; -import { UserId } from "../../../types/guid"; +} from "../../../spec"; +import { GENERATOR_DISK, KeyDefinition } from "../../platform/state"; +import { UserId } from "../../types/guid"; import { BufferedKeyDefinition } from "./buffered-key-definition"; import { BufferedState } from "./buffered-state"; diff --git a/libs/common/src/tools/generator/state/buffered-state.ts b/libs/common/src/tools/state/buffered-state.ts similarity index 99% rename from libs/common/src/tools/generator/state/buffered-state.ts rename to libs/common/src/tools/state/buffered-state.ts index bb4de645e9..3956072a44 100644 --- a/libs/common/src/tools/generator/state/buffered-state.ts +++ b/libs/common/src/tools/state/buffered-state.ts @@ -5,7 +5,7 @@ import { SingleUserState, CombinedState, StateUpdateOptions, -} from "../../../platform/state"; +} from "../../platform/state"; import { BufferedKeyDefinition } from "./buffered-key-definition"; diff --git a/libs/common/src/tools/generator/state/classified-format.ts b/libs/common/src/tools/state/classified-format.ts similarity index 100% rename from libs/common/src/tools/generator/state/classified-format.ts rename to libs/common/src/tools/state/classified-format.ts diff --git a/libs/common/src/tools/generator/state/data-packer.abstraction.ts b/libs/common/src/tools/state/data-packer.abstraction.ts similarity index 100% rename from libs/common/src/tools/generator/state/data-packer.abstraction.ts rename to libs/common/src/tools/state/data-packer.abstraction.ts diff --git a/libs/common/src/tools/generator/state/padded-data-packer.spec.ts b/libs/common/src/tools/state/padded-data-packer.spec.ts similarity index 100% rename from libs/common/src/tools/generator/state/padded-data-packer.spec.ts rename to libs/common/src/tools/state/padded-data-packer.spec.ts diff --git a/libs/common/src/tools/generator/state/padded-data-packer.ts b/libs/common/src/tools/state/padded-data-packer.ts similarity index 98% rename from libs/common/src/tools/generator/state/padded-data-packer.ts rename to libs/common/src/tools/state/padded-data-packer.ts index d1573e5cb7..9731dab930 100644 --- a/libs/common/src/tools/generator/state/padded-data-packer.ts +++ b/libs/common/src/tools/state/padded-data-packer.ts @@ -1,6 +1,6 @@ import { Jsonify } from "type-fest"; -import { Utils } from "../../../platform/misc/utils"; +import { Utils } from "../../platform/misc/utils"; import { DataPacker as DataPackerAbstraction } from "./data-packer.abstraction"; diff --git a/libs/common/src/tools/generator/state/secret-classifier.spec.ts b/libs/common/src/tools/state/secret-classifier.spec.ts similarity index 100% rename from libs/common/src/tools/generator/state/secret-classifier.spec.ts rename to libs/common/src/tools/state/secret-classifier.spec.ts diff --git a/libs/common/src/tools/generator/state/secret-classifier.ts b/libs/common/src/tools/state/secret-classifier.ts similarity index 100% rename from libs/common/src/tools/generator/state/secret-classifier.ts rename to libs/common/src/tools/state/secret-classifier.ts diff --git a/libs/common/src/tools/generator/state/secret-key-definition.spec.ts b/libs/common/src/tools/state/secret-key-definition.spec.ts similarity index 99% rename from libs/common/src/tools/generator/state/secret-key-definition.spec.ts rename to libs/common/src/tools/state/secret-key-definition.spec.ts index a347268b0b..33b2ec01d2 100644 --- a/libs/common/src/tools/generator/state/secret-key-definition.spec.ts +++ b/libs/common/src/tools/state/secret-key-definition.spec.ts @@ -1,4 +1,4 @@ -import { GENERATOR_DISK, UserKeyDefinitionOptions } from "../../../platform/state"; +import { GENERATOR_DISK, UserKeyDefinitionOptions } from "../../platform/state"; import { SecretClassifier } from "./secret-classifier"; import { SecretKeyDefinition } from "./secret-key-definition"; diff --git a/libs/common/src/tools/generator/state/secret-key-definition.ts b/libs/common/src/tools/state/secret-key-definition.ts similarity index 97% rename from libs/common/src/tools/generator/state/secret-key-definition.ts rename to libs/common/src/tools/state/secret-key-definition.ts index 22496d878e..c33bb96685 100644 --- a/libs/common/src/tools/generator/state/secret-key-definition.ts +++ b/libs/common/src/tools/state/secret-key-definition.ts @@ -1,6 +1,6 @@ -import { UserKeyDefinitionOptions, UserKeyDefinition } from "../../../platform/state"; +import { UserKeyDefinitionOptions, UserKeyDefinition } from "../../platform/state"; // eslint-disable-next-line -- `StateDefinition` used as an argument -import { StateDefinition } from "../../../platform/state/state-definition"; +import { StateDefinition } from "../../platform/state/state-definition"; import { ClassifiedFormat } from "./classified-format"; import { SecretClassifier } from "./secret-classifier"; diff --git a/libs/common/src/tools/generator/state/secret-state.spec.ts b/libs/common/src/tools/state/secret-state.spec.ts similarity index 97% rename from libs/common/src/tools/generator/state/secret-state.spec.ts rename to libs/common/src/tools/state/secret-state.spec.ts index 1f5e14dde9..a3d22c14bf 100644 --- a/libs/common/src/tools/generator/state/secret-state.spec.ts +++ b/libs/common/src/tools/state/secret-state.spec.ts @@ -7,10 +7,10 @@ import { makeEncString, mockAccountServiceWith, awaitAsync, -} from "../../../../spec"; -import { EncString } from "../../../platform/models/domain/enc-string"; -import { GENERATOR_DISK } from "../../../platform/state"; -import { UserId } from "../../../types/guid"; +} from "../../../spec"; +import { EncString } from "../../platform/models/domain/enc-string"; +import { GENERATOR_DISK } from "../../platform/state"; +import { UserId } from "../../types/guid"; import { SecretClassifier } from "./secret-classifier"; import { SecretKeyDefinition } from "./secret-key-definition"; diff --git a/libs/common/src/tools/generator/state/secret-state.ts b/libs/common/src/tools/state/secret-state.ts similarity index 97% rename from libs/common/src/tools/generator/state/secret-state.ts rename to libs/common/src/tools/state/secret-state.ts index dc4ee119a6..6713b56ea1 100644 --- a/libs/common/src/tools/generator/state/secret-state.ts +++ b/libs/common/src/tools/state/secret-state.ts @@ -1,13 +1,13 @@ import { Observable, map, concatMap, share, ReplaySubject, timer } from "rxjs"; -import { EncString } from "../../../platform/models/domain/enc-string"; +import { EncString } from "../../platform/models/domain/enc-string"; import { SingleUserState, StateProvider, StateUpdateOptions, CombinedState, -} from "../../../platform/state"; -import { UserId } from "../../../types/guid"; +} from "../../platform/state"; +import { UserId } from "../../types/guid"; import { ClassifiedFormat } from "./classified-format"; import { SecretKeyDefinition } from "./secret-key-definition"; diff --git a/libs/common/src/tools/generator/state/user-encryptor.abstraction.ts b/libs/common/src/tools/state/user-encryptor.abstraction.ts similarity index 93% rename from libs/common/src/tools/generator/state/user-encryptor.abstraction.ts rename to libs/common/src/tools/state/user-encryptor.abstraction.ts index 76539a0edf..7638ac1658 100644 --- a/libs/common/src/tools/generator/state/user-encryptor.abstraction.ts +++ b/libs/common/src/tools/state/user-encryptor.abstraction.ts @@ -1,7 +1,7 @@ import { Jsonify } from "type-fest"; -import { EncString } from "../../../platform/models/domain/enc-string"; -import { UserId } from "../../../types/guid"; +import { EncString } from "../../platform/models/domain/enc-string"; +import { UserId } from "../../types/guid"; /** A classification strategy that protects a type's secrets with * user-specific information. The specific kind of information is diff --git a/libs/common/src/tools/generator/state/user-key-encryptor.spec.ts b/libs/common/src/tools/state/user-key-encryptor.spec.ts similarity index 90% rename from libs/common/src/tools/generator/state/user-key-encryptor.spec.ts rename to libs/common/src/tools/state/user-key-encryptor.spec.ts index 072f7bd8f3..fac9fc1fca 100644 --- a/libs/common/src/tools/generator/state/user-key-encryptor.spec.ts +++ b/libs/common/src/tools/state/user-key-encryptor.spec.ts @@ -1,12 +1,12 @@ import { mock } from "jest-mock-extended"; -import { CryptoService } from "../../../platform/abstractions/crypto.service"; -import { EncryptService } from "../../../platform/abstractions/encrypt.service"; -import { EncString } from "../../../platform/models/domain/enc-string"; -import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; -import { CsprngArray } from "../../../types/csprng"; -import { UserId } from "../../../types/guid"; -import { UserKey } from "../../../types/key"; +import { CryptoService } from "../../platform/abstractions/crypto.service"; +import { EncryptService } from "../../platform/abstractions/encrypt.service"; +import { EncString } from "../../platform/models/domain/enc-string"; +import { SymmetricCryptoKey } from "../../platform/models/domain/symmetric-crypto-key"; +import { CsprngArray } from "../../types/csprng"; +import { UserId } from "../../types/guid"; +import { UserKey } from "../../types/key"; import { DataPacker } from "./data-packer.abstraction"; import { UserKeyEncryptor } from "./user-key-encryptor"; diff --git a/libs/common/src/tools/generator/state/user-key-encryptor.ts b/libs/common/src/tools/state/user-key-encryptor.ts similarity index 87% rename from libs/common/src/tools/generator/state/user-key-encryptor.ts rename to libs/common/src/tools/state/user-key-encryptor.ts index 27724d820d..ef4ac5aeb7 100644 --- a/libs/common/src/tools/generator/state/user-key-encryptor.ts +++ b/libs/common/src/tools/state/user-key-encryptor.ts @@ -1,9 +1,9 @@ import { Jsonify } from "type-fest"; -import { CryptoService } from "../../../platform/abstractions/crypto.service"; -import { EncryptService } from "../../../platform/abstractions/encrypt.service"; -import { EncString } from "../../../platform/models/domain/enc-string"; -import { UserId } from "../../../types/guid"; +import { CryptoService } from "../../platform/abstractions/crypto.service"; +import { EncryptService } from "../../platform/abstractions/encrypt.service"; +import { EncString } from "../../platform/models/domain/enc-string"; +import { UserId } from "../../types/guid"; import { DataPacker } from "./data-packer.abstraction"; import { UserEncryptor } from "./user-encryptor.abstraction";