CLI command
skarbiec totp recovery
Know how many second-factor recovery codes an account has left, use one without ever being offered it again, and store the new set when the provider issues one.
Invocation#
skarbiec totp recovery <item-id> [--take]
printf '%s\n' <code> <code> ... | skarbiec totp recovery <item-id> --replacePurpose#
Know how many second-factor recovery codes an account has left, use one without ever being offered it again, and store the new set when the provider issues one.
Required inputs and options#
- One item id whose kind declares recovery_codes (login or identity). The field may hold a list, or one text with one code per line; blank entries are not codes. --take asks for the next code. --replace reads the provider's new codes on standard input, one per line, never in an argument.
Output and state effects#
- Without a flag prints ok, item and remaining and never a code. With --take prints ok, item, code (the first one stored) and remaining, and stores the item without that code as a new revision, written back as a list; tags, recipients and every other field stay as they were, and the recovery-code-taken journal record names the item and how many remain, never the code. With --replace stores the new codes as the list in a new revision, the old set staying only in saved versions because the provider no longer accepts it, appends recovery-codes-replaced with the item and the count, and prints ok, item and remaining; no code is printed. POST /v1/operator/items/recovery-codes takes id and answers the count only; POST /v1/operator/items/recovery-codes/take takes id and answers the taken code once; POST /v1/operator/items/recovery-codes/replace takes id and codes (one per line). Desktop's item inspector shows the count as Recovery codes left, takes a code with Use one recovery code and stores a new set with Replace recovery codes.
Refusals#
- A missing id exits 2 with `usage: totp recovery <item-id> [--take | --replace] (--replace reads the new codes on stdin, one per line)`, and --take with --replace exits 2 asking for one. Refuses an item that stores no recovery_codes field with `<id> stores no recovery_codes field`, a field of another shape naming it, --take when none is left with `<id> has no recovery code left; generate new ones at the provider and store them with totp recovery <id> --replace`, --replace with empty input, and --replace on an item whose kind has no recovery_codes field naming the kind. --take and --replace are refused for a lifecycle-controlled item and on a replica vault as any owner write is.