Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-16926] Fix KM bad imports #12807

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions libs/common/src/auth/services/auth.service.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
5 changes: 2 additions & 3 deletions libs/common/src/auth/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 2 additions & 3 deletions libs/common/src/auth/services/key-connector.service.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 2 additions & 3 deletions libs/common/src/platform/misc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
5 changes: 2 additions & 3 deletions libs/common/src/platform/models/domain/enc-string.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
5 changes: 2 additions & 3 deletions libs/common/src/platform/services/container.service.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 1 addition & 3 deletions libs/common/src/platform/sync/default-sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ 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
import { UserDecryptionOptionsServiceAbstraction } from "../../../../auth/src/common/abstractions";
// 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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 2 additions & 3 deletions libs/common/src/vault/models/domain/attachment.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 1 addition & 3 deletions libs/common/src/vault/models/domain/cipher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
7 changes: 1 addition & 6 deletions libs/common/src/vault/services/cipher.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 1 addition & 3 deletions libs/common/src/vault/services/cipher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 1 addition & 3 deletions libs/common/src/vault/services/folder/folder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
36 changes: 10 additions & 26 deletions libs/key-management/src/abstractions/key.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
12 changes: 3 additions & 9 deletions libs/key-management/src/biometrics/biometric-state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 3 additions & 9 deletions libs/key-management/src/biometrics/biometric.state.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Loading
Loading