Skip to content
Secrets StoreMarkdown

Plan for an emergency

Nominate someone who can reach your personal secrets if you can't, after a delay in which you can always say no.

API

If maya were away or unable to act, someone might need the passwords only she holds. With emergency access she names that user now. They can ask at any time, but get in only after a delay she chooses, and never if she refuses within it.

No notice is sent when the nominee asks: maya refuses only if she checks. She chooses a delay longer than the gap between her checks.

Before you start: your nominee, here ben, has used the store at least once, so they have a key the realm can seal yours to. Each of you is signed in with your own session in $CVYUH_SESSION (Call the API shows how).

  1. As maya, nominate ben with a three-day delay:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/emergency \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "nominee": "ben", "delay": 259200 }'

    The realm answers 201 with the nomination and its id, in state idle. Leave out delay for the realm’s default, a week.

  2. If ben ever needs her secrets, he asks:

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

    The state becomes waiting, and the delay starts. maya isn’t told.

  3. maya checks her nominations on a schedule shorter than the delay, with a GET on https://foobar.cvyuh.com/api/v0/vault/managed/v1/emergency. A nomination under nominated with state: "waiting" is a request. Within the delay, she can refuse:

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

    His request ends. He can ask again, and the delay starts again.

  4. Once the delay passes unrefused, the state is granted, and ben reads her personal vault:

    Terminal window
    curl "https://foobar.cvyuh.com/api/v0/vault/managed/v1/user/maya/metadata?list=true" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    He can read every version and list the vault, and write nothing. Her group and realm vaults aren’t reached.

A GET on https://foobar.cvyuh.com/api/v0/vault/managed/v1/emergency lists the nominations you made under nominated and those naming you under nominatedFor, each with its grantor, nominee, delay and state.

Either of you ends the nomination at once:

Terminal window
curl -X DELETE https://foobar.cvyuh.com/api/v0/vault/managed/v1/emergency/<id> \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

The realm answers 204.