1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

add new org to profile

This commit is contained in:
Kyle Spearrin
2017-03-11 20:46:33 -05:00
parent 1cbd322105
commit 0acab61f2e
3 changed files with 46 additions and 3 deletions

View File

@@ -43,6 +43,28 @@ angular
}
}
$sessionStorage.orgKeys = orgKeysb64;
};
_service.addOrgKey = function (orgKeyCt, privateKey) {
_orgKeys = _service.getOrgKeys();
if (!_orgKeys) {
_orgKeys = {};
}
var orgKeysb64 = $sessionStorage.orgKeys;
if (!orgKeysb64) {
orgKeysb64 = {};
}
try {
var orgKey = _service.rsaDecrypt(orgKeyCt.key, privateKey);
_orgKeys[orgKeyCt.id] = orgKey;
orgKeysb64[orgKeyCt.id] = forge.util.encode64(orgKey);
}
catch (e) {
console.log('Cannot set org key. Decryption failed.');
}
$sessionStorage.orgKeys = orgKeysb64;
};