Compare commits

...

2 commits

Author SHA1 Message Date
194435e52c Add output for missing secret 2022-10-22 17:30:28 -04:00
38aa163634 Apply defaults the oathtool command when get-ing codes 2022-10-22 17:28:20 -04:00

6
otpish
View file

@ -72,7 +72,11 @@ if [ "${COMMAND}" = "get" ]; then
if [ "$(echo ${i} | cut -d'=' -f1)" = "digits" ]; then digits=$(echo ${i} | cut -d'=' -f2); fi if [ "$(echo ${i} | cut -d'=' -f1)" = "digits" ]; then digits=$(echo ${i} | cut -d'=' -f2); fi
if [ "$(echo ${i} | cut -d'=' -f1)" = "period" ]; then period=$(echo ${i} | cut -d'=' -f2); fi if [ "$(echo ${i} | cut -d'=' -f1)" = "period" ]; then period=$(echo ${i} | cut -d'=' -f2); fi
done done
oathtool --totp -b -s "${period}s" -d ${digits} ${secret} if [ -z ${secret} ]; then
echo secret value unset, check otpish dump to make sure you added the uri correctly
exit
fi
oathtool --totp -b -s "${period:-30}s" -d ${digits:-6} ${secret}
exit exit
fi fi