View as Markdown

ABY-3 — Capability Model#

Version 0.2.14-draft · Part of the AllowedBy specification set

1. Purpose#

Capabilities are what a grant allows. They are strings with optional constraints, defined by services, carried in grants, narrowed along delegation chains, and matched by services at request time. The model is deliberately small so that any service can define its own vocabulary without a registry.

2. Syntax#

capability      = namespace ":" action
namespace       = 1*63( ALPHA / DIGIT / "-" / "." )
action          = 1*63( ALPHA / DIGIT / "-" / "_" ) / "*"
constraint-name = LCALPHA *31( LCALPHA / DIGIT / "_" )
scope           = segment *( ( ":" / "/" ) segment )        ; at most 256 characters
segment         = 1*64( ALPHA / DIGIT / "-" / "_" / "." ) / "*" / "**"
field           = 1*( "/" 1*64( ALPHA / DIGIT / "-" / "_" ) ) ; JSON Pointer subset
LCALPHA         = %x61-7A
decimal         = 1*15DIGIT [ "." 1*6DIGIT ]  ; JSON string, e.g. "5000.00": at most 15 digits before the
                                            ; point and 6 after, so sums stay exact in a decimal type
currency        = 3UPALPHA                  ; ISO 4217
UPALPHA         = %x41-5A

Examples: invoices:read, invoices:approve, payments:release, files:*. The namespace aby is reserved (§6).

A capability object in a grant:

{ "cap": "invoices:approve",
  "constraints": {
    "amount": { "max": "5000.00", "currency": "EUR", "per": "grant", "field": "/total" },
    "count":  { "max": 20 },
    "scope":  "invoice:*",
    "fields": ["/comment", "/status"],
    "window": { "from": "08:00", "to": "19:00", "tz": "Europe/Paris" }
  } }

All constraints are OPTIONAL. Constraint values MUST match this grammar: scope as scope, each fields entry as field, amount.max as decimal, amount.currency as currency. These values are copied into the text the human signs, so a node MUST refuse an approval or attenuation whose values do not match (400 invalid_request), and a verifier MUST treat such a capability as not matching. The constraint names below are the registered set (OAID-1 §9). A verifier that meets an unknown constraint MUST treat the capability as not matching; nodes MUST preserve unknown constraints byte-identical along delegation.

Constraint Form Semantics
amount { "max": "5000.00", "currency": "EUR", "per": "call" | "grant" | "day" | "week" | "month", "field": "/total", "tz": "Europe/Paris" } max is a decimal string, inclusive. currency is ISO 4217. field is a JSON Pointer into the request body, chosen by the service's route map; a grant may only name the same pointer. per: call bounds each request; per: grant is cumulative across all revisions and children of the root grant; day, week (ISO, from Monday) and month are cumulative per calendar period in tz (IANA, default UTC), under the root grant. No FX: a request in a different currency fails. Human and organisation budgets across grants are in ORG-1 §5.
count { "max": 20 } Calls counted under the root gid, shared by all revisions and children.
scope "invoice:4711", "invoice:*", "folder/**" A pattern over the request's resource id. Segments are separated by : or /. * matches exactly one segment; ** matches one or more segments.
fields ["/comment", "/status"] JSON Pointers that may be present in the body; any other member present fails.
window { "from": "08:00", "to": "19:00", "tz": "Europe/Paris" } Time of day, IANA zone, evaluated against the verifier's clock.

The SDK shorthand invoices:approve amount<=5000 (ARCH-1 §10) expands to this JSON and never appears on the wire.

