2016-05-28 11:13:54 +00:00
|
|
|
define([
|
2016-06-06 10:35:06 +00:00
|
|
|
'/bower_components/chainpad-crypto/crypto.js'
|
2016-05-28 11:13:54 +00:00
|
|
|
], 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;
|
|
|
|
});
|