1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-26 01:45:10 +01:00

password wallet txt importer

This commit is contained in:
Kyle Spearrin 2019-04-26 20:51:53 -04:00
parent a0a1142f1f
commit 61723f74d2
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,38 @@
import { BaseImporter } from './baseImporter';
import { Importer } from './importer';
import { ImportResult } from '../models/domain/importResult';
export class PasswordWalletTxtImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult {
const result = new ImportResult();
const results = this.parseCsv(data, false);
if (results == null) {
result.success = false;
return result;
}
results.forEach((value) => {
if (value.length < 6) {
return;
}
this.processFolder(result, value[5]);
const cipher = this.initLoginCipher();
cipher.name = this.getValueOrDefault(value[0], '--');
cipher.notes = this.getValueOrDefault(value[4]);
cipher.login.username = this.getValueOrDefault(value[2]);
cipher.login.password = this.getValueOrDefault(value[3]);
cipher.login.uris = this.makeUriArray(value[1]);
this.cleanupCipher(cipher);
result.ciphers.push(cipher);
});
if (this.organization) {
this.moveFoldersToCollections(result);
}
result.success = true;
return result;
}
}

View File

@ -55,6 +55,7 @@ import { PasswordAgentCsvImporter } from '../importers/passwordAgentCsvImporter'
import { PasswordBossJsonImporter } from '../importers/passwordBossJsonImporter';
import { PasswordDragonXmlImporter } from '../importers/passwordDragonXmlImporter';
import { PasswordSafeXmlImporter } from '../importers/passwordSafeXmlImporter';
import { PasswordWalletTxtImporter } from '../importers/passwordWalletTxtImporter';
import { RememBearCsvImporter } from '../importers/rememBearCsvImporter';
import { RoboFormCsvImporter } from '../importers/roboformCsvImporter';
import { SafeInCloudXmlImporter } from '../importers/safeInCloudXmlImporter';
@ -113,6 +114,7 @@ export class ImportService implements ImportServiceAbstraction {
{ id: 'fsecurefsk', name: 'F-Secure KEY (fsk)' },
{ id: 'kasperskytxt', name: 'Kaspersky Password Manager (txt)' },
{ id: 'remembearcsv', name: 'RememBear (csv)' },
{ id: 'passwordwallettxt', name: 'PasswordWallet (txt)' },
];
constructor(private cipherService: CipherService, private folderService: FolderService,
@ -243,6 +245,8 @@ export class ImportService implements ImportServiceAbstraction {
return new KasperskyTxtImporter();
case 'remembearcsv':
return new RememBearCsvImporter();
case 'passwordwallettxt':
return new PasswordWalletTxtImporter();
default:
return null;
}