pub.techne.draft.identity.createLinkToken
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 "$subject" slot (and their name in every "$name" slot), exactly as identity.holdForPhone releases a hold: the caller must be able to write as `actAs` now and when the link is redeemed, a block either way between the redeemer and the caller or `actAs` writes nothing, and the record must be one permissioned.putRecord would take with the caller's DID in the slot. A one-time link's grant goes after its one write; a reusable link's is written once for each redeemer, under its own record key. A release never writes over a record already at its key: one there stays, and that redeemer's write is not made. A pub.techne.draft.contact grant is likewise not made when any active contact of `actAs` already names the redeemer, by its `did` or by a saved number that resolves to them (an archived one does not count), so a grant like {name: "$name", did: "$subject"} adds each person to the owner's People once. Only an account hosted on the platform's identity PDS can make links. One call spends one of the caller's writes.
Details · procedure
| Kind | procedure |
|---|---|
| Authority | identity.draft.techne.pub |
| Commit rev | 3n3iob56jgo2u |
| Indexed |
Checks
Validunlimited-stringdefs.main.output.schema.properties.tokenNo maxLength, maxGraphemes or format limits this string.
{
"$type": "com.atproto.lexicon.schema",
"defs": {
"main": {
"description": "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 \"$subject\" slot (and their name in every \"$name\" slot), exactly as identity.holdForPhone releases a hold: the caller must be able to write as `actAs` now and when the link is redeemed, a block either way between the redeemer and the caller or `actAs` writes nothing, and the record must be one permissioned.putRecord would take with the caller's DID in the slot. A one-time link's grant goes after its one write; a reusable link's is written once for each redeemer, under its own record key. A release never writes over a record already at its key: one there stays, and that redeemer's write is not made. A pub.techne.draft.contact grant is likewise not made when any active contact of `actAs` already names the redeemer, by its `did` or by a saved number that resolves to them (an archived one does not count), so a grant like {name: \"$name\", did: \"$subject\"} adds each person to the owner's People once. Only an account hosted on the platform's identity PDS can make links. One call spends one of the caller's writes.",
"errors": [
{
"description": "HTTP 400: a field out of bounds, 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 403: `grant.actAs` is not an account the caller may write as.",
"name": "Forbidden"
},
{
"description": "HTTP 400: the caller's account is not hosted on the platform's identity PDS, or link tokens are not configured there; or the caller holds its own session (it came through its PDS with a service-auth token): call this method on its identity PDS itself and attach a grant with attachLinkGrant.",
"name": "NotSupported"
},
{
"description": "Too many writes from this DID (HTTP 429).",
"name": "RateLimitExceeded"
},
{
"description": "HTTP 502: the identity PDS could not be reached, refused the credential the platform holds for the caller, or answered with a failure; try again.",
"name": "UpstreamFailure"
}
],
"input": {
"encoding": "application/json",
"schema": {
"properties": {
"app": {
"description": "The app the link is for, a label the caller gives itself (unverified).",
"maxLength": 64,
"minLength": 1,
"type": "string"
},
"expiresAt": {
"format": "datetime",
"type": "string"
},
"grant": {
"ref": "pub.techne.draft.identity.defs#linkGrant",
"type": "ref"
},
"reusable": {
"default": false,
"type": "boolean"
},
"target": {
"description": "What the link is for, as a URI with a scheme (at://, https://, did:...).",
"maxLength": 2048,
"minLength": 1,
"type": "string"
}
},
"required": [
"app",
"target"
],
"type": "object"
}
},
"output": {
"encoding": "application/json",
"schema": {
"properties": {
"link": {
"ref": "pub.techne.draft.identity.defs#linkTokenView",
"type": "ref"
},
"token": {
"description": "The secret to put in the link. Whoever holds it can redeem it.",
"type": "string"
}
},
"required": [
"link",
"token"
],
"type": "object"
}
},
"type": "procedure"
}
},
"id": "pub.techne.draft.identity.createLinkToken",
"lexicon": 1
}