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).
Give the grant
Section titled “Give the grant”-
Choose the access.
uselets them read the current value and nothing more.viewalso lets them read older versions and the secret’s metadata, and see it when they list your vault. -
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 ofuser. The realm answers201with the grant and itsedgeId. Keep theedgeIdif you’ll take the grant back early. -
Tell your colleague the path. They find it with a
GETonhttps://foobar.cvyuh.com/api/v0/vault/managed/v1/shared, and read it athttps://foobar.cvyuh.com/api/v0/vault/managed/v1/user/maya/data/db/staging.
Check it worked
Section titled “Check it worked”List the secret’s grants:
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.
Undo it
Section titled “Undo it”To end a grant before its time, delete it by its edgeId:
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.
Related
Section titled “Related”- Grants: how grants work, and what each access level allows.
- Send a secret once: for a secret someone needs a single time.
- Share secrets with a team: when the secret belongs to the team, not to you.