diff --git a/settings/keybuffer2.js b/settings/keybuffer2.js index a9a9fe7..4a8d213 100644 --- a/settings/keybuffer2.js +++ b/settings/keybuffer2.js @@ -9,6 +9,7 @@ let usingUnicode = function(result){ } } + let doUnicode = browser.storage.sync.get("keyboardprivacyunicode"); doUnicode.then(usingUnicode, onError); diff --git a/settings/unicodemapping.js b/settings/unicodemapping.js index e97f701..964e226 100644 --- a/settings/unicodemapping.js +++ b/settings/unicodemapping.js @@ -1,3 +1,16 @@ +let randNum = function(minValue, maxValue){ + let buf = new Uint8Array(1) + while (true){ + window.crypto.getRandomValues(buf); + + if (buf[0] <= maxValue && buf[0] >= minValue){ + break; + } + buf = new Uint8Array(1); + } + return buf[0]; + } + let getUnicode = function(input){ const uc = { @@ -103,8 +116,8 @@ let getUnicode = function(input){ output += element } else{ - output += uc[element][0] + output += uc[element][randNum(0, uc[element].length - 1)] } }) return output - } \ No newline at end of file + }