enpass-cli
enpass-cli copied to clipboard
Password should be cleared from clipboard after time threshold
Similarly to how the desktop GUI handles it, when copying the password from the Enpass wallet, the CLI should clear the password from the clipboard after, say, 30 seconds so the password does not remain in the user's clipboard. I keep having to run xsel -bc
after copying my passwords and it would be nice if the CLI could handle this. Maybe the process could fork to the background and set the clipboard to a space or null character then terminate.
Problem is this is very OS-specific. In lastpass-cli, I 'solved' it by specifying an alias for lpass copy | xsel -bc
You mean the solution to clear the clipboard is OS-specific? Maybe you don't have to run a command specific to clearing the clipboard, just run copyToClip(" ")
or copyToClip("\0")
(if that works) after some time in the background.
That would involve forking into a new process that calls a timer and clears the clipboard. I welcome a PR. :-)
e.g. in pseudocode;
fork(copyToClip(copiedPass))
def copyToClip(pass):
copyToClipboard(pass)
time.Sleep(minute)
if clip.getClipboard() == pass:
copyToClipboard("")
Welp, I've moved on to pass, so I don't really use this software anymore :/
For linux/bash I'm achieving this in a wrapper function by trapping an xclip on SIGUSR1
and killing the process 30s later:
function enpasscli-copy-primary() {
enpasscli -clipboardPrimary copy "$@" \
&& trap 'xclip -i < /dev/null' SIGUSR1 \
&& local current_pid=$BASHPID \
&& ( ( sleep 30; kill -SIGUSR1 $current_pid ) & ) > /dev/null 2>&1
}
adapt the xclip command if you prefer xsel or a different X selection.