29 lines
1.1 KiB
Bash
Executable File
29 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# presence-test.sh — standalone check for FIDO key presence detection.
|
|
#
|
|
# Kept separate from enroll-biometrics.sh: there's nothing to enroll or
|
|
# configure here (fido2-token needs no setup, it just enumerates the key over
|
|
# USB), so bundling it into the enrollment TUI was more confusing than useful.
|
|
#
|
|
# Runs the exact same check presence-detect.sh uses on every poll tick.
|
|
|
|
command -v fido2-token &>/dev/null || {
|
|
printf "\n\033[1;31m fido2-token not found\033[0m (from libfido2).\n"
|
|
printf " Install it: sudo pacman -S libfido2\n\n"
|
|
exit 1
|
|
}
|
|
|
|
printf "\n\033[1;35m Checking for a connected FIDO key...\033[0m\n"
|
|
printf "\033[35m ─────────────────────────────────────────\033[0m\n\n"
|
|
|
|
out=$(fido2-token -L 2>/dev/null)
|
|
if [[ -n "$out" ]]; then
|
|
printf " \033[1;32mFIDO key detected:\033[0m\n\n"
|
|
printf '%s\n' "$out" | sed 's/^/ /'
|
|
printf "\n Presence detection is working correctly.\n\n"
|
|
else
|
|
printf " \033[1;33mNo FIDO key detected.\033[0m\n\n"
|
|
printf " Make sure your key is plugged in.\n\n"
|
|
exit 1
|
|
fi
|