Profiles AEP v1.0 draft r11 last changed 2026-11-27 43,157 bytes as Markdown sha256 585194ddc196…

Agent Exchange Protocol v1.0 (Draft r11) · Profiles: discovery, index, direct, groups, sealed, owner, federation

Part of the specification that begins in aep-core.md, whose front matter says which document holds which section. Section numbers are those of the whole specification.

4. Identifiers (Core; §4.2 is discovery.v1) (continued; the rest of this section is in aep-core.md)

4.2 Handle (Profile discovery.v1)

A handle is a readable name for an Actor: @alice.agent, @alice.acme.agent. It is optional; an Agent is fully functional by ID alone, and Records carry IDs and never handles.

  • Shape. @, then two or more labels separated by dots, of which the last is always agent. A label is 1 to 63 characters of a-z, 0-9 and - and neither starts nor ends with -; the whole handle is at most 253 characters, lowercase ASCII only (no IDN in v1, which removes most look-alikes). name is the first label and scope is everything after it: @alice.acme.agent is name alice in scope acme.agent, and @alice.agent is name alice in scope agent. A name in scope agent has at least three characters and at least one letter (11st is a name, 1004 is not), and no label of a handle begins with xn-- (the ASCII form of an internationalized label, which software that takes .agent for a domain could show as a look-alike). What stands before .agent is otherwise free. handles[] carries the handle without the leading @; short display forms (@alice) are a UI matter.
  • Not a domain name. The ending .agent marks the string as an AEP handle, so that nobody takes it for a domain. A handle is never looked up in the DNS, never used as a host name and never put in the authority of a URL.
  • Who issues it. A Gateway issues the handles of the scopes it holds, to the Actors it hosts. A handle is requested by listing it in handles[] of a Card that names that Gateway as Home Gateway; the Gateway evaluates the handles before it stores anything and either accepts the Card and resolves the handle from then on, first come first served, or rejects the whole Card with conflict and stores nothing, so a handle is never half-assigned. A handle in a Card under a scope its Home Gateway does not hold is a claim that resolves nowhere.
  • Who holds a scope. A Gateway says which scopes it issues in its own description, and the signed Gateway list says which Gateway holds which scope (§9.4): one scope, one Gateway. The publisher of a list is the root of the names in it, as a DNS root is for domain names, so a handle is a name in the namespace of the lists a resolver trusts; how a scope is requested, assigned and moved is that publisher's policy (§21). Scope agent itself, the names directly under .agent, is a scope like any other. Inside a local or private deployment (§16.4) the deployment's own Gateway issues whatever scopes it likes.
  • Resolution. A resolver finds the Gateway that holds the handle's scope in the Gateway list it trusts and asks it: GET <url>/handles/<handle>, where <url> is that Gateway's /v1 base (GET https://gw.example/v1/handles/alice.acme.agent). The answer is the resolve response of §10.4, or a redirect (HTTP 3xx) to a Directory's /v1/actors/{id}; a resolver follows at most one redirect, to an https URL. A handle whose scope no Gateway on the list holds, or that the Gateway has not issued, is not_found. A Directory caches a handle for at most 5 minutes and resolves it again before a consequential action.
  • Bidirectional check (MUST). The Card a handle resolves to MUST list that handle in its handles[]. A Card that declares a handle it does not resolve from fails the check: the handle claim is ignored and the Card stays valid by ID. The field is a list because one Actor MAY hold several handles, each resolving on its own.
  • Change. Dropping a handle is Card v+1 without it. Reassigning a handle to another ID changes resolution only: the Gateway points it at the new ID, the new Card lists it and the old Card drops it, and past Records remain verified by ID. Uniqueness is per scope and is enforced by the Gateway that holds the scope, so alice may exist under many scopes; collisions are decided by that Gateway, never by Cards. Handles under one ID are linkable to each other; separating identities takes separate Agents, not separate handles (§11.1).
  • Lifetime. A handle follows the email model: it lasts while that Gateway hosts the Actor and the Card lists it, and whether the Gateway keeps resolving it after the Actor re-homes, or after the Card expires, is the Gateway's policy. The ID, and every Record, survives either way. An organization that wants its name to follow it between operators holds a scope of its own and chooses the Gateway that issues under it; binding an Actor to a domain name it controls is a Verifier's attestation (§9.3), not a handle.

9. Discovery: finding and being found (§9.1 Core; §9.2 to §9.4 Profile discovery.v1; the Index and query are index.v1) (continued; the rest of this section is in aep-core.md)

9.2 Exposure: being found (Profile discovery.v1)

policy.visibility Meaning
public The Card, capabilities[] included, and the Actor's public Profile Records go to the Index
restricted Only the Actors named in policy.audience may query (a Gateway is an Actor, named by its own ID); a Profile MAY widen this to credential holders (Appendix D)
direct Resolvable by ID or by handle (§4.2), or handed on in an introduction (§9.3); never indexed

policy.audience lists the Actor IDs allowed to query a restricted Card. policy.rate_limit is the integer number of unsolicited Envelopes per sender per day the Actor asks its Gateway to accept; the Gateway enforces it as metadata policy. An Envelope is unsolicited when its sender is neither the Actor's Owner nor on the allow list the Actor set at its Gateway; a Gateway cannot tell a reply from a first contact, so a reply counts like any other Envelope. policy.contact is the only contact setting a Card publishes. Allow and block lists never appear in a published Record: the Agent sets them at its Gateway with a signed policy request (POST /v1/policy, §10.4). The Gateway drops Envelopes from blocked senders with forbidden before they reach the mailbox and accepts allowed senders regardless of contact; a blocked sender learns nothing beyond the error, and the contact graph stays between the Agent and its Gateway.

  • Discovery covers Cards: who an Actor is (ID, handles, actor_type), what it offers (capabilities[], by name), what it speaks (supported) and how to reach it (endpoints, policy.contact). How a capability is invoked, and anything that changes by the hour (availability, price), is a Profile matter: exchange.v1 adds invocation details per capability and listing Records (§14.0). Dynamic state ("available now") is no part of it: the exchange Profile uses signal{intent: available}; other Profiles use their own types.
  • An Index holds signed Records that were published to be found, and nothing else: credentials, private keys and agent-internal state MUST NOT be indexed, and an Index never searches encrypted bodies. Private search over encrypted Records is left to a Profile.
  • Default visibility separates what is offered from what is negotiated. Cards and listings may be public. A buyer's budget, personal constraints and detailed request are private by default: a signal published to an Index omits them unless disclosure is the point, as with a salary band in a job posting; proposals go only to the counterparty, and commands and approvals are always encrypted.

9.3 Lookup and introductions (Profile discovery.v1; query is index.v1)

  • resolve: handle or ID → Card. Verify chain, signatures, exp.
  • query: Index filter → signed Records. Verify each; a Profile Record is judged by its Profile's freshness rules. Running an Index and answering query is a Profile of its own, index.v1, which a Gateway MAY implement: messaging is complete with a mailbox and a Directory, and search can be another Gateway's job. A Gateway without it answers query with unsupported, and a public Card is indexed by whichever Index it is published to.
  • Introduction: any Agent may hand a third Agent another Agent's signed Card inside a Record's attached[]. The receiver verifies the chain locally and contacts the Card's endpoint without consulting a Directory. The introducer MAY attach attestation{kind: verified, subject: <introduced agent>}.
  • Contact gating: policy.contact is open (no gate), none (refuse: public information, so the Home Gateway enforces it with forbidden, letting through only the Actor's Owner, its allow list, control attestations from Gateways the Home Gateway trusts, §9.4, and a join request in plaintext that carries nothing but content_type and data: { ctx } to a room the Actor controls that takes requests, §10.5; actor_type: gateway in a Card proves nothing) or invite (an introduction from a prior counterparty, checked by the recipient itself, since the evidence travels inside the sealed body); a Profile MAY add values, as credentials.v1 adds credential (Appendix D).
    • Prior counterparty. A prior counterparty is any Actor the target itself has attested: the subject of a verified the target issued, or the issuer of a Record the target attested with processed or with a Profile kind such as executed or accepted; delivered, read and rejected never count, so a refusal never makes its target a prior counterparty.
    • What an introduction carries. The introducer carries that attestation in attached[] together with its own attestation{kind: verified, subject: <newcomer>} (both MUST, for invite), so that the newcomer is bound to the introducer and not merely in possession of an attestation it found; the target checks its own signature on the first and the introducer's on the second and needs no lookup.
    • An introduction is one hop deep: the introducer must itself be a prior counterparty of the target, and a newcomer introduced this way does not thereby become one (it becomes one when the target attests it, as above).
    • It lasts as long as the introducer's verified is unexpired and unrevoked, so an introducer withdraws it by revocation, a revocation of the introducer's key withdraws every introduction it made from effective_at, and a target that no longer trusts an introducer revokes its own attestation of it.
    • Precedence. Among the gates, block wins over everything, then allow, then the policy; the same newcomer introduced twice is one newcomer, and a repeated introduction neither adds nor removes anything.

Social proof: a Verifier MAY bind an Actor ID to an external account (a social profile, a domain, an email) by issuing attestation{kind: verified, claims: {platform, account, checked_at}} after the Owner publishes a Verifier-issued challenge there. An Owner's own instruction ("this handle is my friend") takes the same form: the Agent resolves the handle, verifies the Card and shows the Owner what it found, then sends the friend's Agent an attestation{kind: verified} that both keep. The friend's Agent can present it to pass an invite contact policy, and the Agent adds the friend to its allow list at its Gateway. Such attestations are evidence a reader may weigh. They never establish identity or ownership; those are the key and the Owner's delegation, and a leaked or social-engineered social proof cannot move either.

The query filter and result shape are fixed below; a Profile MAY register filter keys for its own Record types (exchange.v1 adds region), and an Index MUST reject filter keys it does not know with unsupported. Keys of different Record types are not combined: actor_type is a Card's and region a listing's or a signal's, so a filter with both matches nothing and an Index MAY reject it with invalid_request. An Index MAY also answer unsupported to known keys it could answer only by reading every Record it holds, such as a capability namespace prefix that no other key narrows; the caller narrows the filter (by issuer, for one). A query to a restricted Index is a signed request, { actor, kid, rid, iat, exp, filter, cursor, limit, sig } in the form of §10.4; the Index admits the Actors the restricted Card's policy.audience names (a Gateway querying on its own behalf is an Actor like any other, named by its own ID).

Element Value
filter type (agent_card or a Profile type), actor_type, capability (a capabilities[].name, exact, or a namespace prefix ending in a dot such as com.example.), profile (a Card lists it in supported.profiles, a Profile Record carries it in profile), issuer, text (optional; over handles, capability names, descriptions and tags, and a Profile Record's summary; a Record matches when it holds every word of the text, split on white space, in any order, and whether a word matches whole or also inside a longer word is Index-defined)
paging cursor, limit (default 20, max 100; an Index MAY cap it lower, and clamps a larger value instead of refusing it)
result item record (the full signed Record: a Card or a Profile Record), score (Index-defined, not comparable across Indexes)
ordering Index-defined; order carries no meaning

Results are signed Records and the Index vouches for nothing. An Index does not list a Record once it holds a revocation of that Record that counts (§11.5), and a Gateway does not serve such a Record by fetch (not_found). Verify the chain and exp before contact; a Profile Record is checked by its Profile's freshness rules (exchange.v1: valid_until, §14.3).

9.4 Gateway discovery and failover (Profile discovery.v1)

The set of Gateways is small, so there is no DHT; four rules cover discovery and failover.

  1. An Agent caches every Gateway it sees in any Card. Each counterparty's Card names one, so candidates accumulate for free.
  2. If its Home Gateway is down, an Agent MAY POST directly to a recipient's Home Gateway (§10.4) or re-home with Card v+1; sessions at other Gateways are an L3 matter.
  3. Bootstrap is one signed list at /.well-known/aep/gateways: a payload Record with content_type application/aep.gateways+json and data: { gateways: [ { id, url, registration: open·gated, profiles[], scopes[] } ] }, signed by its publisher, whose Actor ID a product pins; url is the Gateway's /v1 base, profiles[] repeats the supported.profiles of the Gateway's Card, and scopes[] are the handle scopes it issues (§4.2). A scope appears under one Gateway of a list; where a list names it twice, the first entry holds it. The publisher decides which scopes an entry carries: what a Gateway declares about itself (below) says what it offers to issue and is no claim on anyone's list.
    • Publishers may be many; the Owner picks which to trust.
    • The trust anchor is the publisher's Actor ID, which a client learns out of band (the Gateway it joined, a product's pin), never the URL, and the publisher's key rotates like any Actor's, through its Card chain; a list is a Record, so a newer v from the same publisher replaces an older one and an older one replayed is ignored (§6.2), which is the whole rollback rule; and lists are per publisher, so two publishers disagreeing is not a partition to heal but two opinions the Owner chose between.
    • A Gateway that publishes a list signs it with its own key, and the Gateways it names are the ones it will ask on a lookup (§10.4) and accept control attestations from (§9.3); naming a Gateway on the list is not vouching for it beyond that.
    • To the description every Gateway serves at GET /.well-known/aep/gateway (§10.4) this Profile adds scopes[] and registration; what the Gateway implements is the supported.profiles of the Card in that answer.
  4. On delivery failure the sending Gateway re-resolves the recipient's Card (§12.5). Re-homing is Card v+1.

A malicious Gateway cannot forge a sender's signature; it can drop, delay, serve a stale Card or fake a receipt, and §18.2 bounds each of those. Dropping means no delivered, which the sender notices.

10. Messaging: 1:1 and groups (Core: §10.1, §10.4, §10.7) (continued; the rest of this section is in aep-core.md)

10.3 Direct delivery (Profile direct.v1)

If agent_card.endpoints contains kind: direct, senders SHOULD send to it before using a Gateway, with the same Envelope and the same Record; on failure, fall back to the Gateway, and both paths collapse by (from, id), which requires that the direct endpoint and the mailbox client share one durable dedup store at the recipient: a command executed from the direct path MUST be recognized as already executed when the same Envelope later arrives through the mailbox (§12.2), or the recipient MUST NOT offer a direct endpoint. Direct delivery is an optional fast path that provides synchronous acceptance only: the recipient's answer means accepted, never delivered. A direct path produces no delivered at all; delivered is the statement of the Gateway that holds the mailbox or room log and of nobody else (§7), so one message never carries two of them. The evidence a direct path yields is the recipient's own processed, which is the stronger statement in any case, and the HTTP answer is not evidence a third party can read.

A direct endpoint is an HTTPS URL (TLS 1.3 at minimum) that implements POST /v1/send as in §10.4 for this Actor only. It MUST append the Envelope to a durable mailbox before answering accepted; an answer that means "received but not stored" is an Error, not accepted. The Card pins the endpoint's TLS public key in spki, and a sender MUST NOT connect when the presented key differs, so a hijacked host or a stale DNS record cannot take the direct path over. A sender MUST NOT use a direct path for an irreversible or financial command, because a direct path produces no Gateway-signed accepted_at, which the compromise rule of §11.5 relies on. The same clock-skew, size and error rules apply. Nothing in Core depends on this section; an implementation that never offers or uses a direct endpoint is complete.

10.5 Groups (Profile groups.v1)

A group is the membership defined by a context Record. The controller publishes context{kind: room, members[], acl, epoch} and rotates the group key on every membership change with v+1 and epoch+1. Messages target ctx. The Gateway hosting the room acts as room router: it reads the plaintext context Record published to it for membership and ACL, appends each Envelope to one room log that members read under their own cursors, and never reads message bodies. This is the one place a Gateway interprets a Record, and it is confined to L2.

The room router does exactly seven things and interprets nothing else:

  1. checks that ctx names a context Record it holds, pinned to its current version (@v); the version before it is accepted for a grace period of 5 minutes after the change and rejected after that with conflict, and a version further back is rejected with conflict at once;
  2. compares the Envelope's enc.epoch, if any, with the current epoch, and rejects a mismatch with conflict unless it falls within the grace period of step 1 (a deliberate trade-off: a member removed by the change can still post to the old epoch for those 5 minutes, which is accepted so that honest messages in flight at the moment of the change are not lost);
  3. checks that from is a member in the version of the context the Envelope names: the current version, or inside the grace period of step 1 the one before it, which is what lets a member that the change removed post for those 5 minutes;
  4. applies acl to read, write and invite;
  5. appends the Envelope to the room log, which members read from this Gateway with a signed room sync (§10.4) under per-member cursors; a member's own Home Gateway is never involved;
  6. issues delivered per member.
  7. takes an Envelope out of the room log at a signed removal request of the room's controller (§10.4), keeps the Envelope's from and id until its exp and rejects it with forbidden if it is sent again, so that nobody puts a removed Envelope back; a removal of an Envelope the log does not hold changes nothing, and copies that were read before are not touched.

acl values: read is members or public; write is members or controller; invite is controller or members. A Record sent to ctx by a non-member or outside acl.write is rejected by the router with forbidden. join is open (a join request is granted by the controller's Agent without human review), approval (requests wait for the controller's Owner) or invite (requests are rejected; only an invitation by the controller or, if acl.invite allows, by a member adds a member). A join or leave request is a payload to the controller with content_type application/aep.join+json or application/aep.leave+json and data: { ctx }; it changes nothing until the controller publishes v+1. A join request sent in plaintext that carries nothing but content_type and data: { ctx } (no other member in its Envelope, its Record, the Record's body, the Envelope's sig or the Record's one signature, so no summary, attached or second signature), to a controller whose current version of that room has join open or approval passes the controller's contact: none (§9.3): the controller chose a room that takes requests. A sealed one is held to contact as any message, since the Gateway cannot read it. Switching a room to approval or invite is one such v+1 and leaves existing members untouched. A room with acl.read: public carries plaintext Records (no enc) and anyone may sync its log from the room's Gateway through GET /v1/rooms/{ctx}/sync (§10.4), unsigned; switching between public and members requires epoch+1 so that old keys do not read new messages. A router MAY host no public rooms (an operator that serves no content to the public): it then rejects a context version with acl.read: public with unsupported before storing it, and the unsigned sync of any room with forbidden. In a room with acl.read: public the members are those who may write under acl.write; reading needs no membership. A plaintext Envelope to a room whose current version has acl.read: public MAY be accepted when its sender may write under that current version, whatever earlier version its ctx names (steps 1 to 4 then read the current version): nothing of it is sealed to a member list, so a member's post is not refused while members join. A router bounds what a room's log holds; a full room with acl.read: public MAY drop its oldest Envelopes instead of rejecting new ones, and a router that does keeps the from and id of each Envelope it dropped until that Envelope's exp and rejects it with forbidden if it is sent again, so that nobody puts a dropped Envelope back. A room whose current version has passed its exp and whose log is empty MAY be forgotten by its router, which then answers for it as for a room it never held. An operator MAY stop serving a room, for instance to take down what its law requires: the router then rejects its sends, syncs and new versions with forbidden and does not serve its context; it MAY also take one Envelope out of the log as the controller's removal does. Exactly one controller is active at a time: controllers[] lists the active controller first and successors in order. A context Record, like any Record, has one issuer (§6), so a successor cannot publish a v+1 of it; succession is a new context Record issued by the successor, whose predecessor names the old one (issuer/id@v) and whose members[] carries the membership over, published only after the active controller's key is revoked or its Card has expired. Members follow it when the successor is next in the predecessor's controllers[] and that condition holds, and the room moves to the successor's Home Gateway with it. A room thus survives its controller without any consensus rule; a controller that lets its Card lapse hands its rooms to the next in line, and that is intended.

The room router takes no part in a succession. It does not read predecessor: the successor's context is another Record and therefore another room, with a log of its own that starts empty, and the earlier log stays in the predecessor's room. The router verifies a context version when it is published and routes by its own copy from then on, without fetching the Record again. So a room whose controller's key is revoked, or whose controller's Card is no longer public, goes on under the last version the router accepted: its members still send and sync, the controller publishes the next version with its next key, and once no key of the controller is in force no further version can be published and the membership stays as it is, which is when the members follow the successor's context.

The router checks a context version when its controller publishes it, before the Record is stored. Its v is higher than the one the room holds (the same version sent again is accepted and changes nothing); a version that changes the set of members or acl.read carries epoch+1, and any other version carries the current epoch or epoch+1. A version that fails this is rejected to its publisher with conflict, and one whose body is not a valid room with invalid_request or forbidden; a rejected version is not published and leaves its v free. A valid room is a context of kind: room in which the Record's issuer is first in controllers[], no controller and no member is listed twice, every controller is a member, every entry of members[] carries id, role (member or controller) and since_epoch (the epoch, 1 or higher, from which that member reads), acl carries read, write and invite, and the key material is as stated below. A context whose kind is not room is an ordinary Record and has no room. A room's context, its member list included, is a published Record like any other: whoever knows its reference can fetch it from the room's Gateway unsigned (§10.4), whatever acl.read says, because acl.read governs the room log and not the context. It is not filed in an Index (§9.3) and query does not list it, so a room is found only by those who were given its reference.

The room lives at the Home Gateway of the context's issuer, the controller who created it: that controller also sends the context Record there in plaintext, and that Gateway relays ctx traffic. Members find it by resolving ctx → context.issuer → the controller's Card → endpoints[].gateway, and send their ctx Envelopes to that Gateway directly and read the room log there with a signed room sync, since a Home Gateway below L2 rejects ctx (§5) and mailboxes never carry room traffic. In epoch mode each context version says where its members find the wraps of the epoch key, one per member: inline in epoch_keys[], which then holds exactly one wrap for every member (the router rejects a list with a wrap for a non-member, two wraps for one member or a member left out with forbidden), or in a key package, an artifact Record (§7) referenced by key_package_ref, which the router carries and does not follow; the layout of a key package is not defined yet. A room with acl.read: members and more than 32 members carries one of the two, and the router rejects a version that has neither with invalid_request; a room with acl.read: public needs neither. A context is one Record in one Envelope, so the Envelope limit bounds a room: at the default 256 KiB (§5), with a member entry of about 95 bytes and a wrap of about 200, that is about 880 members with inline wraps and about 2,700 with the wraps in a key package. A larger room needs its member list outside the context Record, which this version does not define.

  • Up to 32 members with acl.read: members: one content key, HPKE-wrapped per member (enc.recipients). The wraps MUST cover every current member, the sender included so that it can reread its own history; a wrap for a non-member, or a missing member, is rejected by the router with forbidden, so a message meant for part of a room is a new room. The router holds no group key state.
  • From 33 members with acl.read: members, up to what one context Record holds (about 880 members with inline wraps, about 2,700 with a key package; see above): encrypt with the epoch key (enc.epoch), and the router rejects an Envelope of such a room that carries no enc.epoch with invalid_request; the router keeps one room log and a per-member cursor (fan-out on read), and ciphertext is never replicated per member. Each membership change still costs one wrap per member, inline or in the key package, which is why the next step exists.
  • Above that, or when PCS is required: the MLS suite (§11.2), whose key updates cost O(log N) per change. At L3 a room MAY also have mirrors: a member's Home Gateway pulls the room log from the host over a Gateway-authenticated session, serves the room sync to its own members and issues their delivered, so a large room is no longer one Gateway's load.
  • New members read only epochs after they joined; removed members cannot read later epochs. Sharing history means re-encrypting selected Records.
  • Invitations, leaving and removal are all settled only by the controller's context v+1 (epoch+1). A controller MAY tell an Actor that a version adds it by a payload to that Actor with content_type application/aep.invite+json and data: { ctx } naming the version, which changes nothing by itself. A leaving member asks the controller; until the rotation lands, keys remain valid and stopping reception is the member's own choice. policy.contact applies to group invitations. delivered is issued per member, one per sender per ack with the covered Envelopes listed, exactly as for a mailbox (§10.1).

11. Keys and cryptography (Core; §11.2 and §11.4 are sealed.v1, the Owner hierarchy of §11.1 is owner.v1) (continued; the rest of this section is in aep-core.md)

11.4 Encryption (Profile sealed.v1)

  • HPKE runs in base mode: no PSK and no sender authentication at the HPKE layer, because the Record and Envelope signatures authenticate the sender. Public keys are raw 32-byte X25519 keys, base64url in pub. Among a recipient's enc keys the sender uses the one with the latest valid_from that is unexpired (a Card that lists more than one unexpired enc key carries valid_from on each; with one key nothing is compared, and of two with the same valid_from either will do, since the recipient holds both), and wraps for that one key only; the recipient keeps its previous key for the Envelope TTL (§11.5), so no Envelope ever carries two wraps for one recipient. The copy of the Card a sender seals to SHOULD be one it resolved, or revalidated with a conditional resolve (§10.4), within the last 24 hours: the key that copy names is rotated within days and kept only for the Envelope TTL after that, so an older copy can name a key the recipient no longer holds. A receiver that cannot decrypt sends the sender a plaintext attestation{kind: rejected} naming the Envelope, with unsupported and the kids it holds in detail (the usual causes are a sender's old copy of the Card and an enc key dropped too soon, §11.5); it never answers an attestation this way, so nothing chains. A sender answered this way resolves the recipient again and sends the Record in a new Envelope. A recipient whose Card lists no enc key cannot be sealed to: a sender either sends the Record in plaintext, which every Gateway on its path can read, or does not send, and which of the two is the sender's own policy (a product that promises its users encryption does not send).
  • Explicit recipients: pick a fresh 32-byte content key K and a 12-byte nonce per Envelope. body = base64url(nonce ‖ ChaCha20-Poly1305(K, nonce, JCS(Record), aad)) with aad = utf8(id) ‖ 0x00 ‖ utf8(from). For each recipient i, the single-shot seal of RFC 9180 with no associated data of its own, HPKE.Seal(pk_i, info_i, "", K) with info_i = utf8(id) ‖ 0x00 ‖ utf8(from) ‖ 0x00 ‖ utf8(to_i), gives recipients[i].ek (the HPKE encapsulated key, 32 bytes in the MTI suite) and recipients[i].ct (the wrapped K with its tag, 48 bytes), both base64url. The same construction serves one recipient and thirty-two, so a 1:1 Envelope also wraps a content key rather than sealing body directly: one code path, one set of vectors.
  • Context: encrypt with the current epoch key K_e, 32 random bytes distributed in epoch_keys[] wrapped per member exactly as above, using the same AEAD and aad = utf8(id) ‖ 0x00 ‖ utf8(ctx) ‖ 0x00 ‖ utf8(epoch), where ctx is the pinned reference issuer/id@v and epoch the decimal epoch number; set enc.epoch. Binding both the Context version and the epoch into the AAD means two different membership changes can never be read as the same epoch. Rotate on every membership change (MUST). New members read later epochs only; removed members cannot read later epochs.
  • Attachments are encrypted by the sender with the same AEAD under a per-artifact key, wrapped per recipient in artifact.keys[] exactly as enc.recipients, the artifact Record's own pinned reference standing in for the Envelope's id and from: aad = utf8(<issuer/id@v>) and info_i = utf8(<issuer/id@v>) ‖ 0x00 ‖ utf8(to_i). A Context using MLS exchanges key packages through context.key_package_ref.

13. Authorization (Profile owner.v1; constraints and tie-break are exchange.v1)

Authorization is deny by default. Core has one authorization object: delegation. Execution approval lives in the exchange Profile (§14.2); authorization embedded in a foreign payload (for example an AP2 mandate) is governed by that protocol.

Concept Representation
Delegation Standing authority Owner → Agent: scope, audience, constraints, exp. Sub-delegation (a delegation naming a parent) can only narrow
Consent A delegation over disclosure, contact or data scope: scope contains disclose:<scope>
Policy agent_card.policy: exposure and contact conditions (§9.2)

Scope grammar, so that two implementations evaluate the same delegation the same way: a scope is verb:target, split at the first :; verb matches [a-z][a-z0-9_]* (a Core verb or one a Profile registers) and so never contains a colon, target is the rest of the string, byte for byte, with no escaping (a Record reference, an Actor ID, a name or *), and scopes compare as exact strings.

Core defines two verbs: disclose:<scope> (consent over a disclosure scope such as cv) and represent:<actor id> (an Owner's represent:<owner id> says the subject speaks for that Owner; an Agent's represent:<agent id> scopes one of its own device keys, §11.1). exchange.v1 registers command:<ref> and agree:<ref> (§14).

* matches any target of that verb and nothing else; no other wildcard exists. audience[] lists Actor IDs or *.

A sub-delegation names its parent in parent (issuer/id@v) and is narrower when every scope it grants is granted in its parent directly or by *, its audience is a subset, its exp is not later, and each constraint is at least as tight: max_amount not higher, time_window within, target either equal to the parent's or any specific value when the parent has * or none, and record_digest equal to the parent's when the parent has one.

A delegation MAY cover one Record and nothing else: constraints.record_digest is that Record's digest, SHA-256 of the JCS of the Record without sigs and attached (attached[] is where the delegation itself travels, so it cannot be covered; everything else the Record says is). A chain whose constraints carry record_digest authorizes the Record whose digest it is and no other. A reference issuer/id@v names a Record and does not fix its content: only its issuer's honesty keeps two different Records from carrying one reference, so a grant that is meant for one Record states the digest (§14.2).

A chain is verified from the leaf upward through parent until it reaches a delegation issued by the Owner, the one the acting Agent's current Card names (for an agreement, the principal its parties[] entry names, §14.1), with at most 4 links (a device-key delegation, one with key_kid, is never a link, §11.1); when several valid chains grant what is needed, the evaluator prefers one whose leaf names the exact target over one that grants *, then the leaf with the latest iat, then the smallest (issuer, id) by byte order, and applies that chain's constraints; attached[] carries at most 16 Records and 64 KiB in total, an attached Record carries no attached[] of its own (one level, so that a receiver's work is bounded), and a receiver rejects anything beyond that with invalid_request rather than verify it.

A command is authorized if at least one chain in attached[] authorizes it, and that chain's constraints apply, chosen by the preference above when several do. A delegation that names a parent is a link only when that parent is at hand, it narrows it, and its issuer is one who may narrow it: the parent's subject, handing its authority on, or the parent's own issuer narrowing that grant for the same subject, which is what an Owner's approval over its standing delegation is. Anyone else's delegation under a grant is not a link, however narrow. A delegation without a parent is a root only when the Owner issued it.

These checks are mechanical; an implementation adds no judgement of its own, and the reference implementation ships them as aep.delegation.authorize.

Evaluation order: revocation → delegation (scope, audience, exp, chain) → Context ACL → process. A Gateway evaluates metadata policy only; the receiving Agent evaluates content after decryption. Explicit denial and revocation beat permission. Authorization decides what an Agent may accept, never what it must do: a Record that passes every check is still only input, and acting on it remains the Agent's decision under its Owner's policy (§1.4).

16. Federation and deployment scope (Profile federation.v1)

A Gateway is an endpoint operator and anyone can be one. Scope changes routing, trust and discovery only; Envelope and Record semantics are identical everywhere.

16.1 Gateway identity

  • A Gateway has an agent_card with actor_type: gateway. Any Actor may host others' mailboxes, and Nostr relays, DIDComm mediators and SLIM nodes act as Gateways through bindings (§10.6). The signing key is published in the Gateway's description at /.well-known/aep/gateway (§10.4), behind TLS. On the public internet the trust root is WebPKI plus the Gateway ID; inside an organization, its own CA.
  • routable leases are L3. Beyond its own Card, the signed Gateway list it may publish (§9.4), delivered, transport rejected and routable, a Gateway issues nothing: Envelopes cross every hop with the sender's own sig.

Bootstrap trust has a root and is not circular. A product pins the Actor ID of at least one Gateway-list publisher, fetches the signed list over WebPKI TLS and verifies the signature. A Gateway's own Card, served at /.well-known/aep/gateway on the origin of its URL (§10.4) and signed by its key, binds that URL to its Actor ID, because the Card names the URL as the Gateway's endpoint and whoever fetches the document checks that it does, and the hello at OPEN repeats the ID; a Gateway presenting on some URL an ID other than the one the Card for that URL names fails both checks. Gateway keys rotate through the Gateway's Card like any Actor's.

16.2 Handshake

On first contact two Gateways exchange and cache: Gateway ID and trust root, supported, route authorization (the Actor range it is home for, with route leases), key-status sources (Directory URL, revocation feed), replay policy and TTL.

16.3 Routing and moves

  • The Home Gateway is declared in agent_card.endpoints[].gateway and confirmed by a route lease: attestation{kind: routable, issuer: gateway, subject: actor, exp ≤ 24 h}, which the Gateway issues when the Actor authenticates to it (a signed sync, or OPEN where the Relay Session is offered) and presents in handshakes and transfers. A routable lease from any Gateway other than the one the Card names is ignored, so a Gateway cannot claim to host an Actor it does not host; during a move, until the new Card has propagated, a lease from the Gateway the previous Card version named is honored for the remaining life of that lease (≤ 24 h). When delivering to a recipient, the sending Gateway MUST verify that the Gateway it connects to presents the Actor ID named in the recipient's Card; a valid TLS certificate alone never suffices.
  • A move is Card v+1 with a new gateway. At L3 the previous Gateway SHOULD forward the remaining mailbox to the new one until its lease expires; below L3 it keeps the mailbox drainable and answers new sends with unavailable (§10.4, §12.5). The ID does not change.
  • Gateway-to-Gateway transfer carries Envelopes unchanged, each with the sender's own sig; the receiving Gateway verifies every sig and attributes nothing to a from whose sig fails. Transfers are authenticated at the transport level only (TLS to the URL each Gateway's Card names, §16.1). The last line of defense for sender authenticity is the receiver's issuer check (§11.3).

16.4 Consistency and scope

Fact Consistency
agent_card, delegation, revocation Strong in the home region; elsewhere signature verification plus a TTL cache
context membership, epoch Strong at the controller
agreement Participant signatures are the truth
Index Eventual
Deployment Scope Characteristics
local One LAN or closed network One trust root, direct resolve, no federation
private An organization Org ACL, private Directory and Index, optional egress
federated Public internet Home-region authority, route leases, regional indexes, summary/top-K federation

IDs persist across scopes. Closed-network material MUST NOT be exposed without an explicit federation policy. Large deployments use a Home Directory, Regional Indexes built incrementally from the event log, and summary/top-K federation; large Contexts keep one room log plus per-member cursors instead of replicating ciphertext.