Skip to content
Secrets StoreMarkdown

Give someone access to a secret

Let a colleague or a group read one of your secrets until a time you choose, then see and take back what you gave.

API

ben needs the staging database password for the next two weeks. maya doesn’t want to send it over chat, and doesn’t want him to see anything else in her vault. A grant gives him that one secret, read from the realm under his own sign-in, and it ends by itself.

Before you start: the secret, db/staging, is in a vault you own: your own, a group’s you’re a member of, or, as a realm administrator, the realm’s. Your colleague has used the store at least once, so they have a key to seal their copy to. You are signed in with your session in $CVYUH_SESSION (Call the API shows how).

  1. Choose the access. use lets them read the current value and nothing more. view also lets them read older versions and the secret’s metadata, and see it when they list your vault.

  2. Give the grant, with an end time:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/grants/db/staging \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "user": "ben", "access": "use", "validTo": "<RFC 3339 time>" }'

    To grant a whole team, send "group": "engineering" in place of user. The realm answers 201 with the grant and its edgeId. Keep the edgeId if you’ll take the grant back early.

  3. Tell your colleague the path. They find it with a GET on https://foobar.cvyuh.com/api/v0/vault/managed/v1/shared, and read it at https://foobar.cvyuh.com/api/v0/vault/managed/v1/user/maya/data/db/staging.

List the secret’s grants:

Terminal window
curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/grants/db/staging \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

Each grant shows who it names, its access, its validTo, who gave it (grantedBy), and live: whether it still gives access right now.

To end a grant before its time, delete it by its edgeId:

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

The realm answers 204, and their copy of the secret is gone at once. A grant that has already reached its end time gives nothing, but stays in the list, marked not live, until you delete it.