···3131 fi
3232 fi
33333434- # Check for gpg-agent with an encryption subkey (third priority).
3434+ # Check for a running phonetpm daemon (third priority - phone over iroh,
3535+ # every decryption asks for a fingerprint on the phone).
3636+ # Requires: control socket of configs/phonetpm.nix and phonetpm.identity.
3737+ local phone_identity="${AGE_DETECT_KEYS_DIR:-}/age/phonetpm.identity"
3838+ if [[ -S "${XDG_RUNTIME_DIR:-}/phonetpm/control.sock" ]] && [[ -f "$phone_identity" ]]; then
3939+ cp "$phone_identity" "$temp_identities"
4040+ echo "IDENTITY_FILE=$temp_identities"
4141+ echo "DETECTED_KEY=phonetpm"
4242+ echo "KEY_TYPE=phone"
4343+ return
4444+ fi
4545+4646+ # Check for gpg-agent with an encryption subkey (fourth priority).
3547 # Frictionless after the first decrypt because gpg-agent caches the
3648 # passphrase / smartcard PIN, so we prefer it over yubikey/solo2.
3749 if command -v gpg-connect-agent >/dev/null 2>&1 \
···4557 return
4658 fi
47594848- # Check for YubiKeys (fourth priority)
6060+ # Check for YubiKeys (fifth priority)
4961 if command -v ykman >/dev/null 2>&1; then
5062 local yubikey_serial
5163 yubikey_serial=$(ykman info 2>/dev/null | grep "Serial number:" | cut -d: -f2 | tr -d ' ' || true)
···98110 echo "Detects the first available age-compatible security key and outputs:"
99111 echo " IDENTITY_FILE=<path> - Path to temporary identity file for age (empty for Solo2)"
100112 echo " DETECTED_KEY=<name> - Name of the detected key (e.g., yubi1, solo2, se)"
101101- echo " KEY_TYPE=<type> - Type of key (yubikey, solo2, se)"
113113+ echo " KEY_TYPE=<type> - Type of key (yubikey, solo2, se, tpm, phone, gpg)"
102114 echo ""
103103- echo "Priority order: se > tpm > gpg > yubikey > solo2"
115115+ echo "Priority order: se > tpm > phone > gpg > yubikey > solo2"
104116 ;;
105117 *)
106118 echo "Unknown command: $1" >&2