adds support for yoti csv importer (#157)
This commit is contained in:
parent
6ab444a986
commit
e55528e617
|
@ -0,0 +1,28 @@
|
||||||
|
import { BaseImporter } from './baseImporter';
|
||||||
|
import { Importer } from './importer';
|
||||||
|
|
||||||
|
import { ImportResult } from '../models/domain/importResult';
|
||||||
|
|
||||||
|
export class YotiCsvImporter extends BaseImporter implements Importer {
|
||||||
|
parse(data: string): ImportResult {
|
||||||
|
const result = new ImportResult();
|
||||||
|
const results = this.parseCsv(data, true);
|
||||||
|
if (results == null) {
|
||||||
|
result.success = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
results.forEach((value) => {
|
||||||
|
const cipher = this.initLoginCipher();
|
||||||
|
cipher.name = this.getValueOrDefault(value.Name, '--');
|
||||||
|
cipher.login.username = this.getValueOrDefault(value['User name']);
|
||||||
|
cipher.login.password = this.getValueOrDefault(value.Password);
|
||||||
|
cipher.login.uris = this.makeUriArray(value.URL);
|
||||||
|
this.cleanupCipher(cipher);
|
||||||
|
result.ciphers.push(cipher);
|
||||||
|
});
|
||||||
|
|
||||||
|
result.success = true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -72,6 +72,7 @@ import { SplashIdCsvImporter } from '../importers/splashIdCsvImporter';
|
||||||
import { StickyPasswordXmlImporter } from '../importers/stickyPasswordXmlImporter';
|
import { StickyPasswordXmlImporter } from '../importers/stickyPasswordXmlImporter';
|
||||||
import { TrueKeyCsvImporter } from '../importers/truekeyCsvImporter';
|
import { TrueKeyCsvImporter } from '../importers/truekeyCsvImporter';
|
||||||
import { UpmCsvImporter } from '../importers/upmCsvImporter';
|
import { UpmCsvImporter } from '../importers/upmCsvImporter';
|
||||||
|
import { YotiCsvImporter } from '../importers/yotiCsvImporter';
|
||||||
import { ZohoVaultCsvImporter } from '../importers/zohoVaultCsvImporter';
|
import { ZohoVaultCsvImporter } from '../importers/zohoVaultCsvImporter';
|
||||||
|
|
||||||
export class ImportService implements ImportServiceAbstraction {
|
export class ImportService implements ImportServiceAbstraction {
|
||||||
|
@ -131,6 +132,7 @@ export class ImportService implements ImportServiceAbstraction {
|
||||||
{ id: 'buttercupcsv', name: 'Buttercup (csv)' },
|
{ id: 'buttercupcsv', name: 'Buttercup (csv)' },
|
||||||
{ id: 'codebookcsv', name: 'Codebook (csv)' },
|
{ id: 'codebookcsv', name: 'Codebook (csv)' },
|
||||||
{ id: 'encryptrcsv', name: 'Encryptr (csv)' },
|
{ id: 'encryptrcsv', name: 'Encryptr (csv)' },
|
||||||
|
{ id: 'yoticsv', name: 'Yoti (csv)' },
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||||
|
@ -279,6 +281,8 @@ export class ImportService implements ImportServiceAbstraction {
|
||||||
return new CodebookCsvImporter();
|
return new CodebookCsvImporter();
|
||||||
case 'encryptrcsv':
|
case 'encryptrcsv':
|
||||||
return new EncryptrCsvImporter();
|
return new EncryptrCsvImporter();
|
||||||
|
case 'yoticsv':
|
||||||
|
return new YotiCsvImporter();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue