diff options
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/id-init | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/.local/bin/id-init b/.local/bin/id-init index d51660a..11221c3 100755 --- a/.local/bin/id-init +++ b/.local/bin/id-init | |||
@@ -12,9 +12,17 @@ | |||
12 | # gpg-preset-passphrase respects gpg-agent's --max-cache-ttl option which defaults to 2 hours | 12 | # gpg-preset-passphrase respects gpg-agent's --max-cache-ttl option which defaults to 2 hours |
13 | # you may want to increase that if you want the password to be cached for the whole session | 13 | # you may want to increase that if you want the password to be cached for the whole session |
14 | 14 | ||
15 | get_pass() { | ||
16 | continue=1 | ||
17 | while [ $continue -eq 1 ] | ||
18 | do | ||
19 | keepassxc-cli show $XDG_CONFIG_HOME/keepassxc/Passwords.kdbx -a Password GPG | ||
20 | continue=$? | ||
21 | done | ||
22 | } | ||
23 | |||
15 | KEYGRIP="$(gpg -K --with-keygrip --with-colons | grep grp | tail -n 1 | cut -d':' -f10)" | 24 | KEYGRIP="$(gpg -K --with-keygrip --with-colons | grep grp | tail -n 1 | cut -d':' -f10)" |
16 | /usr/lib/gnupg/gpg-preset-passphrase --preset $KEYGRIP \ | 25 | /usr/lib/gnupg/gpg-preset-passphrase --preset $KEYGRIP <<< "$(get_pass)" |
17 | <<< "$(keepassxc-cli show $XDG_CONFIG_HOME/keepassxc/Passwords.kdbx -a Password GPG)" | ||
18 | 26 | ||
19 | # Open graphical KeePassXC with password stored in pass, now that pass can be accessed | 27 | # Open graphical KeePassXC with password stored in pass, now that pass can be accessed |
20 | # without entering credentials for the GPG key | 28 | # without entering credentials for the GPG key |