work on prompt() solution

This commit is contained in:
Kevin F 2021-10-12 18:36:09 +00:00
parent b84a28f062
commit bd81c3c582
4 changed files with 27 additions and 11 deletions

View File

@ -12,7 +12,7 @@ There are spy libraries that can determine how long keys are held down and the t
This addon was created to skew the key press timing by limiting the speed of presses. The speed is changed randomly on each page load, with a min of 150ms and a max of 300ms.
It uses a less than ideal thread locking solution, as simply buffering text does not stop event listeners from spies.
It uses a less than ideal thread locking solution, as simply buffering text does not stop event listeners from spies. **Now it also has a non-default setting to use prompt() on non-password single line input elements. This reduces CPU usage and increase typing speed while offering better protection than the delay approach.**
You can whitelist domains that you trust on the addon settings page, but it was decided not to support changing the key speed manually as that would add another fingerprinting avenue.

View File

@ -19,6 +19,13 @@
const defaultHosts = "<all_urls>";
let appCode = function (){
let popupEnabled = false
let popupGetter = browser.storage.sync.get("keyboardprivacyprompt")
popupGetter.then(function(val){
popupEnabled = val['keyboardprivacyprompt']
console.debug(popupEnabled)
}, function(){})
let clearSelect = function()
{
if (window.getSelection) {window.getSelection().removeAllRanges()}
@ -45,13 +52,10 @@ let appCode = function (){
if (! inputType){
text = prompt("[PrivateKeyboard]\n\nEnter text for the text field:", e.target.value)
}
else if (! ["text", "search", "email", "password", "number"].includes(inputType.toLowerCase())){
else if (! ["text", "search", "email", "number"].includes(inputType.toLowerCase())){
return
}
else{
if (inputType == "password"){
inputType = "password (SHOWN IN PLAIN TEXT)"
}
text = prompt("[PrivateKeyboard]\n\nEnter text for the " + inputType + " field:", e.target.value)
}
if (text !== null) {
@ -66,8 +70,9 @@ let appCode = function (){
let popupMode = function(){
document.addEventListener('focusin', doPopup, true)
if (popupEnabled){
document.addEventListener('focusin', doPopup, true)
}
}
@ -124,11 +129,12 @@ let appCode = function (){
return true;
}
else{
console.debug(e.key)
}
setTimeout(
function(){doPopup(e)}, 10)
if (popupEnabled){
setTimeout(
function(){doPopup(e)}, 10)
}
pausecomp(down);
return true;

View File

@ -10,7 +10,7 @@
<form>
<input type="checkbox" id="usePrompt">
<label for="usePrompt">Use prompt() dialogs on single-line inputs. This option will reveal typed passwords and may break some websites, but allows for faster typing and less CPU usage.</label>
<label for="usePrompt">Use prompt() dialogs on single-line inputs. Faster typing and less CPU usage, but can break some websites and features like autocomplete.</label>
<br>
<input type="checkbox" id="whitelistLAN">
<label for="whitelistLAN">Whitelist private IP + localhost range hostnames (e.g. routers)</label>

View File

@ -24,6 +24,9 @@ function saveOptions(e) {
browser.storage.sync.set({
keyboardprivacylan: document.querySelector("#whitelistLAN").checked
})
browser.storage.sync.set({
keyboardprivacyprompt: document.querySelector("#usePrompt").checked
})
document.getElementById('saved').innerHTML = '<br><b>Saved</b>'
setTimeout(function(){
document.getElementById('saved').innerHTML = '<br>'
@ -42,6 +45,10 @@ function saveOptions(e) {
document.querySelector("#whitelistLAN").checked = result['keyboardprivacylan']
}
function setCurrentPrompt(result){
document.querySelector("#usePrompt").checked = result['keyboardprivacyprompt']
}
function onError(error) {
console.log(`Error: ${error}`);
}
@ -51,6 +58,9 @@ function saveOptions(e) {
let gettingLAN = browser.storage.sync.get("keyboardprivacylan");
gettingLAN.then(setCurrentLAN, onError);
let gettingPrompt = browser.storage.sync.get("keyboardprivacyprompt");
gettingPrompt.then(setCurrentPrompt, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);