pub.techne.draft.identity.attachLinkGrant

Attach a grant to a link token the caller made on their own identity PDS (an app holding its own session calls createLinkToken or resetLinkToken there, then this through its PDS). The platform asks the identity PDS (checkLinkToken) whether `token` is live and the caller's; it then keeps `grant` for that link as createLinkToken with `grant` does. `grant.actAs` must be a collective (`ActAsPerson` otherwise): a person's records are written by their own app, never by the platform for someone else's tap, so a link to a person's thing carries no grant and its owner's app acts on the redemptions it lists. The same rules hold: the grant writes as the account the link's target names, the caller must be able to write as `grant.actAs` now and when the link is redeemed, and the record must be one permissioned.putRecord would take with the caller's DID in the slot. Such a grant is released only in the redeemer's own request: their app redeems the link at its identity PDS, then calls claimLinkGrant; it is never released in the background. Releasing a grant that writes as a circle relies on the platform holding the circle's key, a named exception that goes when collectives can grant the platform like any account. One grant per link: attaching the same grant again answers as the first time; a different one is `AlreadyGranted`. A redemption reported before the grant was attached releases nothing, so attach before sharing the link. Only an account hosted on the platform's identity PDS can attach a grant. One call spends one of the caller's writes.

Details · procedure
Kindprocedure
Authorityidentity.draft.techne.pub
Commit rev3n3iob4xcxo2u
Indexed

Procedure

procedure · POST

Input

application/json

token

requiredstring

The link's token, as the identity PDS answered it to the caller.

  • minLength: 1
  • maxLength: 512

Output

application/json

id

requiredstring

The link's id on the identity PDS.

Errors

InvalidRequest

HTTP 400: a field out of bounds, the grant does not write as the account the link's target names, or a body that is not JSON; 413: the body, or `grant.write`, over its size cap; 415: not application/json; 422: not the input's shape.

LinkNotUsable

HTTP 400: the token names no live link of the caller's.

ActAsPerson

HTTP 400: `grant.actAs` is not a collective the platform knows (a person, or an unknown account); only a collective's grant can be attached.

AlreadyGranted

HTTP 409: the link already carries another grant.

Forbidden

HTTP 403: `grant.actAs` is not an account the caller may write as.

ProgramRefused

HTTP 403: an agent's or program's token may not attach a grant that writes an approval record.

NotSupported

HTTP 400: the caller's account is not hosted on the platform's identity PDS, or link tokens are not configured there.

RateLimitExceeded

HTTP 429: too many writes from this DID, or the identity PDS is limiting the platform's checks; try again later.

UpstreamFailure

HTTP 502: the identity PDS could not be reached or answered with a failure; try again.

Similar lexicons

semantic match

Lexicons whose schemas describe something close to this one. Check them before publishing a new one that overlaps.

  • Make a link token on the caller's identity PDS: a secret anyone can redeem (redeemLinkToken) once (one-time, the default) or any number of times by different accounts (`reusable`). With `grant`, the platform keeps a write it makes for each account that redeems it: when the identity PDS reports a redemption, the platform writes the redeemer's own pub.techne.draft.identity.linkRedemption record in their personal space and then writes `grant.write` as `grant.actAs` with the redeemer's DID in every

  • Release, now, the grant of a link the caller redeemed on their own identity PDS (an app holding its own session calls redeemLinkToken there, then this through its PDS, in the same user action). The platform needs the redemption the identity PDS reported for the caller; it writes the grant's record as the grant's `actAs` in this request, under the grant's rules (the link's owner may still write as `actAs`, no block between owner and redeemer). The platform never releases such a grant in the backg

  • Redeem a link token as the caller. The identity PDS records it and reports it to the platform, which writes the caller's linkRedemption record and the link's grant, usually before this answers. Redeeming again a link the caller already redeemed answers `repeat` and changes nothing. One call spends one of the caller's writes. An older link (one the served app made before link tokens) writes no linkRedemption record. A caller that holds its own session redeems at its identity PDS and then calls cl

  • Revoke the caller's live reusable links for `app` and `target` and make a new reusable one. Its grant is `grant` when given (checked as for createLinkToken), else a copy of the newest unrevoked grant the caller made for a reusable link with the same `app` and `target` (a one-time link's grant is never carried); with neither, the new link has no grant. One call spends one of the caller's writes.

  • Retired (Linking v2): the platform no longer serves it, and no client should call it. Two accounts are linked with identity.manageMethods `moveMethod` now, which makes them one person (no accountLink records, no primary). Kept so the name and its shapes stay published. It was: link the caller's account with the other account named by the token identity.finishAddMethod offered: both accounts get a pub.techne.draft.accountLink in their space.personal naming the other and the primary, and each acco