1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

1password 1pif: import password history (#33)

* 1password 1pif import password history

* 1password 1pif importer: process windows password history

* linter fix
This commit is contained in:
Robert Wachs
2019-03-24 15:50:49 +01:00
committed by Kyle Spearrin
parent df429fe178
commit 8ed27eeeec
3 changed files with 120 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import { ImportResult } from '../models/domain/importResult';
import { CardView } from '../models/view/cardView';
import { CipherView } from '../models/view/cipherView';
import { IdentityView } from '../models/view/identityView';
import { PasswordHistoryView } from '../models/view/passwordHistoryView';
import { SecureNoteView } from '../models/view/secureNoteView';
import { CipherType } from '../enums/cipherType';
@@ -77,9 +78,22 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
}
});
}
if (item.details.passwordHistory != null) {
this.processPasswordHistory(item.details.passwordHistory, cipher);
}
}
}
private processPasswordHistory(items: any[], cipher: CipherView) {
cipher.passwordHistory = cipher.passwordHistory || [];
items.forEach((entry: any) => {
const phv = new PasswordHistoryView();
phv.password = entry.value;
phv.lastUsedDate = new Date(entry.time * 1000);
cipher.passwordHistory.push(phv);
});
}
private processStandardItem(item: any, cipher: CipherView) {
cipher.favorite = item.openContents && item.openContents.faveIndex ? true : false;
cipher.name = this.getValueOrDefault(item.title);
@@ -128,6 +142,9 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
}
});
}
if (item.secureContents.passwordHistory != null) {
this.processPasswordHistory(item.secureContents.passwordHistory, cipher);
}
}
}