NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: TOTP apps, and WebAuthn recommended devices?



> I wonder if there are good TOTP programs in pkgsrc and what
> people recommend.

I'm a happy user of "oath-toolkit', too.

I wrapped that into a small shell script which lets me easily select
any of the few TOTP secrets I have collected so far.  It also tracks
the token changes on the full and half minute.

					Have fun, Martin

#/bin/sh

case "$1" in
	-h*)    secret=YOUR ;;
	-z*)    secret=SECRETS ;;
	-m*)    secret=GO_HERE ;;
	?*)     secret=$1 ;;
	"")     echo "usage: $0 [ -h | -z | -m | <SECRET> ]"
		exit 1
		;;
esac

# https://www.youtube.com/watch?v=Q3mgapAcVdU
# we gotta get out of this place,  but cleanly:
trap "exit 0" INT

while true; do
	t=`date +%S`
	date +"%T,  current & next token (changes on seconds :00 and :30):"
	oathtool --totp -w1 -b $secret
	# gotcha!  SOMETIMES, $t may come in as 08 or 09 which would be
	# illegal octal numbers -- we need to nuke a leading "0":
	sleep $(( 1 + 30 - (${t#0} % 30) ))
done

# and if it's the last thing we ever do...
# 2FA -- 2 Factor Audio, here's the 2nd factor:
# https://www.youtube.com/watch?v=lsuQO77n9SE


Home | Main Index | Thread Index | Old Index