aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Frische <kfr@x-integrate.com>2023-06-15 16:46:55 +0200
committerKai Frische <kfr@x-integrate.com>2023-06-15 16:46:55 +0200
commitc0c171d22159688e5264e70d1b3c9b61b1030fc9 (patch)
tree1233a0ff464b5cbd1ee2939ff74181e9ca313bd7
parente718bd4ca538d6967b8bbc39f75fa98b42fe3e70 (diff)
downloadrbw-c0c171d22159688e5264e70d1b3c9b61b1030fc9.tar.gz
rbw-c0c171d22159688e5264e70d1b3c9b61b1030fc9.zip
Add help to rbw-pinentry-keyring.
-rwxr-xr-xbin/rbw-pinentry-keyring45
1 files changed, 29 insertions, 16 deletions
diff --git a/bin/rbw-pinentry-keyring b/bin/rbw-pinentry-keyring
index 9e319b8..1626853 100755
--- a/bin/rbw-pinentry-keyring
+++ b/bin/rbw-pinentry-keyring
@@ -1,20 +1,26 @@
#!/bin/bash
-# Use as pinentry to store master password for rbw into keyring
-# Usage
-# - run "rbw-pinentry-keyring setup" once to save master password to keyring
-# - add "rbw-pinentry-keyring" as "pinentry" in rbw config (${XDG_CONFIG_HOME}/rbw/config.json)
-# - use rbw as normal
-# Notes
-# - setup tested with pinentry-gnome3, but you can run the "secret-tool store"-command manually as well
-# - master passwords are stored into the keyring as plaintext, so secure your keyring appropriately
-# - supports multiple profiles, simply set RBW_PROFILE during setup
-# - can easily be rewritten to use other backends than keyring by setting the "secret_value"-variable
-
[[ -z "${RBW_PROFILE}" ]] && rbw_profile='rbw' || rbw_profile="rbw-${RBW_PROFILE}"
set -eEuo pipefail
+function help() {
+ cat <<EOHELP
+Use this script as pinentry to store master password for rbw into your keyring
+
+Usage
+- run "rbw-pinentry-keyring setup" once to save master password to keyring
+- add "rbw-pinentry-keyring" as "pinentry" in rbw config (${XDG_CONFIG_HOME}/rbw/config.json)
+- use rbw as normal
+Notes
+- needs "secret-tool" to access keyring
+- setup tested with pinentry-gnome3, but you can run the "secret-tool store"-command manually as well
+- master passwords are stored into the keyring as plaintext, so secure your keyring appropriately
+- supports multiple profiles, simply set RBW_PROFILE during setup
+- can easily be rewritten to use other backends than keyring by setting the "secret_value"-variable
+EOHELP
+}
+
function setup() {
cmd="SETTITLE rbw\n"
cmd+="SETPROMPT Master Password\n"
@@ -52,8 +58,15 @@ function getpin() {
done
}
-if [ "$1" == "setup" ]; then
- setup
-else
- getpin
-fi
+command="$1"
+case "$command" in
+ -h|--help|help)
+ help
+ ;;
+ -s|--setup|setup)
+ setup
+ ;;
+ *)
+ getpin
+ ;;
+esac