Blob


1 .\" Copyright (c) 2022, 2023 Omar Polo <op@omarpolo.com>
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
6 .\"
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 .Dd May 27, 2023
15 .Dt TOTP 1
16 .Os
17 .Sh NAME
18 .Nm totp
19 .Nd time-based one time password generator
20 .Sh SYNOPSIS
21 .Nm
22 .No < Ns Ar secret
23 .Sh DESCRIPTION
24 .Nm
25 is a time-based one time password generator
26 .Pq TOTP .
27 It reads a secret from standard input and prints the generated password,
28 a numeric code, to standard output.
29 The secret is usually provided by the authenticator
30 .Pq for e.g.\& a website
31 and is either a base32-encoded string or a
32 .Sq otpauth://
33 URI.
34 Blanks in the secret string are ignored, but only one line is read.
35 .Pp
36 .Nm
37 uses a period of 30 seconds, HMAC-SHA1 and generates six digits long
38 codes, unless the URL specifies otherwise.
39 .Sh EXIT STATUS
40 .Ex -std
41 .Sh EXAMPLES
42 .Nm
43 is meant to be used with
44 .Xr plass 1
45 or similar application: the secret is stored safely in the password
46 store and then given to
47 .Nm
48 using a pipe:
49 .Bd -literal -offset indent
50 $ plass cat 2fa/codeberg/op | totp
51 722524
52 .Ed
53 .Sh SEE ALSO
54 .Xr plass 1
55 .Sh STANDARDS
56 .Nm
57 follows the algorithm outlined in RFC 6238
58 .Dq TOTP: Time-Based One-Time Password Algorithm
59 and uses the base32 encoding as defined in RFC 3548
60 .Dq The Base16, Base32, and Base64 Data Encodings .
61 .Sq otpauth://
62 URIs are parsed as per the
63 .Dq Key URI Format
64 proposed by Google Authenticator.
65 .Sh AUTHORS
66 .An -nosplit
67 The
68 .Nm
69 utility was written by
70 .An Omar Polo Aq Mt op@omarpolo.com .