mirror of
https://github.com/bitwarden/jslib
synced 2025-12-22 19:23:24 +00:00
Remove folder service from importers as it's no longer needed
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
|
||||
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { BitwardenJsonImporter } from "jslib-common/importers/bitwardenJsonImporter";
|
||||
|
||||
@@ -11,14 +10,12 @@ describe("bitwarden json importer", () => {
|
||||
let sut: BitwardenJsonImporter;
|
||||
let cryptoService: SubstituteOf<CryptoService>;
|
||||
let i18nService: SubstituteOf<I18nService>;
|
||||
let folderService: SubstituteOf<FolderService>;
|
||||
|
||||
beforeEach(() => {
|
||||
cryptoService = Substitute.for<CryptoService>();
|
||||
i18nService = Substitute.for<I18nService>();
|
||||
folderService = Substitute.for<FolderService>();
|
||||
|
||||
sut = new BitwardenJsonImporter(cryptoService, i18nService, folderService);
|
||||
sut = new BitwardenJsonImporter(cryptoService, i18nService);
|
||||
});
|
||||
|
||||
it("should fail if password is needed", async () => {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import Substitute, { Arg, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
|
||||
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { KdfType } from "jslib-common/enums/kdfType";
|
||||
import { BitwardenPasswordProtectedImporter } from "jslib-common/importers/bitwardenPasswordProtectedImporter";
|
||||
@@ -14,7 +13,6 @@ describe("BitwardenPasswordProtectedImporter", () => {
|
||||
let importer: BitwardenPasswordProtectedImporter;
|
||||
let cryptoService: SubstituteOf<CryptoService>;
|
||||
let i18nService: SubstituteOf<I18nService>;
|
||||
let folderService: SubstituteOf<FolderService>;
|
||||
const password = Utils.newGuid();
|
||||
const result = new ImportResult();
|
||||
let jDoc: {
|
||||
@@ -30,7 +28,6 @@ describe("BitwardenPasswordProtectedImporter", () => {
|
||||
beforeEach(() => {
|
||||
cryptoService = Substitute.for<CryptoService>();
|
||||
i18nService = Substitute.for<I18nService>();
|
||||
folderService = Substitute.for<FolderService>();
|
||||
|
||||
jDoc = {
|
||||
encrypted: true,
|
||||
@@ -43,12 +40,7 @@ describe("BitwardenPasswordProtectedImporter", () => {
|
||||
};
|
||||
|
||||
result.success = true;
|
||||
importer = new BitwardenPasswordProtectedImporter(
|
||||
cryptoService,
|
||||
i18nService,
|
||||
folderService,
|
||||
password
|
||||
);
|
||||
importer = new BitwardenPasswordProtectedImporter(cryptoService, i18nService, password);
|
||||
});
|
||||
|
||||
describe("Required Json Data", () => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
import { FolderView } from "jslib-common/models/view/folderView";
|
||||
|
||||
import { CryptoService } from "../abstractions/crypto.service";
|
||||
@@ -16,11 +15,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
private results: any;
|
||||
private result: ImportResult;
|
||||
|
||||
constructor(
|
||||
protected cryptoService: CryptoService,
|
||||
protected i18nService: I18nService,
|
||||
private folderService: FolderService
|
||||
) {
|
||||
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||
|
||||
import { CryptoService } from "../abstractions/crypto.service";
|
||||
import { I18nService } from "../abstractions/i18n.service";
|
||||
import { KdfType } from "../enums/kdfType";
|
||||
@@ -23,13 +21,8 @@ interface BitwardenPasswordProtectedFileFormat {
|
||||
export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter implements Importer {
|
||||
private key: SymmetricCryptoKey;
|
||||
|
||||
constructor(
|
||||
cryptoService: CryptoService,
|
||||
i18nService: I18nService,
|
||||
folderService: FolderService,
|
||||
private password: string
|
||||
) {
|
||||
super(cryptoService, i18nService, folderService);
|
||||
constructor(cryptoService: CryptoService, i18nService: I18nService, private password: string) {
|
||||
super(cryptoService, i18nService);
|
||||
}
|
||||
|
||||
async parse(data: string): Promise<ImportResult> {
|
||||
|
||||
@@ -163,12 +163,11 @@ export class ImportService implements ImportServiceAbstraction {
|
||||
case "bitwardencsv":
|
||||
return new BitwardenCsvImporter();
|
||||
case "bitwardenjson":
|
||||
return new BitwardenJsonImporter(this.cryptoService, this.i18nService, this.folderService);
|
||||
return new BitwardenJsonImporter(this.cryptoService, this.i18nService);
|
||||
case "bitwardenpasswordprotected":
|
||||
return new BitwardenPasswordProtectedImporter(
|
||||
this.cryptoService,
|
||||
this.i18nService,
|
||||
this.folderService,
|
||||
password
|
||||
);
|
||||
case "lastpasscsv":
|
||||
|
||||
Reference in New Issue
Block a user