25 lines
484 B
Bash
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
|