mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
avast passwords csv importer
This commit is contained in:
28
src/importers/avastCsvImporter.ts
Normal file
28
src/importers/avastCsvImporter.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { BaseImporter } from './baseImporter';
|
||||||
|
import { Importer } from './importer';
|
||||||
|
|
||||||
|
import { ImportResult } from '../models/domain/importResult';
|
||||||
|
|
||||||
|
export class AvastCsvImporter 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.name);
|
||||||
|
cipher.login.uris = this.makeUriArray(value.web);
|
||||||
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
|
cipher.login.username = this.getValueOrDefault(value.login);
|
||||||
|
this.cleanupCipher(cipher);
|
||||||
|
result.ciphers.push(cipher);
|
||||||
|
});
|
||||||
|
|
||||||
|
result.success = true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ import { KvpRequest } from '../models/request/kvpRequest';
|
|||||||
import { CipherView } from '../models/view/cipherView';
|
import { CipherView } from '../models/view/cipherView';
|
||||||
|
|
||||||
import { AscendoCsvImporter } from '../importers/ascendoCsvImporter';
|
import { AscendoCsvImporter } from '../importers/ascendoCsvImporter';
|
||||||
|
import { AvastCsvImporter } from '../importers/avastCsvImporter';
|
||||||
import { AviraCsvImporter } from '../importers/aviraCsvImporter';
|
import { AviraCsvImporter } from '../importers/aviraCsvImporter';
|
||||||
import { BitwardenCsvImporter } from '../importers/bitwardenCsvImporter';
|
import { BitwardenCsvImporter } from '../importers/bitwardenCsvImporter';
|
||||||
import { BitwardenJsonImporter } from '../importers/bitwardenJsonImporter';
|
import { BitwardenJsonImporter } from '../importers/bitwardenJsonImporter';
|
||||||
@@ -101,6 +102,7 @@ export class ImportService implements ImportServiceAbstraction {
|
|||||||
{ id: 'passwordagentcsv', name: 'Password Agent (csv)' },
|
{ id: 'passwordagentcsv', name: 'Password Agent (csv)' },
|
||||||
{ id: 'passpackcsv', name: 'Passpack (csv)' },
|
{ id: 'passpackcsv', name: 'Passpack (csv)' },
|
||||||
{ id: 'passmanjson', name: 'Passman (json)' },
|
{ id: 'passmanjson', name: 'Passman (json)' },
|
||||||
|
{ id: 'avastcsv', name: 'Avast Passwords (csv)' },
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||||
@@ -223,6 +225,8 @@ export class ImportService implements ImportServiceAbstraction {
|
|||||||
return new PasspackCsvImporter();
|
return new PasspackCsvImporter();
|
||||||
case 'passmanjson':
|
case 'passmanjson':
|
||||||
return new PassmanJsonImporter();
|
return new PassmanJsonImporter();
|
||||||
|
case 'avastcsv':
|
||||||
|
return new AvastCsvImporter();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user