This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.pass: skip bulk key decryption for non-decrypting commands

+34 -20
+34 -20
tools/pass/flake-module.nix
··· 43 43 ${envString} 44 44 ${preHook} 45 45 46 - # Check if bulk key file should be used for decryption 47 - if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]]; then 48 - if [[ ! -f "$PASS_BULK_KEY_FILE" ]] || [[ ! -s "$PASS_BULK_KEY_FILE" ]]; then 49 - mkdir -p "$(dirname "$PASS_BULK_KEY_FILE")" 50 - ${exePath} show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true 51 - fi 52 - fi 46 + # Determine if the command needs decryption 47 + needs_decrypt=true 48 + case "''${1:-}" in 49 + ls|find|git|insert|generate|rm|mv|cp|help|version|init) 50 + needs_decrypt=false 51 + ;; 52 + esac 53 53 54 - # Set up identities for age decryption 55 - if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]] && [[ -f "$PASS_BULK_KEY_FILE" ]] && [[ -s "$PASS_BULK_KEY_FILE" ]]; then 56 - # Use bulk key if available 57 - export PASSAGE_IDENTITIES_FILE="$PASS_BULK_KEY_FILE" 58 - else 59 - # Detect available age keys 60 - export AGE_DETECT_KEYS_DIR="${self}/keys" 61 - eval "$(age-detect)" 62 - 63 - # Set up identity file if detected 64 - if [[ -n "''${IDENTITY_FILE:-}" ]]; then 65 - export PASSAGE_IDENTITIES_FILE="$IDENTITY_FILE" 66 - trap 'rm -f "$IDENTITY_FILE"' EXIT 54 + setup_identities() { 55 + # Check if bulk key file should be used for decryption 56 + if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]]; then 57 + if [[ ! -f "$PASS_BULK_KEY_FILE" ]] || [[ ! -s "$PASS_BULK_KEY_FILE" ]]; then 58 + mkdir -p "$(dirname "$PASS_BULK_KEY_FILE")" 59 + ${exePath} show bulk-operations/age-key > "$PASS_BULK_KEY_FILE" 2>/dev/null || true 60 + fi 67 61 fi 62 + 63 + # Set up identities for age decryption 64 + if [[ -n "''${PASS_BULK_KEY_FILE:-}" ]] && [[ -f "$PASS_BULK_KEY_FILE" ]] && [[ -s "$PASS_BULK_KEY_FILE" ]]; then 65 + # Use bulk key if available 66 + export PASSAGE_IDENTITIES_FILE="$PASS_BULK_KEY_FILE" 67 + else 68 + # Detect available age keys 69 + export AGE_DETECT_KEYS_DIR="${self}/keys" 70 + eval "$(age-detect)" 71 + 72 + # Set up identity file if detected 73 + if [[ -n "''${IDENTITY_FILE:-}" ]]; then 74 + export PASSAGE_IDENTITIES_FILE="$IDENTITY_FILE" 75 + trap 'rm -f "$IDENTITY_FILE"' EXIT 76 + fi 77 + fi 78 + } 79 + 80 + if [[ "$needs_decrypt" == true ]]; then 81 + setup_identities 68 82 fi 69 83 70 84 ${