diff --git a/authenticator.js b/authenticator.js
index 1512174..dbbd79c 100644
--- a/authenticator.js
+++ b/authenticator.js
@@ -5,7 +5,14 @@ var Authenticator = exports.Authenticator || exports;
var Unibabel = window.Unibabel; // || require('unibabel');
var totp = window.totp; // || require('notp').totp;
-if (!window.crypto) {
+function loadForge() {
+ var script = document.createElement('script');
+ script.src = 'demo/bower_components/forge/dist/forge.min.js';
+ script.addEventListener('load', collectRandom);
+ document.body.appendChild(script);
+}
+
+function collectRandom() {
document.addEventListener('mousemove', function (event) {
var ev = event || window.event;
@@ -14,6 +21,14 @@ if (!window.crypto) {
});
}
+if (!window.crypto) {
+ if (!window.forge) {
+ loadForge();
+ } else {
+ collectRandom();
+ }
+}
+
// Generate a key
function generateOtpKey() {
// 20 cryptographically random binary bytes (160-bit key)
diff --git a/index.html b/index.html
index b48f353..ddb85f5 100644
--- a/index.html
+++ b/index.html
@@ -93,7 +93,9 @@
+