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
cid bafyreiftpfsk4k6fcdykjxhmzy6qbaxn42m5qi7z7jy5ii423qp2kadrq4

Checks

Valid
  • unlimited-string defs.main.output.schema.properties.idNo maxLength, maxGraphemes or format limits this string.
JSONDownload
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "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.",
      "errors": [
        {
          "description": "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.",
          "name": "InvalidRequest"
        },
        {
          "description": "HTTP 400: the token names no live link of the caller's.",
          "name": "LinkNotUsable"
        },
        {
          "description": "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.",
          "name": "ActAsPerson"
        },
        {
          "description": "HTTP 409: the link already carries another grant.",
          "name": "AlreadyGranted"
        },
        {
          "description": "HTTP 403: `grant.actAs` is not an account the caller may write as.",
          "name": "Forbidden"
        },
        {
          "description": "HTTP 403: an agent's or program's token may not attach a grant that writes an approval record.",
          "name": "ProgramRefused"
        },
        {
          "description": "HTTP 400: the caller's account is not hosted on the platform's identity PDS, or link tokens are not configured there.",
          "name": "NotSupported"
        },
        {
          "description": "HTTP 429: too many writes from this DID, or the identity PDS is limiting the platform's checks; try again later.",
          "name": "RateLimitExceeded"
        },
        {
          "description": "HTTP 502: the identity PDS could not be reached or answered with a failure; try again.",
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "grant": {
              "ref": "pub.techne.draft.identity.defs#linkGrant",
              "type": "ref"
            },
            "token": {
              "description": "The link's token, as the identity PDS answered it to the caller.",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "token",
            "grant"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "id": {
              "description": "The link's id on the identity PDS.",
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "pub.techne.draft.identity.attachLinkGrant",
  "lexicon": 1
}