Send a secret once
Hand one version of a secret to someone through a link that works once and then expires.
API
ben is starting today and needs his first password, or needs one value tonight. A
one-time share sends it once: the first read of the link gets the value, and
the link is spent. There is no lasting access to take back, and a link that leaks later gives nothing.
Before you start: you may view the secret: you own it, or hold a view grant on it. The reader has an account in
the realm. Each of you is signed in with your own session in $CVYUH_SESSION (Call the API shows
how).
Send it
Section titled “Send it”-
As
maya, make a share ofonboarding/benthat waits an hour, forbenalone:Terminal window curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/share/onboarding/ben \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "ttl": 3600, "recipient": "ben" }'The realm answers
201with{ "link": "<link>", "expires_at": "<RFC 3339 time>" }underdata. Leave outrecipientfor anyone in the realm who has the link, and add"version": <n>to share an older version. -
Send the link to
ben, by any channel. -
As
ben, read it:Terminal window curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/shares \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "link": "<link>" }'The realm answers
200with the values.
Check it worked
Section titled “Check it worked”Send the same read again: it answers 404, for ben too. A share no one reads expires on its own. A lifetime longer
than the realm allows, a week by default, answers 400.
If ben’s first read answers 404 and the share hadn’t expired, someone else read it: treat the value as exposed,
change the secret, and send him a new share.
Undo it
Section titled “Undo it”A share can’t be withdrawn before it is read; it lasts until it is read or expires. If you sent it to the wrong
person, change the secret at once, so the share carries a value that no longer works. Keep ttl short.
Related
Section titled “Related”- One-time shares: how a share is sealed, and every rule.
- Give someone access to a secret: for access that lasts.