Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password should be cleared from clipboard after time threshold #13

Open
i077 opened this issue Jun 27, 2018 · 5 comments
Open

Password should be cleared from clipboard after time threshold #13

i077 opened this issue Jun 27, 2018 · 5 comments

Comments

@i077
Copy link

i077 commented Jun 27, 2018

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.

@hazcod
Copy link
Owner

hazcod commented Jun 27, 2018

Problem is this is very OS-specific. In lastpass-cli, I 'solved' it by specifying an alias for lpass copy | xsel -bc

@i077
Copy link
Author

i077 commented Jun 27, 2018

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.

@hazcod
Copy link
Owner

hazcod commented Nov 29, 2018

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("")

@i077
Copy link
Author

i077 commented Dec 16, 2018

Welp, I've moved on to pass, so I don't really use this software anymore :/

@msladek
Copy link
Contributor

msladek commented Jul 16, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants