Skip to content

Instantly share code, notes, and snippets.

@fikr4n
Last active July 6, 2021 05:13
Show Gist options
  • Save fikr4n/5d965f785f79bd4f534e8fe850109db3 to your computer and use it in GitHub Desktop.
Save fikr4n/5d965f785f79bd4f534e8fe850109db3 to your computer and use it in GitHub Desktop.
TOTP (like in Google Authenticator android app) using https://github.com/pyauth/pyotp, and (optional) gpg to secure the secret
#!/bin/bash
# How to use
# 1. Clone https://github.com/pyauth/pyotp.git
# 2. Put this file in the repo root dir
# 3. GPG-encrypt your TOTP key/seed (without newline), place it in secret.asc in the repo root dir
# 4. Run this file
cd `dirname $0`/src
watch gpg -dq ../secret.asc \| python3 -c \''import pyotp;print(pyotp.TOTP(input()).now(),end="")'\'
#!/bin/bash
# How to use
# 1. Clone https://github.com/pyauth/pyotp.git
# 2. Put this file in the repo root dir
# 3. Replace __YOUR_KEY_HERE__ below with your TOTP key/seed
# 4. Run this file
cd `dirname $0`/src
watch python3 -c \''import pyotp;print(pyotp.TOTP("__YOUR_KEY_HERE__").now(),end="")'\'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment