Updates to nvim to harden for gopass

This commit is contained in:
2024-04-07 00:07:45 -04:00
parent 65e8de5b75
commit 8a9a378f18
5 changed files with 97 additions and 19 deletions

View File

@@ -59,6 +59,10 @@ createCmd(
} }
) )
vim.api.nvim_exec([[
autocmd BufNewFile,BufRead /private/**/gopass** setlocal noswapfile nobackup noundofile shada=""
]], false)
-- Swift -- Swift
-- createCmd( -- createCmd(
-- "FileType", -- "FileType",

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/zsh -l
# Required parameters: # Required parameters:
# @raycast.schemaVersion 1 # @raycast.schemaVersion 1
@@ -17,10 +17,32 @@
# @raycast.authorURL https://github.com/m-housh # @raycast.authorURL https://github.com/m-housh
PREFIX="$HOME/.local/share/password-store" PREFIX="$HOME/.local/share/password-store"
PASS=/opt/homebrew/bin/pass PASS="$(command -v pass)"
key="$1"
selected=$(find "$PREFIX" -type f -name "$2.gpg") #
selected="${selected//$PREFIX/}" # Begin program
selected="${selected//.gpg/}" #
"$PASS" get --clip "$key" "$selected" [ -z "$PASS" ] && \
echo "Error: pass utility not found." && \
exit 1
key="$1"
file="$2"
selected=$(find "$PREFIX" -type f -name "$file.gpg")
# Check if we found a password file at the path.
[ -z "$selected" ] && \
echo "Path not found: $file" && \
exit 1
# Sanitize the path to work with the pass command.
selected="${selected//$PREFIX\//}"
selected="${selected//.gpg/}"
# Capture the result of searching for the key.
result=$("$PASS" get "$key" "$selected")
[ -z "$result" ] && echo "Key not found" && exit 1
echo "$result" | pbcopy
echo "$key: Copied to clipboard"

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/zsh -l
# Required parameters: # Required parameters:
# @raycast.schemaVersion 1 # @raycast.schemaVersion 1
@@ -7,7 +7,7 @@
# Optional parameters: # Optional parameters:
# @raycast.icon 🔐 # @raycast.icon 🔐
# @raycast.argument1 { "type": "text", "placeholder": "for" } # @raycast.argument1 { "type": "text", "placeholder": "For" }
# @raycast.packageName Password # @raycast.packageName Password
# Documentation: # Documentation:
@@ -16,13 +16,32 @@
# @raycast.authorURL https://github.com/m-housh # @raycast.authorURL https://github.com/m-housh
PREFIX="$HOME/.local/share/password-store" PREFIX="$HOME/.local/share/password-store"
PASS=/opt/homebrew/bin/pass LOG=/tmp/pass-copy.out
selected=$(find "$PREFIX" -type f -name "$1".gpg) ISOSEC="$HOME/.local/share/scripts/isosec"
if [ -n "$selected" ]; then PASS="$(command -v pass)"
selected="${selected//$PREFIX/}"
selected="${selected//.gpg/}" _log() {
"$PASS" --clip "$selected" echo "$($ISOSEC) $1" >> "$LOG"
else }
exit 1
fi #
# Begin program
#
[ -z "$PASS" ] && \
echo "Error: pass utility not found." && \
_log "Error: pass utility not found." && \
exit 1
selected=$(find "$PREFIX" -type f -name "$1".gpg)
[ -z "$selected" ] && \
_log "Error: Not Found" && \
_log "Input: $1" && \
exit 1
selected="${selected//$PREFIX\//}"
selected="${selected//.gpg/}"
_log "Running pass with selection: $selected"
"$PASS" --clip "$selected"

View File

@@ -0,0 +1,33 @@
#!/bin/zsh -l
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title pass-gen
# @raycast.mode compact
# Optional parameters:
# @raycast.icon 🔐
# @raycast.argument1 { "type": "text", "placeholder": "Path" }
# @raycast.packageName Password
# Documentation:
# @raycast.description Copy password from password-store
# @raycast.author Michael Housh
# @raycast.authorURL https://github.com/m-housh
PREFIX="$HOME/.local/share/password-store"
PASS="$(command -v pass)"
[ -z "$PASS" ] && \
echo "Error: pass utility not found." && \
exit 1
[ -z "$1" ] && \
echo "Error: must supply a name/path for the password" && \
exit 1
"$PASS" generate --clip "$1"
_log "Ending"

View File

@@ -63,7 +63,7 @@ path_prepend \
"/opt/homebrew/sbin" \ "/opt/homebrew/sbin" \
"$GOROOT/bin" \ "$GOROOT/bin" \
"$GOPATH/bin" \ "$GOPATH/bin" \
"$HOME/.local/bin" \ "$XDG_DATA_HOME/bin" \
"$SCRIPTS" "$SCRIPTS"
# last arg will be first in $FPATH # last arg will be first in $FPATH