Hello Password-Store,
This is my first post to the list so please forgive any breach of
etiquette.
What about adding an option to the show() command that would display
the password in the form of a QR code, for convenient transfer to
unsupported devices?
It could be achieved simply enough using the well known `qrencode` and
`display` from ImageMagick. I have put together a provisional patch
that is working, but not thoroughly tested. I am no master of bash
syntax so there are bound to be some issues.
Anyway please have a look.
From 1d626992f39aa45605ee831c37d283e3555d06fd Mon Sep 17 00:00:00 2001
From: Corey Moncure <[email protected]>
Date: Wed, 21 Dec 2016 23:38:44 -0500
Subject: [PATCH 2/2] Adds QR code output option
---
src/password-store.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/password-store.sh b/src/password-store.sh
index 65a14e9..5b483b7 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -240,8 +240,8 @@ cmd_usage() {
List passwords.
$PROGRAM find pass-names...
List passwords that match pass-names.
- $PROGRAM [show] [--clip[=line-number],-c[line-number],-q] pass-name
- Show existing password and optionally put it on the clipboard.
+ $PROGRAM [show] [--clip[=line-number],-c[line-number] | --qrcode,-q] pass-name
+ Show existing password and optionally put it on the clipboard or display a QR code.
If put on the clipboard, it will be cleared in $CLIP_TIME seconds.
$PROGRAM grep search-string
Search for password files containing search-string when decrypted.
--
2.10.2
From 3471bc14125133d77b467b8e7f12b1a21f7d8d33 Mon Sep 17 00:00:00 2001
From: Corey Moncure <[email protected]>
Date: Wed, 21 Dec 2016 23:21:18 -0500
Subject: [PATCH 1/2] Adds QR code output option to show() via qrencode and
display
---
src/password-store.sh | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/password-store.sh b/src/password-store.sh
index a5a8002..65a14e9 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -240,7 +240,7 @@ cmd_usage() {
List passwords.
$PROGRAM find pass-names...
List passwords that match pass-names.
- $PROGRAM [show] [--clip[=line-number],-c[line-number]] pass-name
+ $PROGRAM [show] [--clip[=line-number],-c[line-number],-q] pass-name
Show existing password and optionally put it on the clipboard.
If put on the clipboard, it will be cleared in $CLIP_TIME seconds.
$PROGRAM grep search-string
@@ -321,28 +321,32 @@ cmd_init() {
}
cmd_show() {
- local opts clip_location clip=0
- opts="$($GETOPT -o c:: -l clip:: -n "$PROGRAM" -- "$@")"
+ local opts clip_location clip=0 qrcode=0
+ opts="$($GETOPT -o qc:: -l qrcode -l clip:: -n "$PROGRAM" -- "$@")"
local err=$?
eval set -- "$opts"
while true; do case $1 in
+ -q|--qrcode) qrcode=1; shift 1;;
-c|--clip) clip=1; clip_location="${2:-1}"; shift 2 ;;
--) shift; break ;;
esac done
- [[ $err -ne 0 ]] && die "Usage: $PROGRAM $COMMAND [--clip[=line-number],-c[line-number]] [pass-name]"
+ [[ $err -ne 0 ]] && die "Usage: $PROGRAM $COMMAND [--clip[=line-number],-c[line-number],--qrcode,-q] [pass-name]"
local path="$1"
local passfile="$PREFIX/$path.gpg"
check_sneaky_paths "$path"
if [[ -f $passfile ]]; then
- if [[ $clip -eq 0 ]]; then
- $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?
- else
+ if [[ $qrcode -eq 1 ]]; then
+ local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n 1)"
+ qrencode -t PNG -s 6 -o - $pass | display
+ elif [[ $clip -eq 1 ]]; then
[[ $clip_location =~ ^[0-9]+$ ]] || die "Clip location '$clip_location' is not a number."
local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +${clip_location} | head -n 1)"
[[ -n $pass ]] || die "There is no password to put on the clipboard at line ${clip_location}."
clip "$pass" "$path"
+ else
+ $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?
fi
elif [[ -d $PREFIX/$path ]]; then
if [[ -z $path ]]; then
--
2.10.2
_______________________________________________
Password-Store mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/password-store