Added README
This commit is contained in:
1 parent
d0487ddae9
commit
923c3e185a
2 files changed
+64
-1
No files matched your search
@@ -0,0 +1,63 @@
|
|||||||
|
# totpin
|
||||||
|
|
||||||
|
A command-line tool to generate TOTP codes (RFC 6238).
|
||||||
|
|
||||||
|
Nothing is stored: totpin asks for a base32 secret, or a full
|
||||||
|
`otpauth://totp/...` URI (which also gives the algorithm, the number of
|
||||||
|
digits and the period), without echoing it. Two codes are then shown, the
|
||||||
|
current one and the next one, each with its countdown. Press any key (or
|
||||||
|
Ctrl-C) to quit.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
totpin [-h] [-v] [--licenses]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Option | Effect |
|
||||||
|
|------------------|-----------------------------------------------------------|
|
||||||
|
| `-h`, `--help` | Show the help, then exit. |
|
||||||
|
| `-v`, `--version`| Show the version, then exit. |
|
||||||
|
| `--licenses` | Show the license of totpin and those of the libraries it uses, then exit. |
|
||||||
|
|
||||||
|
Accepted input:
|
||||||
|
|
||||||
|
- a base32 secret (spaces and `=` are ignored);
|
||||||
|
- an `otpauth://totp/...` URI. The `secret`, `algorithm` (`SHA1`, `SHA256` or
|
||||||
|
`SHA512`), `digits` (6 or 8), `period` and `issuer` parameters are used.
|
||||||
|
Defaults: `SHA1`, 6 digits, 30 seconds.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Requires OCaml 5.4 or later, [dune](https://dune.build) and opam.
|
||||||
|
|
||||||
|
```
|
||||||
|
opam install . --deps-only
|
||||||
|
dune build
|
||||||
|
```
|
||||||
|
|
||||||
|
The executable is `_build/default/bin/main.exe`. `dune install` installs it
|
||||||
|
as `totpin`.
|
||||||
|
|
||||||
|
## Layout
|
||||||
|
|
||||||
|
- `bin/`: the executable.
|
||||||
|
- `totpin_base32/`: base32 decoding.
|
||||||
|
- `tools/gen_licenses.ml`: build-time tool that generates the third-party
|
||||||
|
license texts shown by `--licenses`.
|
||||||
|
|
||||||
|
### Third-party licenses
|
||||||
|
|
||||||
|
During the build, `tools/gen_licenses.exe` reads the `(libraries ...)` field
|
||||||
|
of `bin/dune`, finds with `ocamlfind` the libraries linked into the
|
||||||
|
executable (and their dependencies), and reads their opam package, version,
|
||||||
|
declared license and license file from the state of the current opam switch.
|
||||||
|
The result is embedded in the executable.
|
||||||
|
|
||||||
|
This is why the build needs `ocamlfind`, `bos`, and the opam libraries
|
||||||
|
(`opam-core`, `opam-format`, `opam-state`) installed in the switch, and why it
|
||||||
|
must run inside the opam switch that provides the dependencies.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
ISC, Copyright (c) 2026 Matthieu Dubuget. See [LICENSE](LICENSE).
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
(name totpin)
|
(name totpin)
|
||||||
|
|
||||||
(version 1.1)
|
(version 1.3)
|
||||||
|
|
||||||
(generate_opam_files true)
|
(generate_opam_files true)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user