1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

encrypt cipher data

This commit is contained in:
Kyle Spearrin
2017-10-13 22:34:36 -04:00
parent 925102a86b
commit b5c70c4941
2 changed files with 103 additions and 42 deletions

View File

@@ -154,16 +154,16 @@ var Cipher = function (obj, alreadyEncrypted, localData) {
switch (this.type) {
case 1: // cipherType.login
this.login = new Login2(obj.login);
this.login = new Login2(obj.login, alreadyEncrypted);
break;
case 2: // cipherType.secureNote
this.secureNote = new SecureNote(obj.secureNote);
this.secureNote = new SecureNote(obj.secureNote, alreadyEncrypted);
break;
case 3: // cipherType.card
this.card = new Card(obj.card);
this.card = new Card(obj.card, alreadyEncrypted);
break;
case 4: // cipherType.identity
this.identity = new Identity(obj.identity);
this.identity = new Identity(obj.identity, alreadyEncrypted);
break;
default:
break;
@@ -278,6 +278,9 @@ function buildDomainModel(model, obj, map, alreadyEncrypted, notEncList) {
}
(function () {
var bg = chrome.extension.getBackgroundPage(),
cryptoService = bg ? bg.bg_cryptoService : null;
CipherString.prototype.decrypt = function (orgId) {
if (this.decryptedValue) {
var deferred = Q.defer();
@@ -286,7 +289,6 @@ function buildDomainModel(model, obj, map, alreadyEncrypted, notEncList) {
}
var self = this;
var cryptoService = chrome.extension.getBackgroundPage().bg_cryptoService;
return cryptoService.getOrgKey(orgId).then(function (orgKey) {
return cryptoService.decrypt(self, orgKey);
}).then(function (decValue) {