1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-16 10:35:31 +01:00

rename CryptoKey to SymmetricCryptoKey

This commit is contained in:
Kyle Spearrin 2017-04-22 14:38:41 -04:00
parent 863cfbad4a
commit 2be7d1a242

View File

@ -66,7 +66,7 @@ function initCryptoService(constantsService) {
chrome.storage.local.get('key', function (obj) { chrome.storage.local.get('key', function (obj) {
if (obj && obj.key) { if (obj && obj.key) {
_key = new CryptoKey(obj.key, true); _key = new SymmetricCryptoKey(obj.key, true);
} }
callback(_key); callback(_key);
@ -146,7 +146,7 @@ function initCryptoService(constantsService) {
var keyBytes = forge.pbkdf2(forge.util.encodeUtf8(password), forge.util.encodeUtf8(salt), var keyBytes = forge.pbkdf2(forge.util.encodeUtf8(password), forge.util.encodeUtf8(salt),
5000, 256 / 8, 'sha256'); 5000, 256 / 8, 'sha256');
return new CryptoKey(keyBytes); return new SymmetricCryptoKey(keyBytes);
}; };
CryptoService.prototype.hashPassword = function (password, key, callback) { CryptoService.prototype.hashPassword = function (password, key, callback) {
@ -217,7 +217,7 @@ function initCryptoService(constantsService) {
key.encType === constantsService.encType.AesCbc256_B64) { key.encType === constantsService.encType.AesCbc256_B64) {
// Old encrypt-then-mac scheme, swap out the key // Old encrypt-then-mac scheme, swap out the key
_legacyEtmKey = _legacyEtmKey || _legacyEtmKey = _legacyEtmKey ||
new CryptoKey(key.key, false, constantsService.encType.AesCbc128_HmacSha256_B64); new SymmetricCryptoKey(key.key, false, constantsService.encType.AesCbc128_HmacSha256_B64);
key = _legacyEtmKey; key = _legacyEtmKey;
} }
@ -268,7 +268,7 @@ function initCryptoService(constantsService) {
return forge.util.encode64(mac.getBytes()); return forge.util.encode64(mac.getBytes());
} }
function CryptoKey(keyBytes, b64KeyBytes, encType) { function SymmetricCryptoKey(keyBytes, b64KeyBytes, encType) {
if (b64KeyBytes) { if (b64KeyBytes) {
keyBytes = forge.util.decode64(keyBytes); keyBytes = forge.util.decode64(keyBytes);
} }