1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-06 10:33:57 +00:00

user vault associations

This commit is contained in:
Kyle Spearrin
2017-03-13 22:54:57 -04:00
parent 6ece16ccc9
commit 4a6066bb88
7 changed files with 90 additions and 83 deletions

View File

@@ -44,6 +44,7 @@
invite: { url: _apiUri + '/organizations/:orgId/users/invite', method: 'POST', params: { orgId: '@orgId' } },
accept: { url: _apiUri + '/organizations/:orgId/users/:id/accept', method: 'POST', params: { id: '@id', orgId: '@orgId' } },
confirm: { url: _apiUri + '/organizations/:orgId/users/:id/confirm', method: 'POST', params: { id: '@id', orgId: '@orgId' } },
put: { method: 'POST', params: { id: '@id', orgId: '@orgId' } },
del: { url: _apiUri + '/organizations/:orgId/users/:id/delete', method: 'POST', params: { id: '@id', orgId: '@orgId' } }
});

View File

@@ -57,8 +57,8 @@ angular
id: encryptedCipher.Id,
folderId: encryptedCipher.FolderId,
favorite: encryptedCipher.Favorite,
name: decryptProperty(encryptedCipher.Data.Name, key, false),
username: decryptProperty(encryptedCipher.Data.Username, key, true)
name: _service.decryptProperty(encryptedCipher.Data.Name, key, false),
username: _service.decryptProperty(encryptedCipher.Data.Username, key, true)
};
return login;
@@ -90,7 +90,7 @@ angular
return {
id: encryptedFolder.Id,
name: decryptProperty(encryptedFolder.Data.Name, null, false)
name: _service.decryptProperty(encryptedFolder.Data.Name, null, false)
};
};
@@ -114,12 +114,12 @@ angular
return {
id: encryptedSubvault.Id,
name: catchError ? decryptProperty(encryptedSubvault.Name, key, false) :
name: catchError ? _service.decryptProperty(encryptedSubvault.Name, key, false) :
cryptoService.decrypt(encryptedSubvault.Name, key)
};
};
function decryptProperty(property, key, checkEmpty) {
_service.decryptProperty = function(property, key, checkEmpty) {
if (checkEmpty && (!property || property === '')) {
return null;
}

View File

@@ -31,19 +31,26 @@ angular
}
var orgKeysb64 = {},
_orgKeys = {};
_orgKeys = {},
setKey = false;
for (var i = 0; i < orgKeysCt.length; i++) {
try {
var orgKey = _service.rsaDecrypt(orgKeysCt[i].key, privateKey);
_orgKeys[orgKeysCt[i].id] = orgKey;
orgKeysb64[orgKeysCt[i].id] = forge.util.encode64(orgKey);
setKey = true;
}
catch (e) {
console.log('Cannot set org key ' + i + '. Decryption failed.');
}
}
$sessionStorage.orgKeys = orgKeysb64;
if (setKey) {
$sessionStorage.orgKeys = orgKeysb64;
}
else {
_orgKeys = null;
}
};
_service.addOrgKey = function (orgKeyCt, privateKey) {
@@ -63,6 +70,7 @@ angular
orgKeysb64[orgKeyCt.id] = forge.util.encode64(orgKey);
}
catch (e) {
_orgKeys = null;
console.log('Cannot set org key. Decryption failed.');
}
@@ -177,7 +185,7 @@ angular
};
_service.clearOrgKeys = function () {
_orgKeys = {};
_orgKeys = null;
delete $sessionStorage.orgKeys;
};