CLI command

skarbiec field

Change one field of an item, a password or a seed, without reading the whole item out and writing it back with set, or remove an optional field.

Invocation#

Shell
printf '%s' '<new value>' | skarbiec field set <id> <field>
skarbiec field unset <id> <field>

Purpose#

Change one field of an item, a password or a seed, without reading the whole item out and writing it back with set, or remove an optional field.

Required inputs and options#

  • set takes an item id and a field name, and the new value on standard input, never in argv; one trailing line ending, which echo and a heredoc add, is taken off, and nothing else. unset takes an item id and a field name. Which fields an item takes is skarbiec kinds <kind>'s answer. POST /v1/operator/items/field/set takes id, field and value in the body and stores the value as sent; POST /v1/operator/items/field/unset takes id and field.

Output and state effects#

  • Writes the item's next revision with the field set or removed, keeping every other field, the context, kind, tags and recipients; the value replaced stays in the item's saved versions (skarbiec history <id>) and is never printed or journalled. Prints ok, item, field, removed, changed and revision; unsetting a field the item does not hold prints changed false and writes nothing. Desktop's Items inspector shows it as Set a field…: the fields the item's kind takes, the value in a secure field, Set the field and Remove this field.

Refusals#

  • Each refusal leaves the vault as it was. field reads no flag: one given exits 2 as arguments-flag-unknown, `field takes no --<flag>, so it cannot do what the flag asks`. A verb that is not set or unset, or one not followed by exactly one item and one field, exits 2 as arguments-form-missing, arguments-form-unknown, arguments-missing or arguments-extra under /docs/errors, naming the usage. Standard input that cannot be read to its end, or is not UTF-8 text, is stdin-unread or stdin-not-text, exit 1, observed `nothing was written to <id>`. An empty value is field-empty, exit 1: `setting <field> of <id>: standard input held no value, and an empty field would read as a value nobody gave; observed: nothing was written to <id>; fix: give the value on standard input; skarbiec field unset <id> <field> removes the field`; the route refuses a body with no value, one that is not text or an empty one as field-body-empty, naming POST /v1/operator/items/field/unset. A route body without id or field is refused with status 400 naming the member. A field the kind does not take is field-not-of-kind, exit 1: `changing <field> of <id>: <id> is a <kind>, and a <kind> takes no field <field>; observed: nothing was written to <id>; fix: skarbiec kinds <kind> lists the fields a <kind> takes`; a field named context is refused the same way in every kind, since a grant, a route and the items API read context as the item's context and never as a field. A change after which the item would not pass its kind's schema (a required field removed, such as a login's username, the last of a set the kind needs one of, or a value of a form the field does not hold) is field-payload-invalid, exit 1: `changing <field> of <id>: <id> with that change would not be a <kind> the schema accepts: <what the schema says>; observed: nothing was written to <id>; fix: keep every field a <kind> requires and one of each set it needs one of, and give <field> a value of the form the refusal names; skarbiec kinds <kind> lists the fields a <kind> requires and the sets it needs one of`. An id the vault does not hold, or holds trashed, damaged or sealed to other keys, is refused by the item-open causes, an item this host may not write by the owner-write causes, and a vault that does not open or a write that does not land by the vault-access causes.