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

securesafe csv importer

This commit is contained in:
Kyle Spearrin 2019-08-21 23:13:08 -04:00
parent 94a12f7644
commit 8a0d371d20
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,29 @@
import { BaseImporter } from './baseImporter';
import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class SecureSafeCsvImporter 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.Title);
cipher.notes = this.getValueOrDefault(value.Comment);
cipher.login.uris = this.makeUriArray(value.Url);
cipher.login.password = this.getValueOrDefault(value.Password);
cipher.login.username = this.getValueOrDefault(value.Username);
this.cleanupCipher(cipher);
result.ciphers.push(cipher);
});
result.success = true;
return result;
}
}

View File

@ -61,6 +61,7 @@ import { RememBearCsvImporter } from '../importers/rememBearCsvImporter';
import { RoboFormCsvImporter } from '../importers/roboformCsvImporter';
import { SafeInCloudXmlImporter } from '../importers/safeInCloudXmlImporter';
import { SaferPassCsvImporter } from '../importers/saferpassCsvImport';
import { SecureSafeCsvImporter } from '../importers/secureSafeCsvImporter';
import { SplashIdCsvImporter } from '../importers/splashIdCsvImporter';
import { StickyPasswordXmlImporter } from '../importers/stickyPasswordXmlImporter';
import { TrueKeyCsvImporter } from '../importers/truekeyCsvImporter';
@ -117,6 +118,7 @@ export class ImportService implements ImportServiceAbstraction {
{ id: 'remembearcsv', name: 'RememBear (csv)' },
{ id: 'passwordwallettxt', name: 'PasswordWallet (txt)' },
{ id: 'mykicsv', name: 'Myki (csv)' },
{ id: 'securesafecsv', name: 'SecureSafe (csv)' },
];
constructor(private cipherService: CipherService, private folderService: FolderService,
@ -251,6 +253,8 @@ export class ImportService implements ImportServiceAbstraction {
return new PasswordWalletTxtImporter();
case 'mykicsv':
return new MykiCsvImporter();
case 'securesafecsv':
return new SecureSafeCsvImporter();
default:
return null;
}