Skip to content
Secrets StoreMarkdown

One-time shares

Send one version of a secret through a link that works once, optionally for one named user, before it expires.

AvailableAPI

A one-time share hands a secret to someone once, without giving them lasting access. You copy one version into a share and get a link. The first user to read the link gets the values, and the share is gone. A link that leaks after it was read, or after it expired, gives nothing.

Use it for a new starter’s first password, or a value someone needs a single time. For access that lasts, give a grant.

  • Who: anyone who may view the secret: its owner, someone with a view grant, or a nominee let in by emergency access. The reader is any user signed in to the realm, or only the recipient you name. No privilege is needed.
  • Where: the API. There are no screens yet.
  • First: the store is on, and the version you share is live: not deleted or destroyed.

The share is a copy of one version, sealed under a key that exists only in the link. The realm stores the sealed copy and never the key, so without the link it can’t open the share itself.

The reader, signed in to the realm, posts the link to the store. The link travels in the request body, never in an address, so it doesn’t land in the logs that proxies keep. A page that hands the link on should carry it after a #, which a browser never sends to a server.

  1. Make the share, as anyone who may view the secret. Here maya shares web/github with ben, for an hour (Call the API shows how to get $CVYUH_SESSION):

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/share/web/github \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "ttl": 3600, "recipient": "ben" }'

    The realm answers 201:

    { "data": { "link": "<link>", "expires_at": "<RFC 3339 time>" } }
  2. Send the link to the reader by any channel.

  3. The reader, signed in as themselves, reads it once:

    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 200 with the values under data.data. Every later read answers 404.

No message is sent; the reader has only the link you send them. Their first read answers the values; every read after that answers 404, for them and for anyone else.

If the link answers 404 on its first read, someone else read it. Unless it had expired, treat the value as exposed: change the secret, and tell the person who sent it.

AnswerWhenWhat to do
404 readingThe link was already read, has expired, is wrong, or names another recipientIf you hadn’t read it and it hadn’t expired, treat the value as exposed and change it; otherwise ask for a new share
400 making, lifetimettl is 0 or longer than the realm allowsSend a ttl from 1 second up to the realm’s shareMaxTtl, a week by default
400 making, versionThe version is deleted or destroyedShare a live version
404 makingThe path, the version or the recipient isn’t there, or you may not view a secret in a personal vaultCheck the path and the recipient’s user id
403 makingYou may not view the secret in a group’s or the realm’s vault, or hold only useAsk for view, or ask someone who may view it
400 reading, “no link provided”The body has no linkSend { "link": "<link>" }
503The realm has no secrets keySee Crypto-shredding
LimitDefaultRangeSet by
A share’s lifetime600 seconds (ten minutes)1 second up to the realm’s longestttl on the share; shareDefaultTtl for the realm
The longest a share may wait604800 seconds (a week)1 second to 30 daysshareMaxTtl in Realm settings
Reads per shareone
Withdrawing an unread sharenot possible; it expires
SymptomCauseFix
The recipient’s first read answers 404Someone else read it first, or it expiredCheck expires_at. If it hadn’t expired, change the secret: the value is exposed
You sent a link to the wrong personA share can’t be withdrawnChange the secret now, so the share holds a value that no longer works
The reader gets 404 though the link is freshThe share names a different recipientMake a new share for the right user

Making a share is a CREATED record, and reading it a DELETED record under the reader. A share swept after it expires writes no record. See Secrets audit trail.

  • Read once. Only one read gets the values, even if two arrive together.
  • It can’t be withdrawn. Once made, a share stays until it is read or expires. Keep ttl short.
  • A wrong link spends nothing. A link with the right share but the wrong key reads nothing, and the share stays for the right link.
  • For one user, if you name one. A share with a recipient opens for them alone. Anyone else finds nothing, and the share stays for the recipient.
  • A copy, not a pointer. A later change to the secret doesn’t reach the share.
  • Anyone who may view a secret may share it, with anyone in the realm. The realm sets only how long shares last. See What’s next for sharing.
FieldWhat it sets
versionWhich version to share. Leave it out for the latest
ttlHow many seconds the share waits to be read
recipientThe one user who may read it, by user id. Leave it out for anyone in the realm with the link