Skip to content

Commit

Permalink
Merge pull request #20 from CGenie/transient
Browse files Browse the repository at this point in the history
Transient
  • Loading branch information
CGenie authored Feb 4, 2019
2 parents 2815dda + 81937b3 commit b40a185
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 58 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
See [Keep a CHANGELOG](http://keepachangelog.com/) for more details.

## [Unreleased]

## [0.3.4] - 2018-02-04
### Added
- pass-otp support
### Changed
- we now use Alfred's transient clipboard (for `pass`, not for `po` yet), kudos
to @bgshiller!
- recommended to use `pinentry.sh` instead of `pinentry-mac`

## [0.3.3] - 2018-06-18
### Added
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ Next configure `gpg-agent` to use `pinentry-mac` and not the bundled one, editin
pinentry-program /usr/local/bin/pinentry-mac
```

If you prefer to keep the terminal version of `pinentry` you can use the
`pinentry.sh` wrapper from this repository as the `pinentry-program`. This will
use the ncurses version when in console and the GUI version for Alfred etc.

You can also take a look at [this blog post from @bshiller](https://brianschiller.com/blog/2016/08/31/gnu-pass-alfred).

### GPG tweaking

You can tweak some of the `gpg-agent` settings in `~/.gnupg/gpg-agent.conf`:

```
max-cache-ttl 7200
```

After 7200 seconds, GPG will forget your master password.

## Installation

After your system is set up as described above, download the latest package from
Expand Down
135 changes: 85 additions & 50 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
<dict>
<key>bundleid</key>
<string>pl.intrepidus.pass</string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>7DD3BDE5-A157-42E5-9376-F681FB50A4EE</key>
<key>06C9C4A9-38CE-441A-8D06-E2F2D8B39B60</key>
<array>
<dict>
<key>destinationuid</key>
<string>06C9C4A9-38CE-441A-8D06-E2F2D8B39B60</string>
<string>C7B97C94-3D0B-471E-96EE-A441A1FAB184</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
Expand All @@ -21,11 +19,11 @@
<false/>
</dict>
</array>
<key>97122574-1811-40EE-8FA3-CA5A7E8CB809</key>
<key>7DD3BDE5-A157-42E5-9376-F681FB50A4EE</key>
<array>
<dict>
<key>destinationuid</key>
<string>0D9D4DE6-36FF-459E-9457-B3CAD298670C</string>
<string>06C9C4A9-38CE-441A-8D06-E2F2D8B39B60</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
Expand All @@ -47,6 +45,19 @@
<false/>
</dict>
</array>
<key>97122574-1811-40EE-8FA3-CA5A7E8CB809</key>
<array>
<dict>
<key>destinationuid</key>
<string>0D9D4DE6-36FF-459E-9457-B3CAD298670C</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Przemek Kamiński</string>
Expand All @@ -58,29 +69,6 @@
<string>pass</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>bash pass-show.sh "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>06C9C4A9-38CE-441A-8D06-E2F2D8B39B60</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -136,7 +124,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>bash pass-generate.sh "{query}"</string>
<string>bash pass-show.sh "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
Expand All @@ -147,30 +135,26 @@
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>0D9D4DE6-36FF-459E-9457-B3CAD298670C</string>
<string>06C9C4A9-38CE-441A-8D06-E2F2D8B39B60</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>keyword</key>
<string>pg</string>
<key>subtext</key>
<string></string>
<key>text</key>
<string>Generate password</string>
<key>withspace</key>
<true/>
<key>autopaste</key>
<false/>
<key>clipboardtext</key>
<string>{query}</string>
<key>transient</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<string>alfred.workflow.output.clipboard</string>
<key>uid</key>
<string>97122574-1811-40EE-8FA3-CA5A7E8CB809</string>
<string>C7B97C94-3D0B-471E-96EE-A441A1FAB184</string>
<key>version</key>
<integer>1</integer>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
Expand All @@ -180,7 +164,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>bash pass-otp.sh "{query}"</string>
<string>bash pass-generate.sh "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
Expand All @@ -191,10 +175,31 @@
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>118228AE-EF0F-48D4-AE63-F97A9290F4FA</string>
<string>0D9D4DE6-36FF-459E-9457-B3CAD298670C</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>keyword</key>
<string>pg</string>
<key>subtext</key>
<string></string>
<key>text</key>
<string>Generate password</string>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>97122574-1811-40EE-8FA3-CA5A7E8CB809</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -242,6 +247,29 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>bash pass-otp.sh "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>118228AE-EF0F-48D4-AE63-F97A9290F4FA</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string></string>
Expand Down Expand Up @@ -275,23 +303,30 @@
<key>ypos</key>
<real>60</real>
</dict>
<key>967E625E-D870-4298-9A7A-97C043740D99</key>
<dict>
<key>xpos</key>
<integer>300</integer>
<key>ypos</key>
<real>300</real>
</dict>
<key>97122574-1811-40EE-8FA3-CA5A7E8CB809</key>
<dict>
<key>xpos</key>
<integer>300</integer>
<key>ypos</key>
<real>180</real>
</dict>
<key>967E625E-D870-4298-9A7A-97C043740D99</key>
<key>C7B97C94-3D0B-471E-96EE-A441A1FAB184</key>
<dict>
<key>xpos</key>
<integer>300</integer>
<integer>680</integer>
<key>ypos</key>
<real>300</real>
<integer>60</integer>
</dict>
</dict>
<key>version</key>
<string>0.3.3</string>
<string>0.3.4</string>
<key>webaddress</key>
<string>https://github.com/CGenie/alfred-pass</string>
</dict>
Expand Down
16 changes: 8 additions & 8 deletions pass-show.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ QUERY=$1
PATH=/usr/local/bin:$PATH

# GPG agent
envfile="$HOME/.gnupg/gpg-agent.env"
if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
eval "$(cat "$envfile"); export GPG_AGENT_INFO"
else
eval "$(gpg-agent --daemon --write-env-file "$envfile")"
fi
#envfile="$HOME/.gnupg/gpg-agent.env"
#if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
# eval "$(cat "$envfile"); export GPG_AGENT_INFO"
#else
# eval "$(gpg-agent --daemon --write-env-file "$envfile")"
#fi

# PASS
#pass show "$QUERY" | awk 'BEGIN{ORS=""} {print; exit}' | pbcopy
pass show -c "$QUERY"
PINENTRY_USER_DATA=gui pass show "$QUERY" | awk 'BEGIN{ORS=""} {print; exit}'
#pass show -c "$QUERY"
osascript -e 'display notification "Copied password to clipboard" with title "Unix pass"'
14 changes: 14 additions & 0 deletions pinentry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# choose pinentry depending on PINENTRY_USER_DATA
# requires pinentry-curses and pinentry-mac
# this *only works* with gpg 2
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802020

case $PINENTRY_USER_DATA in
gui)
exec pinentry-mac "$@"
;;
*)
exec pinentry "$@"
esac

0 comments on commit b40a185

Please sign in to comment.