do away with a bit of boilerplate

This commit is contained in:
ansuz
2016-05-28 13:13:54 +02:00
parent e189092ba8
commit a0c73c95d8
2 changed files with 25 additions and 14 deletions

View File

@@ -0,0 +1,19 @@
define([
'/common/crypto.js',
], function (Crypto) {
var common = {};
var getSecrets = common.getSecrets = function () {
var secret = {};
if (!/#/.test(window.location.href)) {
secret.key = Crypto.genKey();
} else {
var hash = window.location.hash.slice(1);
secret.channel = hash.slice(0, 32);
secret.key = hash.slice(32);
}
return secret;
};
return common;
});