mirror of
https://github.com/OutCast3k/coinbin.git
synced 2026-03-06 04:45:35 +01:00
Show warning message if web crypto is not available
This commit is contained in:
parent
f20a32101b
commit
9bac24f177
@ -90,6 +90,7 @@
|
||||
<div id="content" class="container">
|
||||
|
||||
<noscript class="alert alert-danger center-block"><span class="glyphicon glyphicon-exclamation-sign"></span> This page uses javascript, please enable it to continue!</noscript>
|
||||
<div id="cryptoRandomStatus" class="alert alert-danger center-block hidden"><span class="glyphicon glyphicon-exclamation-sign"></span> This browser does not have a secure random number generator! Please use at your own risk!</div>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane tab-content active" id="home">
|
||||
|
||||
10
js/coin.js
10
js/coin.js
@ -45,7 +45,15 @@
|
||||
/* generate crypto secure random numbers (should exist on most browsers) */
|
||||
coinjs.randomBytesSafe = function(count){
|
||||
var cry = window.crypto || window.msCrypto;
|
||||
if (!cry) return '';
|
||||
if (!cry) {
|
||||
/* Display warning message for 30 seconds */
|
||||
$("#cryptoRandomStatus").removeClass("hidden");
|
||||
setTimeout(function(){
|
||||
$("#cryptoRandomStatus").addClass("hidden");
|
||||
}, 30000);
|
||||
|
||||
return '';
|
||||
}
|
||||
var buf = new Uint8Array(count);
|
||||
cry.getRandomValues(buf);
|
||||
return Crypto.util.bytesToHex(buf);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user