1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-24 16:49:26 +01:00

encrypted import for bitwarden json (#220)

This commit is contained in:
Kyle Spearrin 2020-12-04 21:05:11 -05:00 committed by GitHub
parent 2b8c2c2b3e
commit dcbd09e736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 375 additions and 188 deletions

View File

@ -192,7 +192,7 @@ line2</Value>
describe('KeePass2 Xml Importer', () => {
it('should parse XML data', async () => {
const importer = new Importer();
const result = importer.parse(TestData);
const result = await importer.parse(TestData);
expect(result != null).toBe(true);
});
});

View File

@ -163,7 +163,7 @@ describe('Lastpass CSV Importer', () => {
CipherData.forEach((data) => {
it(data.title, async () => {
const importer = new Importer();
const result = importer.parse(data.csv);
const result = await importer.parse(data.csv);
expect(result != null).toBe(true);
expect(result.ciphers.length).toBeGreaterThan(0);

View File

@ -434,7 +434,7 @@ const IdentityTestData = JSON.stringify({
describe('1Password 1Pif Importer', () => {
it('should parse data', async () => {
const importer = new Importer();
const result = importer.parse(TestData);
const result = await importer.parse(TestData);
expect(result != null).toBe(true);
const cipher = result.ciphers.shift();
@ -447,7 +447,7 @@ describe('1Password 1Pif Importer', () => {
it('should create concealed field as "hidden" type', async () => {
const importer = new Importer();
const result = importer.parse(TestData);
const result = await importer.parse(TestData);
expect(result != null).toBe(true);
const ciphers = result.ciphers;
@ -465,7 +465,7 @@ describe('1Password 1Pif Importer', () => {
it('should create identity records', async () => {
const importer = new Importer();
const result = importer.parse(IdentityTestData);
const result = await importer.parse(IdentityTestData);
expect(result != null).toBe(true);
const cipher = result.ciphers.shift();
expect(cipher.name).toEqual('Test Identity');
@ -488,7 +488,7 @@ describe('1Password 1Pif Importer', () => {
it('should create password history', async () => {
const importer = new Importer();
const result = importer.parse(TestData);
const result = await importer.parse(TestData);
const cipher = result.ciphers.shift();
expect(cipher.passwordHistory.length).toEqual(1);
@ -499,7 +499,7 @@ describe('1Password 1Pif Importer', () => {
it('should create password history from windows opvault 1pif format', async () => {
const importer = new Importer();
const result = importer.parse(WindowsOpVaultTestData);
const result = await importer.parse(WindowsOpVaultTestData);
const cipher = result.ciphers.shift();
expect(cipher.passwordHistory.length).toEqual(5);

View File

@ -6,9 +6,9 @@ import { data as creditCardData } from './testData/onePasswordCsv/creditCard.csv
import { data as identityData } from './testData/onePasswordCsv/identity.csv'
describe('1Password CSV Importer', () => {
it('should parse identity imports', () => {
it('should parse identity imports', async () => {
const importer = new Importer();
const result = importer.parse(identityData);
const result = await importer.parse(identityData);
expect(result).not.toBeNull();
expect(result.success).toBe(true);
@ -29,9 +29,9 @@ describe('1Password CSV Importer', () => {
expect(cipher.notes).toContain('address\ncity state zip\nUnited States');
});
it('should parse credit card imports', () => {
it('should parse credit card imports', async () => {
const importer = new Importer();
const result = importer.parse(creditCardData);
const result = await importer.parse(creditCardData);
expect(result).not.toBeNull();
expect(result.success).toBe(true);

View File

@ -9,5 +9,5 @@ export abstract class ImportService {
regularImportOptions: ImportOption[];
getImportOptions: () => ImportOption[];
import: (importer: Importer, fileContents: string, organizationId?: string) => Promise<Error>;
getImporter: (format: string, organization?: boolean) => Importer;
getImporter: (format: string, organizationId: string) => Importer;
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class AscendoCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -50,6 +50,6 @@ export class AscendoCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class AvastCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -23,6 +23,6 @@ export class AvastCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -7,12 +7,12 @@ import { CipherType } from '../enums/cipherType';
import { SecureNoteType } from '../enums/secureNoteType';
export class AvastJsonImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = JSON.parse(data);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
if (results.logins != null) {
@ -64,6 +64,6 @@ export class AvastJsonImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class AviraCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -31,6 +31,6 @@ export class AviraCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -18,7 +18,7 @@ import { FieldType } from '../enums/fieldType';
import { SecureNoteType } from '../enums/secureNoteType';
export abstract class BaseImporter {
organization = false;
organizationId: string = null;
protected newLineRegex = /(?:\r\n|\r|\n)/;
@ -70,6 +70,10 @@ export abstract class BaseImporter {
skipEmptyLines: false,
}
protected organization() {
return this.organizationId != null;
}
protected parseXml(data: string): Document {
const parser = new DOMParser();
const doc = parser.parseFromString(data, 'application/xml');

View File

@ -15,12 +15,12 @@ import { FieldType } from '../enums/fieldType';
import { SecureNoteType } from '../enums/secureNoteType';
export class BitwardenCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -105,6 +105,6 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -8,37 +8,106 @@ import { CollectionWithId } from '../models/export/collectionWithId';
import { FolderWithId } from '../models/export/folderWithId';
export class BitwardenJsonImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
const result = new ImportResult();
const results = JSON.parse(data);
if (results == null || results.items == null || results.items.length === 0) {
result.success = false;
return result;
private results: any;
private result: ImportResult;
async parse(data: string): Promise<ImportResult> {
this.result = new ImportResult();
this.results = JSON.parse(data);
if (this.results == null || this.results.items == null || this.results.items.length === 0) {
this.result.success = false;
return this.result;
}
if (this.results.encrypted) {
await this.parseEncrypted();
} else {
this.parseDecrypted();
}
this.result.success = true;
return this.result;
}
private async parseEncrypted() {
const groupingsMap = new Map<string, number>();
if (this.organization && results.collections != null) {
results.collections.forEach((c: CollectionWithId) => {
if (this.organization && this.results.collections != null) {
for (const c of this.results.collections as CollectionWithId[]) {
const collection = CollectionWithId.toDomain(c);
if (collection != null) {
collection.id = null;
collection.organizationId = this.organizationId;
const view = await collection.decrypt();
groupingsMap.set(c.id, this.result.collections.length);
this.result.collections.push(view);
}
}
} else if (!this.organization && this.results.folders != null) {
for (const f of this.results.folders as FolderWithId[]) {
const folder = FolderWithId.toDomain(f);
if (folder != null) {
folder.id = null;
const view = await folder.decrypt();
groupingsMap.set(f.id, this.result.folders.length);
this.result.folders.push(view);
}
}
}
for (const c of this.results.items as CipherWithIds[]) {
const cipher = CipherWithIds.toDomain(c);
// reset ids incase they were set for some reason
cipher.id = null;
cipher.folderId = null;
cipher.organizationId = this.organizationId;
cipher.collectionIds = null;
// make sure password history is limited
if (cipher.passwordHistory != null && cipher.passwordHistory.length > 5) {
cipher.passwordHistory = cipher.passwordHistory.slice(0, 5);
}
if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) {
this.result.folderRelationships.push([this.result.ciphers.length, groupingsMap.get(c.folderId)]);
} else if (this.organization && c.collectionIds != null) {
c.collectionIds.forEach((cId) => {
if (groupingsMap.has(cId)) {
this.result.collectionRelationships.push([this.result.ciphers.length, groupingsMap.get(cId)]);
}
});
}
const view = await cipher.decrypt();
this.cleanupCipher(view);
this.result.ciphers.push(view);
}
}
private parseDecrypted() {
const groupingsMap = new Map<string, number>();
if (this.organization && this.results.collections != null) {
this.results.collections.forEach((c: CollectionWithId) => {
const collection = CollectionWithId.toView(c);
if (collection != null) {
collection.id = null;
collection.organizationId = null;
groupingsMap.set(c.id, result.collections.length);
result.collections.push(collection);
groupingsMap.set(c.id, this.result.collections.length);
this.result.collections.push(collection);
}
});
} else if (!this.organization && results.folders != null) {
results.folders.forEach((f: FolderWithId) => {
} else if (!this.organization && this.results.folders != null) {
this.results.folders.forEach((f: FolderWithId) => {
const folder = FolderWithId.toView(f);
if (folder != null) {
folder.id = null;
groupingsMap.set(f.id, result.folders.length);
result.folders.push(folder);
groupingsMap.set(f.id, this.result.folders.length);
this.result.folders.push(folder);
}
});
}
results.items.forEach((c: CipherWithIds) => {
this.results.items.forEach((c: CipherWithIds) => {
const cipher = CipherWithIds.toView(c);
// reset ids incase they were set for some reason
cipher.id = null;
@ -52,20 +121,17 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
}
if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) {
result.folderRelationships.push([result.ciphers.length, groupingsMap.get(c.folderId)]);
this.result.folderRelationships.push([this.result.ciphers.length, groupingsMap.get(c.folderId)]);
} else if (this.organization && c.collectionIds != null) {
c.collectionIds.forEach((cId) => {
if (groupingsMap.has(cId)) {
result.collectionRelationships.push([result.ciphers.length, groupingsMap.get(cId)]);
this.result.collectionRelationships.push([this.result.ciphers.length, groupingsMap.get(cId)]);
}
});
}
this.cleanupCipher(cipher);
result.ciphers.push(cipher);
this.result.ciphers.push(cipher);
});
result.success = true;
return result;
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class BlackBerryCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -31,6 +31,6 @@ export class BlackBerryCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class BlurCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -34,6 +34,6 @@ export class BlurCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -8,12 +8,12 @@ const OfficialProps = [
];
export class ButtercupCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -46,6 +46,6 @@ export class ButtercupCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class ChromeCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -23,6 +23,6 @@ export class ChromeCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,19 +4,19 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class ClipperzHtmlImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const doc = this.parseXml(data);
if (doc == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
const textarea = doc.querySelector('textarea');
if (textarea == null || this.isNullOrWhitespace(textarea.textContent)) {
result.errorMessage = 'Missing textarea.';
result.success = false;
return result;
return Promise.resolve(result);
}
const entries = JSON.parse(textarea.textContent);
@ -74,6 +74,6 @@ export class ClipperzHtmlImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class CodebookCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -42,6 +42,6 @@ export class CodebookCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -17,12 +17,12 @@ const HandledResults = new Set(['ADDRESS', 'AUTHENTIFIANT', 'BANKSTATEMENT', 'ID
export class DashlaneJsonImporter extends BaseImporter implements Importer {
private result: ImportResult;
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
this.result = new ImportResult();
const results = JSON.parse(data);
if (results == null || results.length === 0) {
this.result.success = false;
return this.result;
return Promise.resolve(this.result);
}
if (results.ADDRESS != null) {
@ -51,7 +51,7 @@ export class DashlaneJsonImporter extends BaseImporter implements Importer {
}
this.result.success = true;
return this.result;
return Promise.resolve(this.result);
}
private processAuth(results: any[]) {

View File

@ -8,12 +8,12 @@ import { CardView } from '../models/view/cardView';
import { CipherType } from '../enums/cipherType';
export class EncryptrCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -57,6 +57,6 @@ export class EncryptrCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -10,12 +10,12 @@ import { CardView } from '../models/view/cardView';
import { SecureNoteView } from '../models/view/secureNoteView';
export class EnpassCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
let firstRow = true;
@ -99,7 +99,7 @@ export class EnpassCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
private containsField(fields: any[], name: string) {

View File

@ -11,12 +11,12 @@ import { CipherType } from '../enums/cipherType';
import { FieldType } from '../enums/fieldType';
export class EnpassJsonImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = JSON.parse(data);
if (results == null || results.items == null || results.items.length === 0) {
result.success = false;
return result;
return Promise.resolve(result);
}
const foldersMap = new Map<string, string>();
@ -59,7 +59,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
private processLogin(cipher: CipherView, fields: any[]) {

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class FirefoxCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -24,6 +24,6 @@ export class FirefoxCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -8,12 +8,12 @@ import { CardView } from '../models/view/cardView';
import { CipherType } from '../enums/cipherType';
export class FSecureFskImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = JSON.parse(data);
if (results == null || results.data == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
for (const key in results.data) {
@ -55,6 +55,6 @@ export class FSecureFskImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class GnomeJsonImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = JSON.parse(data);
if (results == null || Object.keys(results).length === 0) {
result.success = false;
return result;
return Promise.resolve(result);
}
for (const keyRing in results) {
@ -55,6 +55,6 @@ export class GnomeJsonImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -1,7 +1,6 @@
import { ImportResult } from '../models/domain/importResult';
export interface Importer {
organization: boolean;
parse(data: string): ImportResult;
organizationId: string;
parse(data: string): Promise<ImportResult>;
}

View File

@ -9,7 +9,7 @@ const WebsitesHeader = 'Websites\n\n';
const Delimiter = '\n---\n';
export class KasperskyTxtImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
let notesData: string;
@ -72,7 +72,7 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
private parseDataCategory(data: string): Map<string, string>[] {

View File

@ -10,18 +10,18 @@ import { FolderView } from '../models/view/folderView';
export class KeePass2XmlImporter extends BaseImporter implements Importer {
result = new ImportResult();
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const doc = this.parseXml(data);
if (doc == null) {
this.result.success = false;
return this.result;
return Promise.resolve(this.result);
}
const rootGroup = doc.querySelector('KeePassFile > Root > Group');
if (rootGroup == null) {
this.result.errorMessage = 'Missing `KeePassFile > Root > Group` node.';
this.result.success = false;
return this.result;
return Promise.resolve(this.result);
}
this.traverse(rootGroup, true, '');
@ -31,7 +31,7 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer {
}
this.result.success = true;
return this.result;
return Promise.resolve(this.result);
}
traverse(node: Element, isRootNode: boolean, groupPrefixName: string) {

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class KeePassXCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -37,6 +37,6 @@ export class KeePassXCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -6,12 +6,12 @@ import { ImportResult } from '../models/domain/importResult';
import { FolderView } from '../models/view/folderView';
export class KeeperCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -43,6 +43,6 @@ export class KeeperCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -14,12 +14,12 @@ import { CipherType } from '../enums/cipherType';
import { SecureNoteType } from '../enums/secureNoteType';
export class LastPassCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value, index) => {
@ -84,7 +84,7 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
private buildBaseCipher(value: any) {

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class LogMeOnceCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -26,6 +26,6 @@ export class LogMeOnceCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class MeldiumCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -24,6 +24,6 @@ export class MeldiumCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -9,12 +9,12 @@ import { SecureNoteType } from '../enums/secureNoteType';
import { SecureNoteView } from '../models/view/secureNoteView';
export class MSecureCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -57,6 +57,6 @@ export class MSecureCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -11,12 +11,12 @@ import { SecureNoteView } from '../models/view/secureNoteView';
import { ImportResult } from '../models/domain/importResult';
export class MykiCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -71,6 +71,6 @@ export class MykiCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -16,7 +16,7 @@ import { SecureNoteType } from '../enums/secureNoteType';
export class OnePassword1PifImporter extends BaseImporter implements Importer {
result = new ImportResult();
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
data.split(this.newLineRegex).forEach((line) => {
if (this.isNullOrWhitespace(line) || line[0] !== '{') {
return;
@ -39,7 +39,7 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
});
this.result.success = true;
return this.result;
return Promise.resolve(this.result);
}
private processWinOpVaultItem(item: any, cipher: CipherView) {

View File

@ -9,7 +9,7 @@ import { CardView, IdentityView } from '../models/view';
const IgnoredProperties = ['ainfo', 'autosubmit', 'notesplain', 'ps', 'scope', 'tags', 'title', 'uuid', 'notes'];
export class OnePasswordWinCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true, {
quoteChar: '"',
@ -17,7 +17,7 @@ export class OnePasswordWinCsvImporter extends BaseImporter implements Importer
});
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -155,7 +155,7 @@ export class OnePasswordWinCsvImporter extends BaseImporter implements Importer
});
result.success = true;
return result;
return Promise.resolve(result);
}
private getProp(obj: any, name: string): any {

View File

@ -7,12 +7,12 @@ import { CollectionView } from '../models/view/collectionView';
import { FolderView } from '../models/view/folderView';
export class PadlockCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
let headers: string[] = null;
@ -82,6 +82,6 @@ export class PadlockCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class PassKeepCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -30,7 +30,7 @@ export class PassKeepCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
private getValue(key: string, value: any) {

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class PassmanJsonImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = JSON.parse(data);
if (results == null || results.length === 0) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((credential: any) => {
@ -56,6 +56,6 @@ export class PassmanJsonImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -6,12 +6,12 @@ import { ImportResult } from '../models/domain/importResult';
import { CollectionView } from '../models/view/collectionView';
export class PasspackCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -88,6 +88,6 @@ export class PasspackCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class PasswordAgentCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
let newVersion = true;
@ -47,6 +47,6 @@ export class PasswordAgentCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -9,12 +9,12 @@ import { FolderView } from '../models/view/folderView';
import { CipherType } from '../enums/cipherType';
export class PasswordBossJsonImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = JSON.parse(data);
if (results == null || results.items == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
const foldersMap = new Map<string, string>();
@ -116,6 +116,6 @@ export class PasswordBossJsonImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class PasswordDragonXmlImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const doc = this.parseXml(data);
if (doc == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
const records = doc.querySelectorAll('PasswordManager > record');
@ -52,6 +52,6 @@ export class PasswordDragonXmlImporter extends BaseImporter implements Importer
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,19 +4,19 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class PasswordSafeXmlImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const doc = this.parseXml(data);
if (doc == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
const passwordSafe = doc.querySelector('passwordsafe');
if (passwordSafe == null) {
result.errorMessage = 'Missing `passwordsafe` node.';
result.success = false;
return result;
return Promise.resolve(result);
}
const notesDelimiter = passwordSafe.getAttribute('delimiter');
@ -57,6 +57,6 @@ export class PasswordSafeXmlImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class PasswordWalletTxtImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -42,6 +42,6 @@ export class PasswordWalletTxtImporter extends BaseImporter implements Importer
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -8,12 +8,12 @@ import { ImportResult } from '../models/domain/importResult';
import { CardView } from '../models/view/cardView';
export class RememBearCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -68,6 +68,6 @@ export class RememBearCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class RoboFormCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
let i = 1;
@ -58,6 +58,6 @@ export class RoboFormCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -10,19 +10,19 @@ import { CipherType } from '../enums/cipherType';
import { SecureNoteType } from '../enums/secureNoteType';
export class SafeInCloudXmlImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const doc = this.parseXml(data);
if (doc == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
const db = doc.querySelector('database');
if (db == null) {
result.errorMessage = 'Missing `database` node.';
result.success = false;
return result;
return Promise.resolve(result);
}
const foldersMap = new Map<string, number>();
@ -96,6 +96,6 @@ export class SafeInCloudXmlImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class SaferPassCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -24,6 +24,6 @@ export class SaferPassCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class SecureSafeCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -24,6 +24,6 @@ export class SecureSafeCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -5,12 +5,12 @@ import { ImportResult } from '../models/domain/importResult';
import { CipherView } from '../models/view/cipherView';
export class SplashIdCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -42,7 +42,7 @@ export class SplashIdCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
private parseFieldsToNotes(cipher: CipherView, startIndex: number, value: any) {

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class StickyPasswordXmlImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const doc = this.parseXml(data);
if (doc == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
const loginNodes = doc.querySelectorAll('root > Database > Logins > Login');
@ -62,7 +62,7 @@ export class StickyPasswordXmlImporter extends BaseImporter implements Importer
}
result.success = true;
return result;
return Promise.resolve(result);
}
buildGroupText(doc: Document, groupId: string, groupText: string): string {

View File

@ -14,12 +14,12 @@ const PropertiesToIgnore = ['kind', 'autologin', 'favorite', 'hexcolor', 'protec
];
export class TrueKeyCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -69,6 +69,6 @@ export class TrueKeyCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class UpmCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -27,6 +27,6 @@ export class UpmCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -4,12 +4,12 @@ import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class YotiCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -23,6 +23,6 @@ export class YotiCsvImporter extends BaseImporter implements Importer {
});
result.success = true;
return result;
return Promise.resolve(result);
}
}

View File

@ -5,12 +5,12 @@ import { ImportResult } from '../models/domain/importResult';
import { CipherView } from '../models/view';
export class ZohoVaultCsvImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
parse(data: string): Promise<ImportResult> {
const result = new ImportResult();
const results = this.parseCsv(data, true);
if (results == null) {
result.success = false;
return result;
return Promise.resolve(result);
}
results.forEach((value) => {
@ -37,7 +37,7 @@ export class ZohoVaultCsvImporter extends BaseImporter implements Importer {
}
result.success = true;
return result;
return Promise.resolve(result);
}
private parseData(cipher: CipherView, data: string) {

View File

@ -1,6 +1,7 @@
import { CardView } from '../view/cardView';
import { Card as CardDomain } from '../domain/card';
import { CipherString } from '../domain/cipherString';
export class Card {
static template(): Card {
@ -24,6 +25,16 @@ export class Card {
return view;
}
static toDomain(req: Card, domain = new CardDomain()) {
domain.cardholderName = req.cardholderName != null ? new CipherString(req.cardholderName) : null;
domain.brand = req.brand != null ? new CipherString(req.brand) : null;
domain.number = req.number != null ? new CipherString(req.number) : null;
domain.expMonth = req.expMonth != null ? new CipherString(req.expMonth) : null;
domain.expYear = req.expYear != null ? new CipherString(req.expYear) : null;
domain.code = req.code != null ? new CipherString(req.code) : null;
return domain;
}
cardholderName: string;
brand: string;
number: string;

View File

@ -3,6 +3,7 @@ import { CipherType } from '../../enums/cipherType';
import { CipherView } from '../view/cipherView';
import { Cipher as CipherDomain } from '../domain/cipher';
import { CipherString } from '../domain/cipherString';
import { Card } from './card';
import { Field } from './field';
@ -59,6 +60,38 @@ export class Cipher {
return view;
}
static toDomain(req: Cipher, domain = new CipherDomain()) {
domain.type = req.type;
domain.folderId = req.folderId;
if (domain.organizationId == null) {
domain.organizationId = req.organizationId;
}
domain.name = req.name != null ? new CipherString(req.name) : null;
domain.notes = req.notes != null ? new CipherString(req.notes) : null;
domain.favorite = req.favorite;
if (req.fields != null) {
domain.fields = req.fields.map((f) => Field.toDomain(f));
}
switch (req.type) {
case CipherType.Login:
domain.login = Login.toDomain(req.login);
break;
case CipherType.SecureNote:
domain.secureNote = SecureNote.toDomain(req.secureNote);
break;
case CipherType.Card:
domain.card = Card.toDomain(req.card);
break;
case CipherType.Identity:
domain.identity = Identity.toDomain(req.identity);
break;
}
return domain;
}
type: CipherType;
folderId: string;
organizationId: string;

View File

@ -1,5 +1,6 @@
import { CollectionView } from '../view/collectionView';
import { CipherString } from '../domain/cipherString';
import { Collection as CollectionDomain } from '../domain/collection';
export class Collection {
@ -20,6 +21,15 @@ export class Collection {
return view;
}
static toDomain(req: Collection, domain = new CollectionDomain()) {
domain.name = req.name != null ? new CipherString(req.name) : null;
domain.externalId = req.externalId;
if (domain.organizationId == null) {
domain.organizationId = req.organizationId;
}
return domain;
}
organizationId: string;
name: string;
externalId: string;

View File

@ -2,6 +2,7 @@ import { FieldType } from '../../enums/fieldType';
import { FieldView } from '../view/fieldView';
import { CipherString } from '../domain/cipherString';
import { Field as FieldDomain } from '../domain/field';
export class Field {
@ -20,6 +21,13 @@ export class Field {
return view;
}
static toDomain(req: Field, domain = new FieldDomain()) {
domain.type = req.type;
domain.value = req.value != null ? new CipherString(req.value) : null;
domain.name = req.name != null ? new CipherString(req.name) : null;
return domain;
}
name: string;
value: string;
type: FieldType;

View File

@ -1,5 +1,6 @@
import { FolderView } from '../view/folderView';
import { CipherString } from '../domain/cipherString';
import { Folder as FolderDomain } from '../domain/folder';
export class Folder {
@ -14,6 +15,11 @@ export class Folder {
return view;
}
static toDomain(req: Folder, domain = new FolderDomain()) {
domain.name = req.name != null ? new CipherString(req.name) : null;
return domain;
}
name: string;
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print

View File

@ -1,5 +1,6 @@
import { IdentityView } from '../view/identityView';
import { CipherString } from '../domain/cipherString';
import { Identity as IdentityDomain } from '../domain/identity';
export class Identity {
@ -48,6 +49,28 @@ export class Identity {
return view;
}
static toDomain(req: Identity, domain = new IdentityDomain()) {
domain.title = req.title != null ? new CipherString(req.title) : null;
domain.firstName = req.firstName != null ? new CipherString(req.firstName) : null;
domain.middleName = req.middleName != null ? new CipherString(req.middleName) : null;
domain.lastName = req.lastName != null ? new CipherString(req.lastName) : null;
domain.address1 = req.address1 != null ? new CipherString(req.address1) : null;
domain.address2 = req.address2 != null ? new CipherString(req.address2) : null;
domain.address3 = req.address3 != null ? new CipherString(req.address3) : null;
domain.city = req.city != null ? new CipherString(req.city) : null;
domain.state = req.state != null ? new CipherString(req.state) : null;
domain.postalCode = req.postalCode != null ? new CipherString(req.postalCode) : null;
domain.country = req.country != null ? new CipherString(req.country) : null;
domain.company = req.company != null ? new CipherString(req.company) : null;
domain.email = req.email != null ? new CipherString(req.email) : null;
domain.phone = req.phone != null ? new CipherString(req.phone) : null;
domain.ssn = req.ssn != null ? new CipherString(req.ssn) : null;
domain.username = req.username != null ? new CipherString(req.username) : null;
domain.passportNumber = req.passportNumber != null ? new CipherString(req.passportNumber) : null;
domain.licenseNumber = req.licenseNumber != null ? new CipherString(req.licenseNumber) : null;
return domain;
}
title: string;
firstName: string;
middleName: string;

View File

@ -2,6 +2,7 @@ import { LoginUri } from './loginUri';
import { LoginView } from '../view/loginView';
import { CipherString } from '../domain/cipherString';
import { Login as LoginDomain } from '../domain/login';
export class Login {
@ -24,6 +25,16 @@ export class Login {
return view;
}
static toDomain(req: Login, domain = new LoginDomain()) {
if (req.uris != null) {
domain.uris = req.uris.map((u) => LoginUri.toDomain(u));
}
domain.username = req.username != null ? new CipherString(req.username) : null;
domain.password = req.password != null ? new CipherString(req.password) : null;
domain.totp = req.totp != null ? new CipherString(req.totp) : null;
return domain;
}
uris: LoginUri[];
username: string;
password: string;

View File

@ -2,6 +2,7 @@ import { UriMatchType } from '../../enums/uriMatchType';
import { LoginUriView } from '../view/loginUriView';
import { CipherString } from '../domain/cipherString';
import { LoginUri as LoginUriDomain } from '../domain/loginUri';
export class LoginUri {
@ -18,6 +19,12 @@ export class LoginUri {
return view;
}
static toDomain(req: LoginUri, domain = new LoginUriDomain()) {
domain.uri = req.uri != null ? new CipherString(req.uri) : null;
domain.match = req.match;
return domain;
}
uri: string;
match: UriMatchType = null;

View File

@ -16,6 +16,11 @@ export class SecureNote {
return view;
}
static toDomain(req: SecureNote, view = new SecureNoteDomain()) {
view.type = req.type;
return view;
}
type: SecureNoteType;
constructor(o?: SecureNoteView | SecureNoteDomain) {

View File

@ -98,6 +98,7 @@ export class ExportService implements ExportServiceAbstraction {
return papa.unparse(exportCiphers);
} else {
const jsonDoc: any = {
encrypted: false,
folders: [],
items: [],
};
@ -130,6 +131,7 @@ export class ExportService implements ExportServiceAbstraction {
const ciphers = await this.cipherService.getAll();
const jsonDoc: any = {
encrypted: true,
folders: [],
items: [],
};
@ -215,6 +217,7 @@ export class ExportService implements ExportServiceAbstraction {
return papa.unparse(exportCiphers);
} else {
const jsonDoc: any = {
encrypted: false,
collections: [],
items: [],
};
@ -264,6 +267,7 @@ export class ExportService implements ExportServiceAbstraction {
await Promise.all(promises);
const jsonDoc: any = {
encrypted: true,
collections: [],
items: [],
};

View File

@ -165,12 +165,12 @@ export class ImportService implements ImportServiceAbstraction {
}
}
getImporter(format: string, organization = false): Importer {
getImporter(format: string, organizationId: string = null): Importer {
const importer = this.getImporterInstance(format);
if (importer == null) {
return null;
}
importer.organization = organization;
importer.organizationId = organizationId;
return importer;
}