# 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).