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

Commit

Permalink
logmeonce csv importer
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Aug 26, 2019
1 parent fbc7d6c commit 99d56d9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/importers/logMeOnceCsvImporter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { BaseImporter } from './baseImporter';
import { Importer } from './importer';

import { ImportResult } from '../models/domain/importResult';

export class LogMeOnceCsvImporter 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 < 4) {
return;
}
const cipher = this.initLoginCipher();
cipher.name = this.getValueOrDefault(value[0], '--');
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);
});

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 @@ -43,6 +43,7 @@ import { KeePass2XmlImporter } from '../importers/keepass2XmlImporter';
import { KeePassXCsvImporter } from '../importers/keepassxCsvImporter';
import { KeeperCsvImporter } from '../importers/keeperCsvImporter';
import { LastPassCsvImporter } from '../importers/lastpassCsvImporter';
import { LogMeOnceCsvImporter } from '../importers/logMeOnceCsvImporter';
import { MeldiumCsvImporter } from '../importers/meldiumCsvImporter';
import { MSecureCsvImporter } from '../importers/msecureCsvImporter';
import { MykiCsvImporter } from '../importers/mykiCsvImporter';
Expand Down Expand Up @@ -119,6 +120,7 @@ export class ImportService implements ImportServiceAbstraction {
{ id: 'passwordwallettxt', name: 'PasswordWallet (txt)' },
{ id: 'mykicsv', name: 'Myki (csv)' },
{ id: 'securesafecsv', name: 'SecureSafe (csv)' },
{ id: 'logmeoncecsv', name: 'LogMeOnce (csv)' },
];

constructor(private cipherService: CipherService, private folderService: FolderService,
Expand Down Expand Up @@ -255,6 +257,8 @@ export class ImportService implements ImportServiceAbstraction {
return new MykiCsvImporter();
case 'securesafecsv':
return new SecureSafeCsvImporter();
case 'logmeoncecsv':
return new LogMeOnceCsvImporter();
default:
return null;
}
Expand Down

0 comments on commit 99d56d9

Please sign in to comment.