Authority policy rules (ABY-1 §5) use the same cap and the same amount form, with members min, max (both decimal, inclusive, either optional) and currency; per and field do not appear in policies (the amount is the value at the route's amount_field).

3. Matching and attenuation#

A request requiring R with body B and resource id I matches a capability C when:

  1. C.cap equals R, or C.cap has action * and the same namespace;
  2. every constraint in C is satisfied by the actual request (§2 table). amount reads the value at field in B; count and amount per: grant are checked and incremented atomically by the service in a store shared by its instances. A service that cannot count MUST treat the constraint as unsatisfiable.

A child capability C' attenuates a parent C when:

  1. C'.cap matches C.cap under rule 1 (a * parent may be narrowed to a named action; a named parent cannot be widened);
  2. every constraint in C is present in C' and equal or narrower: amount with the same currency, per, tz and field and a lower or equal max; count.max lower or equal; scope pattern matched by the parent's pattern; fields a subset; window inside the parent's in the same tz; unknown constraints byte-identical;
  3. C' MAY add constraints C did not have.

Nodes enforce attenuation at POST {approvals}/grants/{gid}/attenuate (ABY-1 §4). Verifiers re-check it on every chain.

4. Classes#

Every route belongs to a class, which the verifier derives from its own route map, never from the grant. The verifier MUST reject a grant whose lifetime (exp − nbf) exceeds the class maximum, whatever class the grant claims (class_lifetime_exceeded).

Class Meaning Default min level Default max lifetime Single-use
read No state change visible to third parties 1 30 days no
write Reversible change inside the service 1 7 days no
write-hard Hard to reverse, or visible to third parties: sending, submitting, publishing 2 24 hours by default
irreversible Cannot be undone, or has legal effect: large payments, contracts, deletions 2 1 hour always

The table gives defaults. The service decides: its route map MAY set any level from 0 to 3 per route, add qes, and raise or lower the lifetime; no lifetime may exceed 30 days (ABY-1 §2). Payments are classed by amount in the route map: for example write-hard up to a threshold, irreversible above it.

For write-hard and irreversible routes, the verifier MUST require initiator.by == "service" with initiator.kid one of its own keys (§5, ABY-1 §3.3); such approvals are created by the service with human_hint (AMH-1 §3). Runtime-initiated grants are usable only on read and write routes.

4.1 Route map#

The route map is service configuration, not a wire format. Each route entry has:

Field Meaning
capability Capability required
class Class, or a list of { up_to, class } amount thresholds for payments
level Minimum level 0–3 (OAID-7 §2), default from the class table. 0 means the route needs no grant (identity only), so a level-0 route has no capability (nor resource or any option of a grant): a route map that gives it one is refused
qes true requires a qualified electronic signature on top of the level, which must then be at least 2 (OAID-7 §10)
max_lifetime Maximum grant lifetime, default from the class table
amount_field JSON Pointer used by amount.field
authn Minimum authenticator class from human.reg: hardware | synced | software (default software)
level_profile For level 3 only: eu or na restricts the route to that L3 profile (OAID-7 §5.3); absent accepts both
authority true requires an authority countersign (ABY-1 §5)
mandate true requires the human to act for an organisation under a valid mandate (ORG-1 §6)
disclose, disclose_optional Attributes required, and offered as optional, from the catalogue (OAID-7 §7); each MUST be declared in disclosure (§5)
routes:
  "POST /invoices/{id}/approve": { capability: "invoices:approve", class: write-hard, level: 2, amount_field: "/total" }
  "POST /payments":              { capability: "payments:release", amount_field: "/amount",
                                   class: [ { up_to: "1000.00", class: write-hard }, { class: irreversible } ],
                                   level: 3, authn: hardware, authority: true }
  "POST /contracts/{id}/sign":   { capability: "contracts:sign", class: irreversible, level: 2, qes: true }
  "GET  /me":                    { level: 0 }
  "GET  /invoices/**":           { capability: "invoices:read", class: read }

5. Publishing a vocabulary#

A service MUST publish https://<service>/.well-known/allowedby, generated from its route map:

{ "v": 1,
  "capabilities": [
    { "cap": "invoices:read", "class": "read", "description": "List and read invoices" },
    { "cap": "invoices:approve", "class": "write-hard", "description": "Approve an invoice for payment",
      "constraints": ["scope", "amount"] }
  ],
  "templates": {
    "invoices:read": {
      "summary": { "en": "Read your invoices" },
      "lines":   { "en": "Read invoices {scope}" } },
    "invoices:approve": {
      "summary": { "en": "Approve invoice {scope}, up to {amount.max} {amount.currency} per {amount.per}",
                   "fr": "Approuver la facture {scope}, jusqu'à {amount.max} {amount.currency} par {amount.per}" },
      "lines":   { "en": "Approve invoice {scope}, up to {amount.max} {amount.currency} per {amount.per}",
                   "fr": "Approuver la facture {scope}, jusqu'à {amount.max} {amount.currency} par {amount.per}" } }
  },
  "keys": [ { "kty": "OKP", "crv": "Ed25519", "kid": "s1", "x": "…", "use": "sig" } ],
  "authority_policy": "<compact aby-authority-policy+jwt, if the organisation has one>",
  "disclosure_key": { "kty": "EC", "crv": "P-256", "kid": "d1", "x": "…", "y": "…", "use": "enc" },
  "link": "https://api.example.com/allowedby/link",
  "org": "<compact aby-org+jwt, the organisation profile (ORG-1 §2)>",
  "disclosure": { "email": { "purpose": { "en": "Send you the payment receipt" }, "retention_days": 365 } },
  "openapi": "https://api.example.com/openapi.json"
}
Member Meaning
capabilities The vocabulary. Runtimes use it to request standing grants proactively.
templates Per capability, two templates, each per language: summary and lines. display.summary is the summary template of the first capability; display.lines has one lines template per capability, in order. Placeholders refer only to constraint members of that capability: {scope}, {amount.max}, {amount.currency}, {amount.per}, {count.max}, {window.from}, {window.to}, {window.tz}, {fields}. There are no other parameters. Templates are the only source of display text; the home node fetches them from the audience origin over TLS (ABY-1 §3.2). A placeholder whose constraint is absent is an error. {fields} renders as the entries joined with , . The home node renders in one language that every capability's templates provide: the human's if possible, otherwise the first common language in code order; there is no per-line fallback, and if no common language exists the request is 400 invalid_request.
keys The organisation's signing keys. Used to sign approval requests the service creates at a node (AMH-1 §3), named by initiator.kid in the grant (ABY-1 §2), and to sign its authority policy (ABY-1 §5). Fetched from the origin over TLS; there is no registration.
authority_policy The organisation's current authority policy (ABY-1 §5), if any.
disclosure_key The only key to which disclosures for this origin are encrypted (OAID-7 §7). Never taken from a request.
link Account linking endpoint (§6)
org The organisation profile (ORG-1 §2). REQUIRED.
disclosure Every attribute the service may request (OAID-7 §7), with a purpose per language and retention_days. REQUIRED when any route discloses.
openapi RECOMMENDED. URL, on the same origin, of the service's OpenAPI description (§5.1).

5.1 Standard API description#

A runtime given only a service's address must be able to find what it may do there, with formats it already knows. A service SHOULD therefore publish:

  1. An OpenAPI 3.1 document describing every route of its route map, served as application/vnd.oai.openapi+json, with:
    • two security schemes of type apiKey in header: AllowedBy (header Allowed-By) and AllowedByProof (header AllowedBy-Proof);
    • for each operation, the security requirement { "AllowedBy": [<capability>], "AllowedByProof": [] }, with an empty list for level 0 routes (OpenAPI 3.1 lets an apiKey requirement list roles; the capability is the role);
    • for each operation, x-allowedby with level, and for routes with a grant capability, class and resource, plus amount_field, authn, mandate, disclose and disclose_optional when set;
    • 401 responses that describe the challenge (WWW-Authenticate: AllowedBy … and problem details, ABY-2 §4).
  2. An API catalog at /.well-known/api-catalog (RFC 9727), whose service-desc link is that document and whose service-meta link is /.well-known/allowedby.
  3. The same two links in a Link header (RFC 8631) on /.well-known/allowedby.

The description is advisory. Verification always uses the service's own route map (§4.1), never what a runtime read, and a runtime MUST NOT take the OpenAPI document from another origin.

"/invoices/{id}/approve": { "post": {
  "operationId": "postInvoicesApproveById",
  "summary": "Approve an invoice for payment",
  "security": [ { "AllowedBy": ["invoices:approve"], "AllowedByProof": [] } ],
  "x-allowedby": { "level": 2, "capability": "invoices:approve", "class": "write-hard",
                   "resource": "invoice:{id}", "amount_field": "/total" },
  "requestBody": { "required": true, "content": { "application/json": { "schema": {
    "type": "object", "required": ["total", "currency"],
    "properties": { "total": { "type": "string" }, "currency": { "type": "string" } } } } } },
  "responses": { "201": { "description": "Done" }, "401": { "$ref": "#/components/responses/Challenge" } } } }

aby:link links the pairwise human.id for this origin to one of the service's own accounts. A service that offers linking serves the route POST {origin}/allowedby/link itself, with capability aby:link, class write, level 1, resource aby:link, and lists it in its route map.

  1. Code. While the user is signed in, the service issues a linking code for that account and shows it. The code is unguessable (at least 60 random bits), valid for a lifetime the service sets (at most 600 s by default), and single use. A new code for an account does not revoke an older one; when one of them is used (step 5), the account's other pending codes are revoked.
  2. Request. The agent sends POST /allowedby/link with the body {"code": "<code>"} (JSON, nothing else required).
  3. Code check first. An unknown code, or one at or past its issue time plus its lifetime (now ≥ issued + lifetime), is refused with 400 invalid_request before any approval is asked for. A code already spent is unknown.
  4. Approval. The request is then checked as any route (ABY-2 §5). The grant MUST be single use: its leaf carries single_use with the request_digest of this request (grant_insufficient otherwise), and it is consumed as ABY-2 §5 step 9 says (single_use_consumed when used again). Without such a grant, the service answers the challenge of ABY-2 §6: it creates the approval itself (initiator.by = "service", single use, audience itself, bound to this request) and returns its link and code.
  5. Binding. Accepted, the code is spent, every other pending code of the same account is revoked (a code issued earlier and seen by someone else cannot re-link the account later), and the service stores the pair (human.reg.iss, human.id[origin]) against the code's account, replacing any other pair of that account. Answer 200 with {"linked": true}.

A later grant matches a linked account only when both members of the pair match: the same pairwise id issued by another home node is another person. Thereafter the service sets human_hint to the linked id when creating approvals, and MUST reject grants whose (human.reg.iss, human.id) is not linked to an account authorised for the resource (403 human_not_linked). Services MUST link before accepting write-hard or irreversible grants, and for any resource shared by several users. This check is the service's own authorisation, done with the verifier's output. Pending codes and links are bounded.

Removing a link. A service removes the link of an account when it deletes the account, when the person asks to be forgotten, or when the account holder asks it to. It deletes the stored pair and revokes every pending linking code of that account, so a code issued before the removal cannot re-link it. Thereafter the person is refused as unlinked (403 human_not_linked) until they link again with a new code (steps 1–5).

7. Shared vocabularies#

Groups of services MAY publish a shared vocabulary under a stable URL and reference it as "imports": ["https://vocab.example/procure-to-pay/v1"]. Templates are still taken from the audience's own file. Nothing in verification depends on imports.

8. Security considerations#

  • A * action is powerful; services SHOULD refuse grants with * for classes above write.
  • Services MUST evaluate constraints against the actual request, not against the agent's description of it.
  • Class, level and lifetime are the verifier's decision; a grant's class claim is never trusted.
  • Multi-tenant services put the tenant at the start of every resource id, so a grant for one tenant never matches another's resources (ORG-1 §3.3).

Change log#

Every change to this document adds a row here and increments its version (README, Versioning).

Version Date Change
0.2.14-draft 2026-11-29 §4.1: a level-0 route has no capability (it needs no grant); a route map that gives it one is refused.
0.2.13-draft 2026-11-28 §6 Removing a link: the stored pair is deleted and the account's pending codes are revoked; the person is then human_not_linked until they link again with a new code.
0.2.12-draft 2026-11-27 §6 step 5: using a linking code revokes the account's other pending codes.
0.2.11-draft 2026-11-27 §6: the linking flow is normative: the linking code (lifetime, single use, checked before any approval), POST /allowedby/link and its answers, a single-use grant, the binding to (human.reg.iss, human.id).
0.2.10-draft 2026-11-26 §2: decimal has at most 15 digits before the point and 6 after (CHANGES §27).
0.2.9-draft 2026-11-18 Route field level_profile (OAID-7 §5.3, CHANGES §24).
0.2.8-draft 2026-10-29 api replaced by a standard description: openapi member, OpenAPI 3.1 profile, RFC 9727 API catalog (§5.1, CHANGES §22).
0.2.7-draft 2026-10-29 Optional api member in /.well-known/allowedby: the route map for agents (CHANGES §21).
0.2.4-draft 2026-10-29 amount.per day, week, month with tz; route map mandate, disclose, disclose_optional; org and disclosure in /.well-known/allowedby; tenant scopes (CHANGES §18).
0.2.3-draft 2026-10-28 Route map: any level 0–3 per route, and qes (CHANGES §17).
0.2.2-draft 2026-10-27 Grammar for scope, fields and amounts; one display language; {fields} rendering (CHANGES §16).
0.2.1-draft 2026-10-27 Templates are the only display source; service keys and authority_policy in /.well-known/allowedby (CHANGES §15).
0.2.0-draft 2026-10-27 Constraint semantics made precise; classes from the verifier's route map; amount-based payment classes (CHANGES §9).