Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to 1password #29

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions 1password/.flox/env/manifest.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
"pkg-path": "_1password"
}
},
"vars": {},
"hook": {
"on-activate": "\n # Start OP injection code\n if ! op vault list >/dev/null 2>&1; then\n CACHE=\"$HOME/.cache/op-session\"\n OP_TOKEN=$( [[ -f \"$CACHE\" ]] && cat \"$CACHE\" || op signin --raw 2>&1 )\n if op whoami --session \"${OP_TOKEN}\" >/dev/null 2>&1; then\n mkdir -p dirname \"$CACHE\" 2>/dev/null && echo \"${OP_TOKEN}\" > \"$CACHE\"\n chmod 600 \"$CACHE\"\n else\n echo \"op auth failed!\" && return 1\n fi\n fi\n export op_token=$( [[ \"$OP_TOKEN\" ]] && echo \"--session $OP_TOKEN\" )\n # End OP injection code\n\n export ANTHROPIC_API_KEY=$(op $op_token item get \"Anthropic\" --field \"credential\")\n export TAILSCALE_TOKEN=$(op $op_token item get \"Tailscale\" --field \"token\")\n"
"on-activate": "\n # Start OP injection code\n if ! op vault list >/dev/null 2>&1; then\n CACHE=\"$HOME/.cache/op-session\"\n OP_TOKEN=$( [[ -f \"$CACHE\" ]] && cat \"$CACHE\" || op signin --raw 2>&1 )\n if op whoami --session \"${OP_TOKEN}\" >/dev/null 2>&1; then\n mkdir -p $(dirname \"$CACHE\") 2>/dev/null && echo \"${OP_TOKEN}\" > \"$CACHE\"\n chmod 600 \"$CACHE\"\n else\n echo \"op auth failed!\" && return 1\n fi\n fi\n export op_token=$( [[ \"$OP_TOKEN\" ]] && echo \"--session $OP_TOKEN\" )\n # End OP injection code\n\n export ANTHROPIC_API_KEY=$(op $op_token item get \"Anthropic\" --field \"credential\")\n export TAILSCALE_TOKEN=$(op $op_token item get \"Tailscale\" --field \"token\")\n"
},
"profile": {
"common": " alias op=\"op $op_token\"\n"
Expand Down
2 changes: 1 addition & 1 deletion 1password/.flox/env/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on-activate = '''
CACHE="$HOME/.cache/op-session"
OP_TOKEN=$( [[ -f "$CACHE" ]] && cat "$CACHE" || op signin --raw 2>&1 )
if op whoami --session "${OP_TOKEN}" >/dev/null 2>&1; then
mkdir -p dirname "$CACHE" 2>/dev/null && echo "${OP_TOKEN}" > "$CACHE"
mkdir -p $(dirname "$CACHE") 2>/dev/null && echo "${OP_TOKEN}" > "$CACHE"
chmod 600 "$CACHE"
else
echo "op auth failed!" && return 1
Expand Down
80 changes: 0 additions & 80 deletions 1password/manifest-comments.toml

This file was deleted.

13 changes: 13 additions & 0 deletions 1password/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -eo pipefail

command_exists() {
if ! command -v $1 2>&1 >/dev/null; then
echo "Error: '$1' command could not be found."
return 1
fi
echo ">>> '$1' command exists"
}

command_exists op
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
| **Applications:** |
| `nb` | ✅ | ✅ | ✅ | IPython notebook |
| `a-perfect-shell` | ✅ | ✅ | ✅ | An opinionated shell environment |
| `1password` | | | | |
| `1password` | ✅ | ✅ | | 1Password + a simple shell helper |
| `anthropic` | | | | |
| `direnv` | | | | |
| `flaim` | | | | |
Expand Down
Loading