aboutsummaryrefslogtreecommitdiff
path: root/totp.1
blob: aa3df0a2cf73ff544a4101a98c3254ce440c5c49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.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