[PATCH] enable storing very long passwords

Forrest Loomis loomis.forrest at gmail.com
Thu Jun 5 21:07:17 UTC 2025


When trying to store an incredibly long JWT token, the token would be
truncated.

Use readline (read -e) when retrieving the user password. This allows us
to input much longer passwords.
---
 src/password-store.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index 22e818f..88b4a1b 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -463,9 +463,9 @@ cmd_insert() {
        elif [[ $noecho -eq 1 ]]; then
                local password password_again
                while true; do
-                       read -r -p "Enter password for $path: " -s
password || exit 1
+                       read -e -r -p "Enter password for $path: " -s
password || exit 1
                        echo
-                       read -r -p "Retype password for $path: " -s
password_again || exit 1
+                       read -e -r -p "Retype password for $path: " -s
password_again || exit 1
                        echo
                        if [[ $password == "$password_again" ]]; then
                                echo "$password" | $GPG -e
"${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" || die
"Password encryption aborted."
@@ -476,7 +476,7 @@ cmd_insert() {
                done
        else
                local password
-               read -r -p "Enter password for $path: " -e password
+               read -e -r -p "Enter password for $path: " -e password
                echo "$password" | $GPG -e "${GPG_RECIPIENT_ARGS[@]}"
-o "$passfile" "${GPG_OPTS[@]}" || die "Password encryption aborted."
        fi
        git_add_file "$passfile" "Add given password for $path to store."
--
2.49.0


More information about the Password-Store mailing list