Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
securesafe csv importer
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Aug 22, 2019
1 parent 94a12f7 commit 8a0d371
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/importers/secureSafeCsvImporter.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
4 changes: 4 additions & 0 deletions src/services/import.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 8a0d371

Please sign in to comment.