Created
August 5, 2021 13:02
-
-
Save jikkujose/66ccbf7c965019e9a4f3f898734db081 to your computer and use it in GitHub Desktop.
Generate TOTP codes from command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rotp" | |
key = STDIN.tty? ? ARGV[0] : $stdin.read | |
if key.nil? | |
puts "Error: No key found in stdin or as flag" | |
exit | |
end | |
puts ROTP::TOTP.new(key.strip, issuer: "Unnamed Service").now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment