]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Feat: adds "pass" action
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 7 Nov 2020 15:28:48 +0000 (12:28 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 7 Nov 2020 15:28:48 +0000 (12:28 -0300)
ChangeLog
lib/keyringer/actions/pass [new file with mode: 0755]

index 124f69e6cc5af0eb905f8dc85fdb1c581deefd01..474a09f9b0dbca4810f853dae1475ddfb8ce5538 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-11-07 - develop - Silvio Rhatto <rhatto@riseup.net>
+
+       Adds "pass" action behaving like pass(1) for outputing single-line secrets.
+
 2020-01-18 - develop - Silvio Rhatto <rhatto@riseup.net>
 
        Install zsh completion in the default path
diff --git a/lib/keyringer/actions/pass b/lib/keyringer/actions/pass
new file mode 100755 (executable)
index 0000000..7bca7d5
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+#
+# Behave like pass(1), outputing just the first line of a secret.
+#
+
+# Load functions
+LIB="`dirname $0`/../functions"
+source "$LIB" read $* || exit 1
+
+# Get file
+keyringer_get_file "$2"
+
+# Decrypt
+pass="$($GPG --use-agent -d "$KEYDIR/$FILE" 2> /dev/null | head -n 1)"
+
+# Output password
+echo "$pass"
+
+# Exit
+exit "$?"