1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

adds support for yoti csv importer (#157)

This commit is contained in:
Kyle Spearrin 2020-08-24 12:21:17 -04:00 committed by GitHub
parent 6ab444a986
commit e55528e617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -72,6 +72,7 @@ import { SplashIdCsvImporter } from '../importers/splashIdCsvImporter';
import { StickyPasswordXmlImporter } from '../importers/stickyPasswordXmlImporter';
import { TrueKeyCsvImporter } from '../importers/truekeyCsvImporter';
import { UpmCsvImporter } from '../importers/upmCsvImporter';
import { YotiCsvImporter } from '../importers/yotiCsvImporter';
import { ZohoVaultCsvImporter } from '../importers/zohoVaultCsvImporter';
export class ImportService implements ImportServiceAbstraction {
@ -131,6 +132,7 @@ export class ImportService implements ImportServiceAbstraction {
{ id: 'buttercupcsv', name: 'Buttercup (csv)' },
{ id: 'codebookcsv', name: 'Codebook (csv)' },
{ id: 'encryptrcsv', name: 'Encryptr (csv)' },
{ id: 'yoticsv', name: 'Yoti (csv)' },
];
constructor(private cipherService: CipherService, private folderService: FolderService,
@ -279,6 +281,8 @@ export class ImportService implements ImportServiceAbstraction {
return new CodebookCsvImporter();
case 'encryptrcsv':
return new EncryptrCsvImporter();
case 'yoticsv':
return new YotiCsvImporter();
default:
return null;
}