totp generation split out; no longer notifies if no TOTP present

This commit is contained in:
Matthias Johnson 2026-02-07 21:57:17 -07:00
parent c9f1593954
commit 364530fc31
3 changed files with 19 additions and 11 deletions

10
bwzy-copy-totp Executable file
View file

@ -0,0 +1,10 @@
#/bin/bash
read -r TOTP_STRING || TOTP_STRING="null"
# Copy the TOTP to clipboard
if [[ "$TOTP_STRING" != "null" ]]; then
TOTP=$(echo $TOTP_STRING | sed 's/.*secret=//; s/&.*//' | oathtool -b --totp -)
echo -n "$TOTP" | cli-copy
[[ -n "$BWZY_NOTIFY_CMD" ]] && $BWZY_NOTIFY_CMD "TOTP copied to clipboard"
fi