Commit d3149095 authored by Sascha's avatar Sascha

Merge branch 'develop' into 'master'

Preparing v1.8.3

See merge request psono/psono-client!100
parents 7a132b13 e4512e86
......@@ -395,7 +395,7 @@ function() {
/**
* Deploys the Chrome Extension to the Chrome Web Store
*/
gulp.task('chrome-deploy', function() {
gulp.task('chrome-deploy', function(cb) {
var client_id = process.env.webstore_client_id;
var client_secret = process.env.webstore_client_secret;
......@@ -428,12 +428,14 @@ gulp.task('chrome-deploy', function() {
.catch(function(err) {
console.error(err);
});
cb();
});
/**
* Deploys the Firefox Extension to the Firefox Web Store
*/
gulp.task('firefox-deploy', function() {
gulp.task('firefox-deploy', function(cb) {
var jwt_issuer = process.env.mozilla_jwt_issuer;
var jwt_secret = process.env.mozilla_jwt_secret;
......@@ -452,8 +454,9 @@ gulp.task('firefox-deploy', function() {
algorithm: 'HS256' // HMAC-SHA256 signing algorithm
});
return run('curl "https://addons.mozilla.org/api/v3/addons/'+mozilla_addon_id+'/versions/'+ version +'/" -g -XPUT --form "upload=@firefox-extension.zip" -H "Authorization: JWT '+ token +'"').exec()
.pipe(gulp.dest('output'));
run('curl "https://addons.mozilla.org/api/v3/addons/'+mozilla_addon_id+'/versions/'+ version +'/" -g -XPUT --form "upload=@firefox-extension.zip" -H "Authorization: JWT '+ token +'"').exec();
cb();
});
......
......@@ -4,11 +4,13 @@
/**
* @ngdoc service
* @name psonocli.device
* @requires psonocli.storage
* @requires psonocli.cryptoLibrary
* @description
*
* Service with some device functions that do not fit anywhere else
*/
var device = function($q) {
var device = function(storage, cryptoLibrary) {
var client_js = new ClientJS();
......@@ -16,26 +18,7 @@
activate();
function activate() {
get_device_fingerprint_async().then(function(local_fingerprint){
fingerprint = local_fingerprint;
})
}
/**
* @ngdoc
* @name psonocli.device#get_device_fingerprint_async
* @methodOf psonocli.device
*
* @description
* Returns the device fingerprint
*
* @returns {promise} Returns promise with the device fingerprint
*/
function get_device_fingerprint_async() {
return $q(function(resolve, reject) {
resolve(client_js.getFingerprint());
});
}
/**
......@@ -49,10 +32,15 @@
* @returns {string} Fingerprint of the device
*/
function get_device_fingerprint() {
if (fingerprint) {
return fingerprint;
fingerprint = storage.find_key('persistent', 'fingerprint');
if (fingerprint == null) {
fingerprint = cryptoLibrary.generate_uuid();
storage.upsert('persistent', {key: 'fingerprint', value: fingerprint});
} else {
fingerprint = fingerprint['value'];
}
fingerprint = client_js.getFingerprint();
return fingerprint;
}
......@@ -172,6 +160,6 @@
};
var app = angular.module('psonocli');
app.factory("device", ['$q', device]);
app.factory("device", ['storage', 'cryptoLibrary', device]);
}(angular, ClientJS));
......@@ -112,7 +112,6 @@
* @returns {promise} Promise with the datastore that belongs to the given id
*/
var get_datastore_with_id = function (datastore_id) {
var onError = function(result) {
// pass
};
......
......@@ -11,7 +11,7 @@
}));
it('get_device_fingerprint', inject(function (device) {
expect(device.get_device_fingerprint()).toEqual(jasmine.any(Number));
expect(device.get_device_fingerprint()).toEqual(jasmine.any(String));
}));
it('is_ie', inject(function (device) {
......
......@@ -80,6 +80,9 @@
},
decrypt_data: function(text, nonce, secret_key) {
return JSON.stringify(decrypted_data)
},
generate_uuid: function() {
return 'a60c07a2-132a-47b3-9b94-1cfd5771aaae'
}
};
......
......@@ -89,6 +89,9 @@
},
generate_public_private_keypair: function() {
return public_private_keypair;
},
generate_uuid: function() {
return 'a60c07a2-132a-47b3-9b94-1cfd5771aaae'
}
};
......
......@@ -90,6 +90,9 @@
},
generate_public_private_keypair: function() {
return public_private_keypair;
},
generate_uuid: function() {
return 'a60c07a2-132a-47b3-9b94-1cfd5771aaae'
}
};
......
......@@ -93,6 +93,9 @@
},
decrypt_data: function(text, nonce, secret_key) {
return JSON.stringify(decrypted_data)
},
generate_uuid: function() {
return 'a60c07a2-132a-47b3-9b94-1cfd5771aaae'
}
};
......
......@@ -80,6 +80,9 @@
},
decrypt_data: function(text, nonce, secret_key) {
return JSON.stringify(decrypted_data)
},
generate_uuid: function() {
return 'a60c07a2-132a-47b3-9b94-1cfd5771aaae'
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment