Skip to content
Secrets StoreMarkdown

Realm settings

Turn the secrets store on, and set the defaults every vault follows for history, check-and-set, shares and emergency access.

AvailableAPI

One settings object per realm, vaultSettings, holds what every vault takes when a secret sets nothing of its own: how much history is kept, whether writes must name the version they replace, how long one-time shares last and how long an emergency nominee waits. A realm administrator writes it once, by turning the store on, and changes it whenever the realm’s policy changes.

  • Who: a realm administrator. Turning the store on needs RealmOwner, or a privilege of your own that allows MODIFY on secrets; changing the settings needs MODIFY on the realm’s settings, which RealmOwner gives. Reading them needs READ, which RealmViewer gives too. See Delegated administration.
  • Where: the API. There are no screens yet.
  • First: nothing. The store is off until you turn it on.

The managed vaults’ settings sit in the managed section. The one-time shares’ sit at the top, since they span both kinds of vault. The sealed vaults’ sit in sealed: see Sealed vault settings.

SettingWhat it doesDefaultRange
managed.maxVersionsVersions a path keeps101 to 100
managed.casRequiredEvery write must use check-and-setfalse
managed.deleteVersionAfterSeconds after which a version reads as deleted; 0 keeps them00 to ten years
managed.emergencyDelayDefaultSeconds a nominee waits after asking, when the grantor names no delay604800 (a week)1 second to ten years
managed.tokenReuseHow long a sign-in keeps its access to its own keys open between requestssession, 600 secondssee below
shareDefaultTtlSeconds a one-time share waits when its maker names no lifetime600 (ten minutes)1 second to 30 days
shareMaxTtlThe longest a one-time share may wait, in seconds604800 (a week)1 second to 30 days

managed.tokenReuse is { "mode": "session", "ttl": 600 } by default: a sign-in keeps its access to its own keys open between requests for ttl seconds (10 to 3600), never past the session’s end. Set mode to request to reopen that access on every request instead: stricter, and slower.

As a realm administrator (Call the API shows how to get $CVYUH_SESSION):

  1. Turn the store on:

    Terminal window
    curl -X POST https://foobar.cvyuh.com/api/v0/vault/managed/v1/enable \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    The realm writes vaultSettings with the defaults above, and answers 201 the first time and 200 after. Until then every other call to the store answers 409.

  2. Read the settings, and note their rev:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/objects/v1/vaultSettings/vaultSettings \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    A 404 means the store isn’t on yet.

  3. Change them, sending only the fields to change, each in its section:

    Terminal window
    curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/vaultSettings/vaultSettings \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -H 'If-Match: "<rev>"' \
    -d '{ "managed": { "maxVersions": 5 } }'

Anyone signed in to the realm reads the first three at https://foobar.cvyuh.com/api/v0/vault/managed/v1/config, as max_versions, cas_required and delete_version_after.

A change applies to every vault at once, to the next request: a lower managed.maxVersions at each path’s next write, a new managed.deleteVersionAfter to versions written after it, new share lifetimes to shares made after it. Nothing already written is changed. No one is told of the change.

AnswerWhenWhat to do
403 turning the store onThe caller isn’t a realm administratorAsk someone holding RealmOwner
404 reading the settingsThe store isn’t on yetTurn it on first
400A field the settings don’t name, or a value out of rangeSend only the fields in the table, each in its section
412The settings changed since you read their revRead again, and send your change with the new rev
409 from any vault callThe store isn’t onTurn it on

Every default and range is in the table above. None can be raised past its range.

SymptomCauseFix
A PATCH answers 400 though the field existsIt was sent at the top instead of in its sectionPut maxVersions and the other managed fields under managed
A path keeps more versions than the realm’s limitThe path sets its own max_versionsA path’s own setting wins; see Metadata
Writes start failing with 400 after a changemanaged.casRequired is now trueWriters send options.cas; see Check-and-set

Turning the store on is a CREATED change record on vaultSettings, and each change an UPDATED or PATCHED one, with what changed, before and after. Read it in Change history at https://foobar.cvyuh.com/api/v0/am/objects/v1/vaultSettings/vaultSettings/history.

  • Only a realm administrator turns the store on. Anyone else is refused (403).
  • A path’s own setting wins over the realm’s, where it sets one. Check-and-set is the exception: a path can require it, but can’t lift the realm’s managed.casRequired.
  • A field the settings don’t name is refused (400), at the top or in a section, so a change in an old shape fails rather than setting nothing.
  • A guarded change. With If-Match and the rev you read, a change made since then makes yours fail rather than overwrite it.
  • The realm sets only how long shares last. Anyone who may view a secret can grant or share it to anyone in the realm; no setting turns links or grants off or limits who may receive them yet. See What’s next for sharing.
  • There is no call to turn the store off.

A setting for whether a user’s first vault is sealed or managed (personalDefault). It can be set, but nothing reads it yet: see What’s next for vaults.