1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-02 08:40:08 +01:00

Add support for enpass sensitive fields (#98)

This commit is contained in:
Kyle Spearrin 2020-04-29 11:12:59 -04:00 committed by GitHub
parent 2de8c5ed16
commit 5e24e396ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import { CipherView } from '../models/view/cipherView';
import { FolderView } from '../models/view/folderView'; import { FolderView } from '../models/view/folderView';
import { CipherType } from '../enums/cipherType'; import { CipherType } from '../enums/cipherType';
import { FieldType } from '../enums/fieldType';
export class EnpassJsonImporter extends BaseImporter implements Importer { export class EnpassJsonImporter extends BaseImporter implements Importer {
parse(data: string): ImportResult { parse(data: string): ImportResult {
@ -78,7 +79,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
} else if (field.type === 'url') { } else if (field.type === 'url') {
urls.push(field.value); urls.push(field.value);
} else { } else {
this.processKvp(cipher, field.label, field.value); this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : null);
} }
}); });
cipher.login.uris = this.makeUriArray(urls); cipher.login.uris = this.makeUriArray(urls);
@ -101,10 +102,10 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
cipher.card.code = field.value; cipher.card.code = field.value;
} else if (field.type === 'ccExpiry' && this.isNullOrWhitespace(cipher.card.expYear)) { } else if (field.type === 'ccExpiry' && this.isNullOrWhitespace(cipher.card.expYear)) {
if (!this.setCardExpiration(cipher, field.value)) { if (!this.setCardExpiration(cipher, field.value)) {
this.processKvp(cipher, field.label, field.value); this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : null);
} }
} else { } else {
this.processKvp(cipher, field.label, field.value); this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : null);
} }
}); });
} }
@ -114,7 +115,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
if (this.isNullOrWhitespace(field.value) || field.type === 'section') { if (this.isNullOrWhitespace(field.value) || field.type === 'section') {
return; return;
} }
this.processKvp(cipher, field.label, field.value); this.processKvp(cipher, field.label, field.value, field.sensitive === 1 ? FieldType.Hidden : null);
}); });
} }