CLI command

probierz totp

Give a journey the code an authenticator app shows for a test account, so it can pass a product's second factor.

Invocation#

Shell
printf %s "$SEED" | probierz totp --digits <6-8> --period <SECONDS> [--at <UNIX_SECONDS>], or probierz totp --digits <6-8> --period <SECONDS> --seed-from <ITEM#FIELD|role:ROLE#FIELD>

Required inputs and options#

  • The seed is read on standard input, never as an argument a process list or a transcript keeps: the base32 seed the product showed when its second factor was set up, in either case, spaces and = padding ignored as authenticator apps ignore them. A journey reads it from its run's environment, where a manifest's accounts puts it from Skarbiec.
  • --seed-from reads the seed from Skarbiec instead, through Stado's secrets family (stado credentials get), named as a manifest's accounts name a field: ITEM#FIELD, or role:ROLE#FIELD for the one live item playing that role. Standard input is not read then, so Probierz Desktop and the service, which have none, give codes too; the seed is never printed.
  • --digits (6 to 8) and --period (seconds per code) are the product's, as its authenticator setup states them; --at gives the code of another instant, now when omitted.

Output and state effects#

Computes the time-based one-time password of RFC 6238 over HMAC-SHA-1 and prints {code, digits, period, at, validUntil}; validUntil is the first second of the next code. Nothing is written. Real test: tests/accounts/totp.rs, against RFC 6238's own test vectors, and tests/accounts/accounts.rs for a seed kept in a real Stado's store.

Exact refusals#

  • seed-invalid (exit 1): the seed, on standard input or in Skarbiec, is empty, could not be read, or holds a character base32 does not; no code is printed.
  • seed-reference-malformed (exit 2): --seed-from names no field, no item or an empty role; Stado is not asked.
  • seed-unread (exit 69): Stado could not run, or could not read that field, with its answer; store the seed there and grant this host's store, or pipe it instead.
  • --digits outside 6 to 8 and a --period of 0 are refused by the parser with exit 2.

Declared refusals#

What probierz refusals list declares for this command at revision d2cd6156e8b8dc6204dab7b46ec0b34b2bb03cea (probierz 0.1.7 (revision unknown, not built from a git checkout)): each cause's id, the operation declaring it, its exit status and code, and its remedy.

  • seed-invalid (probierz.totp, exit 1, config): reading the authenticator seed {source}: {problem}. give the seed the product showed when its second factor was set up, in base32 (letters A-Z and digits 2-7): pipe it, for example from the run's own secret (printf %s "$SHOP_TOTP" | probierz totp --digits 6 --period 30), or keep it in Skarbiec and name it with --seed-from.
  • seed-reference-malformed (probierz.totp, exit 2, refused): reading the authenticator seed from {reference}: {reference} is not ITEM#FIELD or role:ROLE#FIELD. name the Skarbiec field that keeps the seed, like --seed-from shop-tester#totp or --seed-from role:shop-tester#totp.
  • seed-unread (probierz.totp, exit 69, infra_down): reading the authenticator seed {reference} through stado credentials get: {answer}. store the seed in Skarbiec under that field (tagged stado:role:<role> for a role) and grant this host's store, or pipe the seed on standard input instead.

Source snapshot#

Generated from the Rust binaries at revision 99a74945a3598a8d73b6c6cbe5aae4f283becea3 of Probierz's private source repository.

Combined help SHA-256: 77529678a61237f774b59e76df0d1907cb749ef5da56d2ed913b040793b7d30b; binary SHA-256: be9e0eaff0e6ea50403a0c6f6d467697a4eac676f9523b8dc13a596d2b5526c5.