Merge pull request #23 from liliakai/fix
Fix exception in options.js on first run
This commit is contained in:
commit
f46d8eaaad
3 changed files with 5 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
var crypto_tests = {};
|
||||
|
||||
window.crypto = (function() {
|
||||
function getRandomBytes(size) {
|
||||
crypto.getRandomBytes = function(size) {
|
||||
//TODO: Better random (https://www.grc.com/r&d/js.htm?)
|
||||
try {
|
||||
var buffer = new ArrayBuffer(size);
|
||||
|
@ -60,7 +60,7 @@ window.crypto = (function() {
|
|||
var privToPub = function(privKey, isIdentity) { return crypto_tests.privToPub(privKey, isIdentity); }
|
||||
|
||||
crypto_tests.createNewKeyPair = function(isIdentity) {
|
||||
return privToPub(getRandomBytes(32), isIdentity);
|
||||
return privToPub(crypto.getRandomBytes(32), isIdentity);
|
||||
}
|
||||
var createNewKeyPair = function(isIdentity) { return crypto_tests.createNewKeyPair(isIdentity); }
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ $('#number').on('change', function() {//TODO
|
|||
});
|
||||
|
||||
var single_device = false;
|
||||
var signaling_key = getRandomBytes(32 + 20);
|
||||
var password = btoa(getString(getRandomBytes(16)));
|
||||
var signaling_key = window.crypto.getRandomBytes(32 + 20);
|
||||
var password = btoa(getString(window.crypto.getRandomBytes(16)));
|
||||
password = password.substring(0, password.length - 2);
|
||||
|
||||
$('#init-go-single-client').click(function() {
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<script type="text/javascript" src="js-deps/Long.min.js"></script>
|
||||
<script type="text/javascript" src="js-deps/ByteBuffer.min.js"></script>
|
||||
<script type="text/javascript" src="js-deps/ProtoBuf.min.js"></script>
|
||||
<script type="text/javascript" src="js/crypto.js"></script>
|
||||
<script type="text/javascript" src="js/api.js"></script>
|
||||
<script type="text/javascript" src="js/helpers.js"></script>
|
||||
<script type="text/javascript" src="js/options.js"></script>
|
||||
|
|
Loading…
Reference in a new issue