Files
zotp-bash/demo-verifyotp.sh
2026-06-06 21:36:42 +02:00

25 lines
484 B
Bash

#!/bin/bash
## zOTP Bash Demo for making a 6 digit OTP using Blake2 and being valid for 10 minutes
## Usage:
## ./demo-makeotp.sh "{string-unique-to-user}" {otp}
declare thesalt="zOTP by Ze'ev Schurmann"
source zotp.inc.sh
if [[ -z "${1}" ]] || [[ -z "${2}" ]]; then
echo "Usage:" >&2
echo " $0 \"{string-unique-to-user}\" {otp}" >&2
exit 1
fi
declare theseed="${1}"
if testOTP ${2} 10 b2 q; then
echo "OTP is valid..."
else
echo "OTP is invalid or expired..."
fi