update import paths
This commit is contained in:
parent
186c91390a
commit
8c7f3fc07e
|
@ -1,5 +1,6 @@
|
|||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||
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";
|
||||
|
@ -19,8 +20,6 @@ import { CsprngString } from "@bitwarden/common/types/csprng";
|
|||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { UserKey, MasterKey } from "@bitwarden/common/types/key";
|
||||
|
||||
import { PinServiceAbstraction } from "../../../../../libs/auth/src/common/abstractions";
|
||||
|
||||
export class ElectronCryptoService extends CryptoService {
|
||||
constructor(
|
||||
pinService: PinServiceAbstraction,
|
||||
|
|
|
@ -190,6 +190,44 @@ export class PinService implements PinServiceAbstraction {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user's `pinKeyEncryptedUserKey` and `oldPinKeyEncryptedMasterKey` (if one exists) based
|
||||
* on the user's PinLockType.
|
||||
* @remarks The `oldPinKeyEncryptedMasterKey` (also known as `pinProtected`) is only used for
|
||||
* migrating old PinKeys and will be null for all migrated accounts
|
||||
* @throws If PinLockType is 'DISABLED'
|
||||
*/
|
||||
private async getPinKeyEncryptedKeys(
|
||||
pinLockType: PinLockType,
|
||||
): Promise<{ pinKeyEncryptedUserKey: EncString; oldPinKeyEncryptedMasterKey?: EncString }> {
|
||||
switch (pinLockType) {
|
||||
case "PERSISTANT": {
|
||||
const pinKeyEncryptedUserKey = await this.getPinKeyEncryptedUserKey();
|
||||
const oldPinKeyEncryptedMasterKey = await this.stateService.getEncryptedPinProtected();
|
||||
|
||||
return {
|
||||
pinKeyEncryptedUserKey,
|
||||
oldPinKeyEncryptedMasterKey: oldPinKeyEncryptedMasterKey
|
||||
? new EncString(oldPinKeyEncryptedMasterKey)
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
case "TRANSIENT": {
|
||||
const pinKeyEncryptedUserKey = await this.getPinKeyEncryptedUserKeyEphemeral();
|
||||
const oldPinKeyEncryptedMasterKey = await this.stateService.getDecryptedPinProtected();
|
||||
|
||||
return { pinKeyEncryptedUserKey, oldPinKeyEncryptedMasterKey };
|
||||
}
|
||||
case "DISABLED":
|
||||
throw new Error("Pin is disabled");
|
||||
default: {
|
||||
// Compile-time check for exhaustive switch
|
||||
const _exhaustiveCheck: never = pinLockType;
|
||||
return _exhaustiveCheck;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async decryptAndMigrateOldPinKey(
|
||||
masterPasswordOnRestart: boolean,
|
||||
pin: string,
|
||||
|
@ -259,37 +297,6 @@ export class PinService implements PinServiceAbstraction {
|
|||
return new SymmetricCryptoKey(masterKey) as MasterKey;
|
||||
}
|
||||
|
||||
// Note: oldPinKeyEncryptedMasterKey (aka "pinProtected") is only used for migrating old pin keys
|
||||
// and will be null for all migrated accounts
|
||||
private async getPinKeyEncryptedKeys(
|
||||
pinLockType: PinLockType,
|
||||
): Promise<{ pinKeyEncryptedUserKey: EncString; oldPinKeyEncryptedMasterKey?: EncString }> {
|
||||
switch (pinLockType) {
|
||||
case "PERSISTANT": {
|
||||
const pinKeyEncryptedUserKey = await this.getPinKeyEncryptedUserKey();
|
||||
const oldPinKeyEncryptedMasterKey = await this.stateService.getEncryptedPinProtected();
|
||||
return {
|
||||
pinKeyEncryptedUserKey,
|
||||
oldPinKeyEncryptedMasterKey: oldPinKeyEncryptedMasterKey
|
||||
? new EncString(oldPinKeyEncryptedMasterKey)
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
case "TRANSIENT": {
|
||||
const pinKeyEncryptedUserKey = await this.getPinKeyEncryptedUserKeyEphemeral();
|
||||
const oldPinKeyEncryptedMasterKey = await this.stateService.getDecryptedPinProtected();
|
||||
return { pinKeyEncryptedUserKey, oldPinKeyEncryptedMasterKey };
|
||||
}
|
||||
case "DISABLED":
|
||||
throw new Error("Pin is disabled");
|
||||
default: {
|
||||
// Compile-time check for exhaustive switch
|
||||
const _exhaustiveCheck: never = pinLockType;
|
||||
return _exhaustiveCheck;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async decryptUserKey(
|
||||
pin: string,
|
||||
salt: string,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||
import {
|
||||
CipherWithIdExport,
|
||||
CollectionWithIdExport,
|
||||
|
@ -17,7 +18,6 @@ import {
|
|||
BitwardenUnEncryptedOrgJsonExport,
|
||||
} from "@bitwarden/vault-export-core";
|
||||
|
||||
import { PinServiceAbstraction } from "../../../../auth/src/common/abstractions";
|
||||
import { ImportResult } from "../../models/import-result";
|
||||
import { BaseImporter } from "../base-importer";
|
||||
import { Importer } from "../importer";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||
import { KdfConfig } from "@bitwarden/common/auth/models/domain/kdf-config";
|
||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
|
@ -7,7 +8,6 @@ import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/sym
|
|||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { BitwardenPasswordProtectedFileFormat } from "@bitwarden/vault-export-core";
|
||||
|
||||
import { PinServiceAbstraction } from "../../../../auth/src/common/abstractions";
|
||||
import { ImportResult } from "../../models/import-result";
|
||||
import { Importer } from "../importer";
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||
import { ImportCiphersRequest } from "@bitwarden/common/models/request/import-ciphers.request";
|
||||
import { ImportOrganizationCiphersRequest } from "@bitwarden/common/models/request/import-organization-ciphers.request";
|
||||
import { KvpRequest } from "@bitwarden/common/models/request/kvp.request";
|
||||
|
@ -16,7 +17,6 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
|||
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
|
||||
|
||||
import { PinServiceAbstraction } from "../../../auth/src/common/abstractions";
|
||||
import {
|
||||
AscendoCsvImporter,
|
||||
AvastCsvImporter,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||
import { KdfConfig } from "@bitwarden/common/auth/models/domain/kdf-config";
|
||||
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
|
||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||
|
@ -7,7 +8,6 @@ import { Utils } from "@bitwarden/common/platform/misc/utils";
|
|||
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
|
||||
import { PinServiceAbstraction } from "../../../../../../auth/src/common/abstractions";
|
||||
import { BitwardenCsvExportType, BitwardenPasswordProtectedFileFormat } from "../types";
|
||||
export class BaseVaultExportService {
|
||||
constructor(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as papa from "papaparse";
|
||||
|
||||
import { PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||
import { CipherWithIdExport, FolderWithIdExport } from "@bitwarden/common/models/export";
|
||||
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
|
||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||
|
@ -13,7 +14,6 @@ import { Folder } from "@bitwarden/common/vault/models/domain/folder";
|
|||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
|
||||
|
||||
import { PinServiceAbstraction } from "../../../../../../auth/src/common/abstractions";
|
||||
import {
|
||||
BitwardenCsvIndividualExportType,
|
||||
BitwardenEncryptedIndividualJsonExport,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as papa from "papaparse";
|
||||
|
||||
import { PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { CipherWithIdExport, CollectionWithIdExport } from "@bitwarden/common/models/export";
|
||||
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
|
||||
|
@ -17,7 +18,6 @@ import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/respon
|
|||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||
|
||||
import { PinServiceAbstraction } from "../../../../../../auth/src/common/abstractions";
|
||||
import {
|
||||
BitwardenCsvOrgExportType,
|
||||
BitwardenEncryptedOrgJsonExport,
|
||||
|
|
Loading…
Reference in New Issue