diff --git a/libs/common/src/auth/services/auth.service.spec.ts b/libs/common/src/auth/services/auth.service.spec.ts index 4b7b8a2b262..fc236c91a21 100644 --- a/libs/common/src/auth/services/auth.service.spec.ts +++ b/libs/common/src/auth/services/auth.service.spec.ts @@ -1,9 +1,8 @@ import { MockProxy, mock } from "jest-mock-extended"; import { firstValueFrom, of } from "rxjs"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { FakeAccountService, makeStaticByteArray, diff --git a/libs/common/src/auth/services/auth.service.ts b/libs/common/src/auth/services/auth.service.ts index d855a1be34f..da70baf3999 100644 --- a/libs/common/src/auth/services/auth.service.ts +++ b/libs/common/src/auth/services/auth.service.ts @@ -11,9 +11,8 @@ import { switchMap, } from "rxjs"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { ApiService } from "../../abstractions/api.service"; import { StateService } from "../../platform/abstractions/state.service"; import { MessageSender } from "../../platform/messaging"; diff --git a/libs/common/src/auth/services/device-trust.service.implementation.ts b/libs/common/src/auth/services/device-trust.service.implementation.ts index c40091a66fa..b58b641acc9 100644 --- a/libs/common/src/auth/services/device-trust.service.implementation.ts +++ b/libs/common/src/auth/services/device-trust.service.implementation.ts @@ -3,10 +3,8 @@ import { firstValueFrom, map, Observable } from "rxjs"; import { UserDecryptionOptionsServiceAbstraction } from "@bitwarden/auth/common"; +import { KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { AppIdService } from "../../platform/abstractions/app-id.service"; import { ConfigService } from "../../platform/abstractions/config/config.service"; import { CryptoFunctionService } from "../../platform/abstractions/crypto-function.service"; diff --git a/libs/common/src/auth/services/device-trust.service.spec.ts b/libs/common/src/auth/services/device-trust.service.spec.ts index 943653e3129..87ee7233a1a 100644 --- a/libs/common/src/auth/services/device-trust.service.spec.ts +++ b/libs/common/src/auth/services/device-trust.service.spec.ts @@ -2,13 +2,11 @@ import { matches, mock } from "jest-mock-extended"; import { BehaviorSubject, of } from "rxjs"; import { UserDecryptionOptionsServiceAbstraction } from "@bitwarden/auth/common"; +import { KeyService } from "@bitwarden/key-management"; // FIXME: remove `src` and fix import // eslint-disable-next-line no-restricted-imports import { UserDecryptionOptions } from "../../../../auth/src/common/models/domain/user-decryption-options"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { FakeAccountService, mockAccountServiceWith } from "../../../spec/fake-account-service"; import { FakeActiveUserState } from "../../../spec/fake-state"; import { FakeStateProvider } from "../../../spec/fake-state-provider"; diff --git a/libs/common/src/auth/services/key-connector.service.spec.ts b/libs/common/src/auth/services/key-connector.service.spec.ts index 660f1124f4a..938e507a3a1 100644 --- a/libs/common/src/auth/services/key-connector.service.spec.ts +++ b/libs/common/src/auth/services/key-connector.service.spec.ts @@ -1,8 +1,7 @@ import { mock } from "jest-mock-extended"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { FakeAccountService, FakeStateProvider, mockAccountServiceWith } from "../../../spec"; import { ApiService } from "../../abstractions/api.service"; import { OrganizationService } from "../../admin-console/abstractions/organization/organization.service.abstraction"; diff --git a/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts b/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts index 95b6f3f8b9d..f1491ba45ce 100644 --- a/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts +++ b/libs/common/src/auth/services/password-reset-enrollment.service.implementation.spec.ts @@ -3,13 +3,9 @@ import { BehaviorSubject } from "rxjs"; import { OrganizationUserApiService } from "@bitwarden/admin-console/common"; import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; +import { UserId } from "@bitwarden/common/types/guid"; +import { KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { UserId } from "../../../../common/src/types/guid"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { OrganizationApiServiceAbstraction } from "../../admin-console/abstractions/organization/organization-api.service.abstraction"; import { OrganizationAutoEnrollStatusResponse } from "../../admin-console/models/response/organization-auto-enroll-status.response"; import { I18nService } from "../../platform/abstractions/i18n.service"; diff --git a/libs/common/src/auth/services/password-reset-enrollment.service.implementation.ts b/libs/common/src/auth/services/password-reset-enrollment.service.implementation.ts index 0bdf98cef7b..bc011a57202 100644 --- a/libs/common/src/auth/services/password-reset-enrollment.service.implementation.ts +++ b/libs/common/src/auth/services/password-reset-enrollment.service.implementation.ts @@ -7,10 +7,8 @@ import { OrganizationUserResetPasswordEnrollmentRequest, } from "@bitwarden/admin-console/common"; import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; +import { KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { OrganizationApiServiceAbstraction } from "../../admin-console/abstractions/organization/organization-api.service.abstraction"; import { I18nService } from "../../platform/abstractions/i18n.service"; import { Utils } from "../../platform/misc/utils"; diff --git a/libs/common/src/auth/services/user-verification/user-verification.service.spec.ts b/libs/common/src/auth/services/user-verification/user-verification.service.spec.ts index 102e4bac8da..677b6ff4499 100644 --- a/libs/common/src/auth/services/user-verification/user-verification.service.spec.ts +++ b/libs/common/src/auth/services/user-verification/user-verification.service.spec.ts @@ -12,11 +12,9 @@ import { BiometricsStatus, KdfConfig, KeyService, + KdfConfigService, } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KdfConfigService } from "../../../../../key-management/src/abstractions/kdf-config.service"; import { FakeAccountService, mockAccountServiceWith } from "../../../../spec"; import { VaultTimeoutSettingsService } from "../../../abstractions/vault-timeout/vault-timeout-settings.service"; import { I18nService } from "../../../platform/abstractions/i18n.service"; diff --git a/libs/common/src/key-management/services/default-process-reload.service.ts b/libs/common/src/key-management/services/default-process-reload.service.ts index f1c3aed6a58..8615ae29c3f 100644 --- a/libs/common/src/key-management/services/default-process-reload.service.ts +++ b/libs/common/src/key-management/services/default-process-reload.service.ts @@ -2,13 +2,11 @@ // @ts-strict-ignore import { firstValueFrom, map, timeout } from "rxjs"; +import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { BiometricStateService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { PinServiceAbstraction } from "../../../../auth/src/common/abstractions"; import { VaultTimeoutSettingsService } from "../../abstractions/vault-timeout/vault-timeout-settings.service"; import { AccountService } from "../../auth/abstractions/account.service"; import { AuthService } from "../../auth/abstractions/auth.service"; diff --git a/libs/common/src/platform/misc/utils.ts b/libs/common/src/platform/misc/utils.ts index 95d17e6d046..fff7c3261b1 100644 --- a/libs/common/src/platform/misc/utils.ts +++ b/libs/common/src/platform/misc/utils.ts @@ -8,9 +8,8 @@ import { Observable, of, switchMap } from "rxjs"; import { getHostname, parse } from "tldts"; import { Merge } from "type-fest"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { EncryptService } from "../abstractions/encrypt.service"; import { I18nService } from "../abstractions/i18n.service"; diff --git a/libs/common/src/platform/models/domain/enc-string.spec.ts b/libs/common/src/platform/models/domain/enc-string.spec.ts index b4916b9f70a..24885b51dd7 100644 --- a/libs/common/src/platform/models/domain/enc-string.spec.ts +++ b/libs/common/src/platform/models/domain/enc-string.spec.ts @@ -1,8 +1,7 @@ import { mock, MockProxy } from "jest-mock-extended"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { makeEncString, makeStaticByteArray } from "../../../../spec"; import { EncryptService } from "../../../platform/abstractions/encrypt.service"; import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; diff --git a/libs/common/src/platform/services/container.service.ts b/libs/common/src/platform/services/container.service.ts index c3e727a2e1e..0a507353ecc 100644 --- a/libs/common/src/platform/services/container.service.ts +++ b/libs/common/src/platform/services/container.service.ts @@ -1,6 +1,5 @@ -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { EncryptService } from "../abstractions/encrypt.service"; export class ContainerService { diff --git a/libs/common/src/platform/services/user-auto-unlock-key.service.spec.ts b/libs/common/src/platform/services/user-auto-unlock-key.service.spec.ts index 16b3968045a..84511d1e71a 100644 --- a/libs/common/src/platform/services/user-auto-unlock-key.service.spec.ts +++ b/libs/common/src/platform/services/user-auto-unlock-key.service.spec.ts @@ -1,8 +1,7 @@ import { mock } from "jest-mock-extended"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { DefaultKeyService } from "../../../../key-management/src/key.service"; +import { DefaultKeyService } from "@bitwarden/key-management"; + import { CsprngArray } from "../../types/csprng"; import { UserId } from "../../types/guid"; import { UserKey } from "../../types/key"; diff --git a/libs/common/src/platform/services/user-auto-unlock-key.service.ts b/libs/common/src/platform/services/user-auto-unlock-key.service.ts index a8947a49f45..bf64c13b060 100644 --- a/libs/common/src/platform/services/user-auto-unlock-key.service.ts +++ b/libs/common/src/platform/services/user-auto-unlock-key.service.ts @@ -1,6 +1,5 @@ -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { UserId } from "../../types/guid"; import { KeySuffixOptions } from "../enums"; diff --git a/libs/common/src/platform/sync/default-sync.service.ts b/libs/common/src/platform/sync/default-sync.service.ts index 138c7c03318..99560434e22 100644 --- a/libs/common/src/platform/sync/default-sync.service.ts +++ b/libs/common/src/platform/sync/default-sync.service.ts @@ -7,6 +7,7 @@ import { CollectionData, CollectionDetailsResponse, } from "@bitwarden/admin-console/common"; +import { KeyService } from "@bitwarden/key-management"; // FIXME: remove `src` and fix import // eslint-disable-next-line no-restricted-imports @@ -14,9 +15,6 @@ import { UserDecryptionOptionsServiceAbstraction } from "../../../../auth/src/co // FIXME: remove `src` and fix import // eslint-disable-next-line no-restricted-imports import { LogoutReason } from "../../../../auth/src/common/types"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { ApiService } from "../../abstractions/api.service"; import { InternalOrganizationServiceAbstraction } from "../../admin-console/abstractions/organization/organization.service.abstraction"; import { InternalPolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction"; diff --git a/libs/common/src/services/vault-timeout/vault-timeout-settings.service.spec.ts b/libs/common/src/services/vault-timeout/vault-timeout-settings.service.spec.ts index 4168baf1383..b7894ad6423 100644 --- a/libs/common/src/services/vault-timeout/vault-timeout-settings.service.spec.ts +++ b/libs/common/src/services/vault-timeout/vault-timeout-settings.service.spec.ts @@ -8,11 +8,8 @@ import { } from "@bitwarden/auth/common"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { UserId } from "@bitwarden/common/types/guid"; -import { BiometricStateService } from "@bitwarden/key-management"; +import { BiometricStateService, KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { FakeAccountService, mockAccountServiceWith, FakeStateProvider } from "../../../spec"; import { VaultTimeoutSettingsService as VaultTimeoutSettingsServiceAbstraction } from "../../abstractions/vault-timeout/vault-timeout-settings.service"; import { PolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction"; diff --git a/libs/common/src/services/vault-timeout/vault-timeout-settings.service.ts b/libs/common/src/services/vault-timeout/vault-timeout-settings.service.ts index ffc8b6e0144..813f187043b 100644 --- a/libs/common/src/services/vault-timeout/vault-timeout-settings.service.ts +++ b/libs/common/src/services/vault-timeout/vault-timeout-settings.service.ts @@ -19,11 +19,8 @@ import { PinServiceAbstraction, UserDecryptionOptionsServiceAbstraction, } from "@bitwarden/auth/common"; -import { BiometricStateService } from "@bitwarden/key-management"; +import { BiometricStateService, KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { VaultTimeoutSettingsService as VaultTimeoutSettingsServiceAbstraction } from "../../abstractions/vault-timeout/vault-timeout-settings.service"; import { PolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyType } from "../../admin-console/enums"; diff --git a/libs/common/src/vault/models/domain/attachment.spec.ts b/libs/common/src/vault/models/domain/attachment.spec.ts index 8cae7170738..d6588d9acb1 100644 --- a/libs/common/src/vault/models/domain/attachment.spec.ts +++ b/libs/common/src/vault/models/domain/attachment.spec.ts @@ -1,8 +1,7 @@ import { mock, MockProxy } from "jest-mock-extended"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { makeStaticByteArray, mockEnc, mockFromJson } from "../../../../spec"; import { EncryptService } from "../../../platform/abstractions/encrypt.service"; import { EncryptedString, EncString } from "../../../platform/models/domain/enc-string"; diff --git a/libs/common/src/vault/models/domain/cipher.spec.ts b/libs/common/src/vault/models/domain/cipher.spec.ts index 64df3204aca..7682fe60821 100644 --- a/libs/common/src/vault/models/domain/cipher.spec.ts +++ b/libs/common/src/vault/models/domain/cipher.spec.ts @@ -2,10 +2,8 @@ import { mock } from "jest-mock-extended"; import { Jsonify } from "type-fest"; import { UserId } from "@bitwarden/common/types/guid"; +import { KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../../key-management/src/abstractions/key.service"; import { makeStaticByteArray, mockEnc, mockFromJson } from "../../../../spec/utils"; import { UriMatchStrategy } from "../../../models/domain/domain-service"; import { EncryptService } from "../../../platform/abstractions/encrypt.service"; diff --git a/libs/common/src/vault/services/cipher.service.spec.ts b/libs/common/src/vault/services/cipher.service.spec.ts index 8ab6a2d3d34..0126562e2bd 100644 --- a/libs/common/src/vault/services/cipher.service.spec.ts +++ b/libs/common/src/vault/services/cipher.service.spec.ts @@ -2,13 +2,8 @@ import { mock } from "jest-mock-extended"; import { BehaviorSubject, map, of } from "rxjs"; import { BulkEncryptService } from "@bitwarden/common/platform/abstractions/bulk-encrypt.service"; +import { CipherDecryptionKeys, KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { - CipherDecryptionKeys, - KeyService, -} from "../../../../key-management/src/abstractions/key.service"; import { FakeAccountService, mockAccountServiceWith } from "../../../spec/fake-account-service"; import { FakeStateProvider } from "../../../spec/fake-state-provider"; import { makeStaticByteArray } from "../../../spec/utils"; diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index 12712f169a3..8d247565133 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -17,10 +17,8 @@ import { SemVer } from "semver"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { BulkEncryptService } from "@bitwarden/common/platform/abstractions/bulk-encrypt.service"; +import { KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../key-management/src/abstractions/key.service"; import { ApiService } from "../../abstractions/api.service"; import { SearchService } from "../../abstractions/search.service"; import { AutofillSettingsServiceAbstraction } from "../../autofill/services/autofill-settings.service"; diff --git a/libs/common/src/vault/services/folder/folder.service.spec.ts b/libs/common/src/vault/services/folder/folder.service.spec.ts index 9fdb4327b98..24690ebe408 100644 --- a/libs/common/src/vault/services/folder/folder.service.spec.ts +++ b/libs/common/src/vault/services/folder/folder.service.spec.ts @@ -1,9 +1,8 @@ import { mock, MockProxy } from "jest-mock-extended"; import { BehaviorSubject, firstValueFrom } from "rxjs"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../../key-management/src/abstractions/key.service"; +import { KeyService } from "@bitwarden/key-management"; + import { makeEncString } from "../../../../spec"; import { FakeAccountService, mockAccountServiceWith } from "../../../../spec/fake-account-service"; import { FakeSingleUserState } from "../../../../spec/fake-state"; diff --git a/libs/common/src/vault/services/folder/folder.service.ts b/libs/common/src/vault/services/folder/folder.service.ts index fe77806877d..006eb66de50 100644 --- a/libs/common/src/vault/services/folder/folder.service.ts +++ b/libs/common/src/vault/services/folder/folder.service.ts @@ -4,10 +4,8 @@ import { Observable, Subject, firstValueFrom, map, shareReplay, switchMap, merge import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { KeyService } from "@bitwarden/key-management"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyService } from "../../../../../key-management/src/abstractions/key.service"; import { I18nService } from "../../../platform/abstractions/i18n.service"; import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key"; import { StateProvider } from "../../../platform/state"; diff --git a/libs/key-management/src/abstractions/key.service.ts b/libs/key-management/src/abstractions/key.service.ts index da59c2986b2..3cd9a0dbb21 100644 --- a/libs/key-management/src/abstractions/key.service.ts +++ b/libs/key-management/src/abstractions/key.service.ts @@ -3,31 +3,13 @@ import { Observable } from "rxjs"; import { EncryptedOrganizationKeyData } from "@bitwarden/common/admin-console/models/data/encrypted-organization-key.data"; -import { KdfConfig } from "@bitwarden/key-management"; - -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ProfileOrganizationResponse } from "../../../common/src/admin-console/models/response/profile-organization.response"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ProfileProviderOrganizationResponse } from "../../../common/src/admin-console/models/response/profile-provider-organization.response"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ProfileProviderResponse } from "../../../common/src/admin-console/models/response/profile-provider.response"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeySuffixOptions, HashPurpose } from "../../../common/src/platform/enums"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncryptedString, EncString } from "../../../common/src/platform/models/domain/enc-string"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { SymmetricCryptoKey } from "../../../common/src/platform/models/domain/symmetric-crypto-key"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { OrganizationId, UserId } from "../../../common/src/types/guid"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports +import { ProfileOrganizationResponse } from "@bitwarden/common/admin-console/models/response/profile-organization.response"; +import { ProfileProviderOrganizationResponse } from "@bitwarden/common/admin-console/models/response/profile-provider-organization.response"; +import { ProfileProviderResponse } from "@bitwarden/common/admin-console/models/response/profile-provider.response"; +import { KeySuffixOptions, HashPurpose } from "@bitwarden/common/platform/enums"; +import { EncryptedString, EncString } from "@bitwarden/common/platform/models/domain/enc-string"; +import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; +import { OrganizationId, UserId } from "@bitwarden/common/types/guid"; import { UserKey, MasterKey, @@ -36,7 +18,9 @@ import { CipherKey, UserPrivateKey, UserPublicKey, -} from "../../../common/src/types/key"; +} from "@bitwarden/common/types/key"; + +import { KdfConfig } from "../models/kdf-config"; export class UserPrivateKeyDecryptionFailedError extends Error { constructor() { diff --git a/libs/key-management/src/biometrics/biometric-state.service.spec.ts b/libs/key-management/src/biometrics/biometric-state.service.spec.ts index 2f11537127b..c6512b34735 100644 --- a/libs/key-management/src/biometrics/biometric-state.service.spec.ts +++ b/libs/key-management/src/biometrics/biometric-state.service.spec.ts @@ -1,15 +1,16 @@ import { firstValueFrom } from "rxjs"; import { EncryptedString } from "@bitwarden/common/platform/models/domain/enc-string"; -import { UserId } from "@bitwarden/common/types/guid"; - -import { makeEncString, trackEmissions } from "../../../common/spec"; import { FakeAccountService, mockAccountServiceWith, -} from "../../../common/spec/fake-account-service"; -import { FakeGlobalState, FakeSingleUserState } from "../../../common/spec/fake-state"; -import { FakeStateProvider } from "../../../common/spec/fake-state-provider"; + makeEncString, + trackEmissions, + FakeGlobalState, + FakeSingleUserState, + FakeStateProvider, +} from "@bitwarden/common/spec"; +import { UserId } from "@bitwarden/common/types/guid"; import { BiometricStateService, DefaultBiometricStateService } from "./biometric-state.service"; import { diff --git a/libs/key-management/src/biometrics/biometric-state.service.ts b/libs/key-management/src/biometrics/biometric-state.service.ts index ae6e52ce632..479b87a5b77 100644 --- a/libs/key-management/src/biometrics/biometric-state.service.ts +++ b/libs/key-management/src/biometrics/biometric-state.service.ts @@ -2,15 +2,9 @@ // @ts-strict-ignore import { Observable, firstValueFrom, map, combineLatest } from "rxjs"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncryptedString, EncString } from "../../../common/src/platform/models/domain/enc-string"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ActiveUserState, GlobalState, StateProvider } from "../../../common/src/platform/state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { UserId } from "../../../common/src/types/guid"; +import { EncryptedString, EncString } from "@bitwarden/common/platform/models/domain/enc-string"; +import { ActiveUserState, GlobalState, StateProvider } from "@bitwarden/common/platform/state"; +import { UserId } from "@bitwarden/common/types/guid"; import { BIOMETRIC_UNLOCK_ENABLED, diff --git a/libs/key-management/src/biometrics/biometric.state.ts b/libs/key-management/src/biometrics/biometric.state.ts index e5ea4fbae3b..277d35c176e 100644 --- a/libs/key-management/src/biometrics/biometric.state.ts +++ b/libs/key-management/src/biometrics/biometric.state.ts @@ -1,16 +1,10 @@ -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncryptedString } from "../../../common/src/platform/models/domain/enc-string"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports +import { EncryptedString } from "@bitwarden/common/platform/models/domain/enc-string"; import { KeyDefinition, BIOMETRIC_SETTINGS_DISK, UserKeyDefinition, -} from "../../../common/src/platform/state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { UserId } from "../../../common/src/types/guid"; +} from "@bitwarden/common/platform/state"; +import { UserId } from "@bitwarden/common/types/guid"; /** * Indicates whether the user elected to store a biometric key to unlock their vault. diff --git a/libs/key-management/src/index.ts b/libs/key-management/src/index.ts index cd90e78bbfb..b5ee03b6490 100644 --- a/libs/key-management/src/index.ts +++ b/libs/key-management/src/index.ts @@ -7,7 +7,7 @@ export { BiometricsCommands } from "./biometrics/biometrics-commands"; export { BiometricsService } from "./biometrics/biometric.service"; export * from "./biometrics/biometric.state"; -export { KeyService } from "./abstractions/key.service"; +export { KeyService, CipherDecryptionKeys } from "./abstractions/key.service"; export { DefaultKeyService } from "./key.service"; export { UserKeyRotationDataProvider } from "./abstractions/user-key-rotation-data-provider.abstraction"; export { diff --git a/libs/key-management/src/kdf-config.service.spec.ts b/libs/key-management/src/kdf-config.service.spec.ts index 76a13fe10fc..398ac0fb4e2 100644 --- a/libs/key-management/src/kdf-config.service.spec.ts +++ b/libs/key-management/src/kdf-config.service.spec.ts @@ -1,15 +1,10 @@ +import { Utils } from "@bitwarden/common/platform/misc/utils"; import { FakeAccountService, FakeStateProvider, mockAccountServiceWith, } from "@bitwarden/common/spec"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { UserId } from "@bitwarden/common/src/types/guid"; - -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { Utils } from "../../common/src/platform/misc/utils"; +import { UserId } from "@bitwarden/common/types/guid"; import { DefaultKdfConfigService } from "./kdf-config.service"; import { Argon2KdfConfig, PBKDF2KdfConfig } from "./models/kdf-config"; diff --git a/libs/key-management/src/kdf-config.service.ts b/libs/key-management/src/kdf-config.service.ts index f0c964c5d2e..a0c3089d2bc 100644 --- a/libs/key-management/src/kdf-config.service.ts +++ b/libs/key-management/src/kdf-config.service.ts @@ -2,13 +2,12 @@ // @ts-strict-ignore import { firstValueFrom, Observable } from "rxjs"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { UserId } from "@bitwarden/common/src/types/guid"; - -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KDF_CONFIG_DISK, StateProvider, UserKeyDefinition } from "../../common/src/platform/state"; +import { + KDF_CONFIG_DISK, + StateProvider, + UserKeyDefinition, +} from "@bitwarden/common/platform/state"; +import { UserId } from "@bitwarden/common/types/guid"; import { KdfConfigService } from "./abstractions/kdf-config.service"; import { KdfType } from "./enums/kdf-type.enum"; diff --git a/libs/key-management/src/key.service.spec.ts b/libs/key-management/src/key.service.spec.ts index 62cdce230ea..e22c7fa3430 100644 --- a/libs/key-management/src/key.service.spec.ts +++ b/libs/key-management/src/key.service.spec.ts @@ -1,84 +1,43 @@ import { mock } from "jest-mock-extended"; import { bufferCount, firstValueFrom, lastValueFrom, of, take, tap } from "rxjs"; +import { PinServiceAbstraction } from "@bitwarden/auth/common"; import { EncryptedOrganizationKeyData } from "@bitwarden/common/admin-console/models/data/encrypted-organization-key.data"; - -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { PinServiceAbstraction } from "../../auth/src/common/abstractions"; +import { FakeMasterPasswordService } from "@bitwarden/common/auth/services/master-password/fake-master-password.service"; +import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; +import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; +import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; +import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { Encrypted } from "@bitwarden/common/platform/interfaces/encrypted"; +import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { EncString, EncryptedString } from "@bitwarden/common/platform/models/domain/enc-string"; +import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; +import { USER_ENCRYPTED_ORGANIZATION_KEYS } from "@bitwarden/common/platform/services/key-state/org-keys.state"; +import { USER_ENCRYPTED_PROVIDER_KEYS } from "@bitwarden/common/platform/services/key-state/provider-keys.state"; +import { + USER_ENCRYPTED_PRIVATE_KEY, + USER_EVER_HAD_USER_KEY, + USER_KEY, +} from "@bitwarden/common/platform/services/key-state/user-key.state"; +import { UserKeyDefinition } from "@bitwarden/common/platform/state"; +import { VAULT_TIMEOUT } from "@bitwarden/common/services/vault-timeout/vault-timeout-settings.state"; import { awaitAsync, makeEncString, makeStaticByteArray, makeSymmetricCryptoKey, -} from "../../common/spec"; -import { FakeAccountService, mockAccountServiceWith } from "../../common/spec/fake-account-service"; -import { FakeActiveUserState, FakeSingleUserState } from "../../common/spec/fake-state"; -import { FakeStateProvider } from "../../common/spec/fake-state-provider"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { FakeMasterPasswordService } from "../../common/src/auth/services/master-password/fake-master-password.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { CryptoFunctionService } from "../../common/src/platform/abstractions/crypto-function.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncryptService } from "../../common/src/platform/abstractions/encrypt.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyGenerationService } from "../../common/src/platform/abstractions/key-generation.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { LogService } from "../../common/src/platform/abstractions/log.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { PlatformUtilsService } from "../../common/src/platform/abstractions/platform-utils.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { StateService } from "../../common/src/platform/abstractions/state.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { Encrypted } from "../../common/src/platform/interfaces/encrypted"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { Utils } from "../../common/src/platform/misc/utils"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncString, EncryptedString } from "../../common/src/platform/models/domain/enc-string"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { SymmetricCryptoKey } from "../../common/src/platform/models/domain/symmetric-crypto-key"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { USER_ENCRYPTED_ORGANIZATION_KEYS } from "../../common/src/platform/services/key-state/org-keys.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { USER_ENCRYPTED_PROVIDER_KEYS } from "../../common/src/platform/services/key-state/provider-keys.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { - USER_ENCRYPTED_PRIVATE_KEY, - USER_EVER_HAD_USER_KEY, - USER_KEY, -} from "../../common/src/platform/services/key-state/user-key.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { UserKeyDefinition } from "../../common/src/platform/state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { VAULT_TIMEOUT } from "../../common/src/services/vault-timeout/vault-timeout-settings.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { CsprngArray } from "../../common/src/types/csprng"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { OrganizationId, UserId } from "../../common/src/types/guid"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { UserKey, MasterKey } from "../../common/src/types/key"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { VaultTimeoutStringType } from "../../common/src/types/vault-timeout.type"; + FakeAccountService, + mockAccountServiceWith, + FakeStateProvider, + FakeActiveUserState, + FakeSingleUserState, +} from "@bitwarden/common/spec"; +import { CsprngArray } from "@bitwarden/common/types/csprng"; +import { OrganizationId, UserId } from "@bitwarden/common/types/guid"; +import { UserKey, MasterKey } from "@bitwarden/common/types/key"; +import { VaultTimeoutStringType } from "@bitwarden/common/types/vault-timeout.type"; import { KdfConfigService } from "./abstractions/kdf-config.service"; import { UserPrivateKeyDecryptionFailedError } from "./abstractions/key.service"; diff --git a/libs/key-management/src/key.service.ts b/libs/key-management/src/key.service.ts index 5425dbc53f9..682cf9846d0 100644 --- a/libs/key-management/src/key.service.ts +++ b/libs/key-management/src/key.service.ts @@ -12,93 +12,37 @@ import { switchMap, } from "rxjs"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { PinServiceAbstraction } from "../../auth/src/common/abstractions"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncryptedOrganizationKeyData } from "../../common/src/admin-console/models/data/encrypted-organization-key.data"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { BaseEncryptedOrganizationKey } from "../../common/src/admin-console/models/domain/encrypted-organization-key"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ProfileOrganizationResponse } from "../../common/src/admin-console/models/response/profile-organization.response"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ProfileProviderOrganizationResponse } from "../../common/src/admin-console/models/response/profile-provider-organization.response"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ProfileProviderResponse } from "../../common/src/admin-console/models/response/profile-provider.response"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { AccountService } from "../../common/src/auth/abstractions/account.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { InternalMasterPasswordServiceAbstraction } from "../../common/src/auth/abstractions/master-password.service.abstraction"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { CryptoFunctionService } from "../../common/src/platform/abstractions/crypto-function.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncryptService } from "../../common/src/platform/abstractions/encrypt.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeyGenerationService } from "../../common/src/platform/abstractions/key-generation.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { LogService } from "../../common/src/platform/abstractions/log.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { PlatformUtilsService } from "../../common/src/platform/abstractions/platform-utils.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { StateService } from "../../common/src/platform/abstractions/state.service"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { KeySuffixOptions, HashPurpose } from "../../common/src/platform/enums"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { convertValues } from "../../common/src/platform/misc/convert-values"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { Utils } from "../../common/src/platform/misc/utils"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EFFLongWordList } from "../../common/src/platform/misc/wordlist"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { EncString, EncryptedString } from "../../common/src/platform/models/domain/enc-string"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { SymmetricCryptoKey } from "../../common/src/platform/models/domain/symmetric-crypto-key"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { USER_ENCRYPTED_ORGANIZATION_KEYS } from "../../common/src/platform/services/key-state/org-keys.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { USER_ENCRYPTED_PROVIDER_KEYS } from "../../common/src/platform/services/key-state/provider-keys.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports +import { PinServiceAbstraction } from "@bitwarden/auth/common"; +import { EncryptedOrganizationKeyData } from "@bitwarden/common/admin-console/models/data/encrypted-organization-key.data"; +import { BaseEncryptedOrganizationKey } from "@bitwarden/common/admin-console/models/domain/encrypted-organization-key"; +import { ProfileOrganizationResponse } from "@bitwarden/common/admin-console/models/response/profile-organization.response"; +import { ProfileProviderOrganizationResponse } from "@bitwarden/common/admin-console/models/response/profile-provider-organization.response"; +import { ProfileProviderResponse } from "@bitwarden/common/admin-console/models/response/profile-provider.response"; +import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; +import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction"; +import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service"; +import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; +import { KeyGenerationService } from "@bitwarden/common/platform/abstractions/key-generation.service"; +import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; +import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; +import { KeySuffixOptions, HashPurpose } from "@bitwarden/common/platform/enums"; +import { convertValues } from "@bitwarden/common/platform/misc/convert-values"; +import { Utils } from "@bitwarden/common/platform/misc/utils"; +import { EFFLongWordList } from "@bitwarden/common/platform/misc/wordlist"; +import { EncString, EncryptedString } from "@bitwarden/common/platform/models/domain/enc-string"; +import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; +import { USER_ENCRYPTED_ORGANIZATION_KEYS } from "@bitwarden/common/platform/services/key-state/org-keys.state"; +import { USER_ENCRYPTED_PROVIDER_KEYS } from "@bitwarden/common/platform/services/key-state/provider-keys.state"; import { USER_ENCRYPTED_PRIVATE_KEY, USER_EVER_HAD_USER_KEY, USER_KEY, -} from "../../common/src/platform/services/key-state/user-key.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { ActiveUserState, StateProvider } from "../../common/src/platform/state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { VAULT_TIMEOUT } from "../../common/src/services/vault-timeout/vault-timeout-settings.state"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { CsprngArray } from "../../common/src/types/csprng"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { OrganizationId, ProviderId, UserId } from "../../common/src/types/guid"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports +} from "@bitwarden/common/platform/services/key-state/user-key.state"; +import { ActiveUserState, StateProvider } from "@bitwarden/common/platform/state"; +import { VAULT_TIMEOUT } from "@bitwarden/common/services/vault-timeout/vault-timeout-settings.state"; +import { CsprngArray } from "@bitwarden/common/types/csprng"; +import { OrganizationId, ProviderId, UserId } from "@bitwarden/common/types/guid"; import { OrgKey, UserKey, @@ -107,10 +51,8 @@ import { CipherKey, UserPrivateKey, UserPublicKey, -} from "../../common/src/types/key"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { VaultTimeoutStringType } from "../../common/src/types/vault-timeout.type"; +} from "@bitwarden/common/types/key"; +import { VaultTimeoutStringType } from "@bitwarden/common/types/vault-timeout.type"; import { KdfConfigService } from "./abstractions/kdf-config.service"; import { diff --git a/libs/key-management/src/models/kdf-config.ts b/libs/key-management/src/models/kdf-config.ts index fe9c0de255c..689da77c163 100644 --- a/libs/key-management/src/models/kdf-config.ts +++ b/libs/key-management/src/models/kdf-config.ts @@ -1,8 +1,7 @@ import { Jsonify } from "type-fest"; -// FIXME: remove `src` and fix import -// eslint-disable-next-line no-restricted-imports -import { RangeWithDefault } from "../../../common/src/platform/misc/range-with-default"; +import { RangeWithDefault } from "@bitwarden/common/platform/misc/range-with-default"; + import { KdfType } from "../enums/kdf-type.enum"; /**