.Dd August 26 2024 .Dt TOTP 1 .Os .Sh NAME .Nm totp .Nd generate TOTP codes .Sh SYNOPSIS .Nm .Op Fl d Ar digits .Op Fl p Ar period .Op Fl h .Op Ar secret ... .Sh DESCRIPTION .Nm is a utility for generating TOTP codes. If no .Ar secret is provided as a command-line argument, secret keys are read newline-separated from the standard input. .Pp The options are as follows: .Bl -tag width Ds .It Fl d , Fl Fl digits Ns = Ns Ar length Specify the length in digits of the generated TOTP codes. The default .Ar length value is 6. .It Fl h , Fl Fl help Display help information by opening this manual page. .It Fl p , Fl Fl period Ns = Ns Ar seconds Specify the duration for which the generated TOTP codes are valid. The default .Ar seconds value is 30. .El .Sh EXIT STATUS .Ex -std .Sh EXAMPLES Get TOTP codes for two different secret keys using the standard input: .Pp .Dl $ printf \(aq7KFSJ562KJDK23KD\en7YNEG7J3XBIVYR54\(aq | totp .Pp The same as the above but using command\-line arguments: .Pp .Dl $ totp 7KFSJ562KJDK23KD 7YNEG7J3XBIVYR54 .Pp Generate an 8 digit TOTP code that is valid for 60 seconds: .Pp .Dl $ totp -d8 -p60 7KFSJ562KJDK23KD .Pp .\" TODO: Write a URI parsing CLI tool and show an example of handing .\" optauth URIS .\" Get a TOTP code from an optauth URI: .\" .Pp .\" .Bd -literal -offset indent .\" $ totp -u 'otpauth://totp/GitHub:Mango0x45?secret=7YNEG7J3XBIVYR54' .\" .Ed .\" .Pp .\" The same as above, but extract the URI from a QR\-code using .\" .Xr zbarimg 1 : .\" .Pp .\" .Dl $ zbarimg -q qr.png | sed 's/QR-Code://' | totp -u .\" .Pp .Sh AUTHORS .An Thomas Voss Aq Mt mail@thomasvoss.com