mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
Feature/password protected export (#689)
* Simplify password protected file format * no items to import is not an error * Await inner importer * Add export format type * Error if import file is password protected * Update tests * Test password protected with normat json importer * Simplify imports * Ignore code coverage directory * Expand importer options without changing display options * Import password require import error handling * Use interface * Fix curlies * linter fixes * Add null of empty util * Lint fixes * run prettier * Move import options to separate enum file * Fix imports
This commit is contained in:
@@ -13,14 +13,21 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||
private results: any;
|
||||
private result: ImportResult;
|
||||
|
||||
constructor(private cryptoService: CryptoService, private i18nService: I18nService) {
|
||||
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService) {
|
||||
super();
|
||||
}
|
||||
|
||||
async parse(data: string): Promise<ImportResult> {
|
||||
this.result = new ImportResult();
|
||||
this.results = JSON.parse(data);
|
||||
if (this.results == null || this.results.items == null || this.results.items.length === 0) {
|
||||
if (this.results == null || this.results.items == null) {
|
||||
if (this.results?.passwordProtected) {
|
||||
this.result.success = false;
|
||||
this.result.missingPassword = true;
|
||||
this.result.errorMessage = this.i18nService.t("importPasswordRequired");
|
||||
return this.result;
|
||||
}
|
||||
|
||||
this.result.success = false;
|
||||
return this.result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user