mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
securesafe csv importer
This commit is contained in:
parent
94a12f7644
commit
8a0d371d20
29
src/importers/secureSafeCsvImporter.ts
Normal file
29
src/importers/secureSafeCsvImporter.ts
Normal 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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user