<?xml version="1.0" encoding="utf-8"?>
<rfc version="3" ipr="trust200902" docName="draft-creviston-racr-00" category="exp" submissionType="IETF" consensus="false" tocInclude="true" symRefs="true" sortRefs="true">
  <front>
    <title abbrev="RACR">RACR Protocol: Recipient-Authorized Content Retrieval</title>
    <seriesInfo name="Internet-Draft" value="draft-creviston-racr-00" status="experimental" />
    <author initials="J." fullname="Jason Creviston" surname="Creviston">
      <organization />
      <address>
        <email>j4@j4crev.com</email>
      </address>
    </author>
    <date year="2026" month="November" day="22" />
    <area>Applications and Real-Time</area>
    <workgroup>Individual Submission</workgroup>
    <keyword>permission-based messaging</keyword>
    <abstract>
      <t>RACR (Recipient-Authorized Content Retrieval, pronounced "racer") is a federated protocol for exchanging recipient-authorized messages between portable identities. Stable decentralized identifiers let participants operate independently of their current hosting providers. RACR uses deterministic Concise Binary Object Representation (CBOR) and CBOR Object Signing and Encryption (COSE) for signed authorization records and message envelopes. A recipient provider validates authorization before retrieving a detached, digest-bound body from the sender provider. This document specifies the protocol architecture, grant-authorized delivery, and privacy boundaries.</t>
    </abstract>
    <note title="Editorial status" removeInRFC="true">
      <t>This is a first local working draft prepared for review. It is an individual contribution, not a working-group document or an RFC. Experimental is a proposed publication status, not an allocation of an RFC stream or a claim of IETF consensus.</t>
      <t>This working draft describes RACR using the specification snapshot maintained in the Hail repository and cited as <xref target="HAIL-SPEC" />. Some normative protocol details remain defined only in that snapshot, so this document is not yet a self-contained specification. The open protocol questions are identified in <xref target="open-issues" />. Before seeking stable publication, incorporate the remaining schemas and detailed validation rules into this document or standalone normative companions, including the existing attachment rules and implemented extension definitions, while preserving their authority boundaries.</t>
    </note>
  </front>
  <middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <t>Recipient-Authorized Content Retrieval (RACR) is a messaging protocol in which recipients decide who may send them messages and which categories of messages they wish to receive. Senders make message content available for retrieval and submit a small delivery envelope to each recipient. The content is retrieved only after the envelope has been checked against the recipient's current permissions. Recipients can revoke a sender's permission at any time.</t>
      <t>RACR aims to preserve recipient consent when users change providers, let senders establish their identities independently of the domains that host their services, and protect recipient activity from being exposed through content retrieval. It does not prevent abuse by an authorized sender, guarantee message availability, or provide end-to-end confidentiality for content held by providers.</t>
      <t>RACR defines a separate messaging protocol, not an extension to SMTP or MIME. Although its addresses may resemble email addresses, they do not imply compatibility with email systems. This specification does not define a gateway between RACR and email. A sender that relays received email as hails can say so in a signed statement inside the body (<xref target="body-origin" />); receiving and converting email remain that sender's own service.</t>
    </section>
    <section anchor="conventions">
      <name>Conventions and Scope</name>
      <t>Hail names the communication medium; a hail is an individual recipient-authorized message. RACR names the underlying protocol that providers implement to exchange hail. Hail identifiers such as <tt>hail.envelope</tt>, <tt>application/hail-body+cbor</tt>, <tt>#hail-messaging</tt>, and <tt>HailMessaging</tt> name the objects, formats, keys, and services used by that protocol. They remain current identifiers, not deprecated names awaiting replacement. This terminology does not change wire bytes, signature domains, or interoperability requirements.</t>
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119" />
        <xref target="RFC8174" /> when, and only when, they appear in all capitals, as shown here.</t>
      <t>This draft specifies the architecture and summarizes normative core requirements from <xref target="HAIL-SPEC" />. Where a complete wire or semantic definition has not yet been incorporated, the corresponding specification in that pinned snapshot is a normative dependency. Editorial omissions in this draft do not create alternative encodings, relaxed validation, or new authority. Attachment definitions are supplied by <xref target="HAIL-ATTACHMENTS" />. Any inconsistency between this draft and its normative references is a defect to resolve before publication.</t>
      <t>The core flow is delivery under a Grant using Envelope version 1. Envelope versions select distinct authorization profiles; higher-numbered versions do not supersede version 1 for Grant delivery. Connections, threaded replies, shared conversations, and provider transfer are implemented extensions, summarized in <xref target="extensions" />. They are not deferred merely because their complete definitions are outside this document. Implementations claiming an extension MUST implement its complete authorization and lifecycle rules.</t>
      <t>A decentralized identifier (DID) identifies a protocol participant independently of its hosting provider. A provider is infrastructure acting for one or more participant DIDs. A sender and recipient are protocol identities, not necessarily people. A Grant is a recipient-signed authorization lineage. An Envelope is a signed per-recipient delivery instruction. A Body is an immutable encoded content document. Signed objects use Concise Binary Object Representation (CBOR) and CBOR Object Signing and Encryption (COSE). Acceptance is a durable authorization decision; delivery is durable storage of verified content and its recipient-specific message record.</t>
    </section>
    <section anchor="architecture">
      <name>Architecture and Trust Boundaries</name>
      <t>The diagram shows provider operations. The recipient authorizes and signs the Grant before its provider publishes it; the providers perform discovery, envelope exchange, content retrieval, and status reporting on behalf of the participant identities.</t>
      <figure anchor="core-delivery-flow">
        <name>Grant-Authorized Delivery Between Providers</name>
        <artset>
          <artwork type="svg">
            <svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" width="700" height="570" viewBox="0 0 700 570">
              <title>Grant-authorized delivery between recipient and sender providers</title>
              <desc>Time progresses downward. The recipient provider discovers the sender's address and profile, then publishes a Grant signed by the recipient. The sender provider publishes an immutable Body and submits a signed Envelope to the recipient provider. The recipient provider authenticates and authorizes the Envelope, then atomically accepts it. It retrieves the Body from the sender provider using a token and recipient HTTP signature, receives bounded content, verifies and durably delivers it, and sends signed delivery status to the sender provider.</desc>
              <rect x="0" y="0" width="700" height="570" fill="white" />
              <g fill="none" stroke="black" stroke-width="1.5">
                <line x1="145" y1="50" x2="145" y2="550" />
                <line x1="545" y1="50" x2="545" y2="550" />
              </g>
              <g font-family="sans-serif" font-size="16" fill="black" text-anchor="middle">
                <text x="145" y="30">Recipient provider</text>
                <text x="545" y="30">Sender provider</text>
              </g>
              <g fill="none" stroke="black" stroke-width="1.5">
                <line x1="145" y1="90" x2="545" y2="90" />
                <path d="M 537 85 L 545 90 L 537 95" />
              </g>
              <text x="345" y="80" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">discover address/profile</text>
              <g fill="none" stroke="black" stroke-width="1.5">
                <line x1="145" y1="140" x2="545" y2="140" />
                <path d="M 537 135 L 545 140 L 537 145" />
              </g>
              <text x="345" y="130" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">publish signed Grant</text>
              <rect x="420" y="165" width="250" height="34" fill="white" stroke="black" />
              <text x="545" y="187" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">publish immutable Body</text>
              <g fill="none" stroke="black" stroke-width="1.5">
                <line x1="145" y1="240" x2="545" y2="240" />
                <path d="M 153 235 L 145 240 L 153 245" />
              </g>
              <text x="345" y="230" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">submit signed Envelope</text>
              <rect x="20" y="265" width="250" height="34" fill="white" stroke="black" />
              <text x="145" y="287" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">authenticate; authorize</text>
              <rect x="20" y="315" width="250" height="34" fill="white" stroke="black" />
              <text x="145" y="337" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">atomically accept</text>
              <g fill="none" stroke="black" stroke-width="1.5">
                <line x1="145" y1="390" x2="545" y2="390" />
                <path d="M 537 385 L 545 390 L 537 395" />
              </g>
              <text x="345" y="380" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">GET Body + token + signature</text>
              <g fill="none" stroke="black" stroke-width="1.5">
                <line x1="145" y1="440" x2="545" y2="440" />
                <path d="M 153 435 L 145 440 L 153 445" />
              </g>
              <text x="345" y="430" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">bounded content</text>
              <rect x="20" y="465" width="250" height="34" fill="white" stroke="black" />
              <text x="145" y="487" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">verify; durably deliver</text>
              <g fill="none" stroke="black" stroke-width="1.5">
                <line x1="145" y1="540" x2="545" y2="540" />
                <path d="M 537 535 L 545 540 L 537 545" />
              </g>
              <text x="345" y="530" font-family="sans-serif" font-size="14" fill="black" text-anchor="middle">signed delivery status</text>
            </svg>
          </artwork>
          <artwork type="ascii-art">Recipient provider             Sender provider
    |                              |
    |-- discover address/profile -&gt;|
    |-- publish signed Grant -----&gt;|
    |                              | publish immutable Body
    |&lt;-- submit signed Envelope ---|
    | authenticate; authorize      |
    | atomically accept            |
    |-- GET Body + token + signature --&gt;|
    |&lt;-- bounded content ----------|
    | verify; durably deliver      |
    |-- signed delivery status ---&gt;|</artwork>
        </artset>
      </figure>
      <t>There is one sender DID and one recipient DID per envelope. Multi-recipient delivery uses separate envelopes and authorization decisions, even when the body bytes are identical. A body digest is a content identity, not a message identifier or authorization credential.</t>
      <t>HTTPS authenticates a network endpoint and protects data in transit. DID resolution establishes which keys and service endpoint currently act for a participant. COSE signatures bind protocol objects to a required key role. Recipient-local authoritative state determines whether the signed object authorizes an action. None of these checks substitutes for another.</t>
      <t>Public address-to-DID and DID-to-service mappings are intentionally discoverable. Grant state, message state, account state, body-cache provenance, and user activity are protected. Privacy requirements therefore distinguish public routing information from relationship-dependent results.</t>
    </section>
    <section anchor="identity">
      <name>Identity and Discovery</name>
      <t>The RACR profile described here uses the PLC DID method, identified by the <tt>did:plc</tt> prefix. PLC maintains an operation log for identity updates and recovery. RACR DIDs use the exact lowercase syntax <tt>did:plc:[a-z2-7]{24}</tt>. A DID remains the durable identity when its hosting provider changes. A Hail address is a domain-verified alias; changing or withdrawing that alias does not revoke Grants issued to the DID.</t>
      <t>A RACR DID document identifies distinct Ed25519 public keys at <tt>#hail-identity</tt> and <tt>#hail-messaging</tt>, and exactly one <tt>#hail</tt> service of type <tt>HailMessaging</tt>. The identity key signs Address Bindings and Grants. The messaging key signs Sender Profiles, Envelopes, and Delivery Status objects. Verifiers MUST check the exact key identifier, controller, algorithm, and role. A valid signature under another key of the same DID is insufficient.</t>
      <t>The key representation in this profile is Multikey using base58btc with the <tt>ed25519-pub</tt> multicodec prefix (0xed, encoded as bytes 0xed 0x01), followed by exactly 32 key bytes. The DID and PLC profiles, including resolution evidence and recovery trust, are defined in <xref target="HAIL-SPEC" />. General historical authority after recovery is an open issue in <xref target="open-issues" />.</t>
      <section anchor="discovery">
        <name>Address Bindings and Sender Profiles</name>
        <t>An address uses a lowercase canonical ASCII local part and an Internationalized Domain Names for Applications (IDNA) A-label domain. Its local part permits dot-separated letter/digit/hyphen labels, is at most 63 bytes, and excludes quoting, comments, whitespace, non-ASCII characters, and domain literals. The complete canonical address is at most 254 bytes. These rules deliberately differ from SMTP mailbox syntax. The exact IDNA, DNS-delegation, and public-suffix checks remain in the Address Binding specification.</t>
        <t>Discovery uses WebFinger <xref target="RFC7033" /> with an <tt>acct</tt> URI <xref target="RFC7565" />. The client requires the exact canonical subject and exactly one matching link with extension relation <tt>https://racrproto.com/rel/address-binding</tt> and the COSE media type. The link relation uses the extension-URI mechanism of <xref target="RFC8288" />. The domain-selected HTTPS resource supplies a version-2 Address Binding signed by the named DID identity key. Neither a signature without domain publication nor domain publication without the signature verifies the address.</t>
        <t>An Address Binding contains <tt>type</tt>, <tt>version</tt>, <tt>address</tt>, <tt>did</tt>, <tt>issued_at</tt>, and <tt>key_id</tt>. It has no expiration field and requires no periodic renewal. Current domain publication and current DID authority are nevertheless required. Cached verification lasts at most 3600 seconds, and is shortened by HTTP freshness, delegation time-to-live (TTL) values, PLC policy, or local security policy. A retained signed binding does not justify indefinite verified-address display.</t>
        <t>A prospective recipient retrieves Sender Profile version 2 from <tt>profiles/{sender_did}</tt> at the current sender service. The profile is signed by <tt>#hail-messaging</tt> and includes a revision, display metadata, offered categories, and optional bounded bundled assets. Profile display metadata is not independent proof of an organization name. Grant creation binds the exact verified Address Binding and Sender Profile representation digests into <tt>consent_context</tt>.</t>
      </section>
      <section anchor="service">
        <name>Service URLs and Safe Fetching</name>
        <t>A canonical RACR service base is an HTTPS URL with an ASCII DNS hostname. It MUST NOT contain embedded credentials, a query component, or a fragment. The host MUST NOT be an IP address literal or end with a dot. The URL MUST NOT end with a slash. Default port 443 is omitted. Base-path segments permit only ASCII letters, digits, hyphen, dot, underscore, and tilde; empty interior segments and complete dot or dot-dot segments are invalid. The HTTP binding defines the limited permitted normalization of scheme, host, port, and a single trailing slash.</t>
        <t>Operation URLs are constructed by appending one literal slash and the operation path to the canonical base. Generic relative-URI resolution MUST NOT replace the final base-path segment. A client MUST NOT follow redirects or forward bearer credentials to a redirect target. Provider changes are authenticated through DID resolution.</t>
        <t>Cached discovery is refreshed once after the specified connection, redirect, not-found, gone, misdirected-request, or unknown-key conditions. A retry at a changed authenticated endpoint preserves the operation identity and required signed bytes. Body retrieval performs one sender-DID refresh per attempt after a concealed 404. Retry immediately only at a changed authenticated endpoint; otherwise use bounded delivery backoff through the effective deadline. Every request needs a fresh recipient signature and nonce. Ordinary 429 and 5xx responses do not by themselves establish migration.</t>
        <t>Outbound fetching MUST reject prohibited destinations and revalidate resolved addresses for each connection, preventing private-network access and DNS rebinding. Fetches require bounded time, bytes, and concurrency. A DID-authorized endpoint is not permission to reach arbitrary local networks.</t>
      </section>
    </section>
    <section anchor="encoding">
      <name>Encoding, Signatures, and Digest Domains</name>
      <t>RACR uses the core deterministic encoding requirements of CBOR <xref target="RFC8949" />. The data model permits null, booleans, integers from -(2^53-1) through 2^53-1, valid UTF-8 text, byte strings, finite arrays, and maps with unique text keys. Schemas further constrain values. Floating point, undefined, non-text map keys, indefinite lengths, application tags, duplicate keys, unknown fields in closed maps, and trailing bytes MUST be rejected.</t>
      <t>Receivers perform bounded decoding, deterministic re-encoding, and byte-for-byte equality checking. Integers and lengths use shortest encodings; maps use encoded-key bytewise order. Text is not silently normalized. Unicode Normalization Form C (NFC) requirements apply only where the schema specifies them. Diagnostic JSON is not a signed or hashed representation.</t>
      <t>Direct-payload signed objects other than envelopes and snapshots use the tagged <tt>COSE_Sign1</tt> structure from COSE <xref target="RFC9052" />. Tag 18 is required. The protected map contains exactly labels 1 (<tt>alg</tt>), 3 (content type), and 4 (<tt>kid</tt>); the unprotected map is empty. The payload is embedded deterministic CBOR, external additional authenticated data (AAD) is empty, and the signature is 64 bytes. <tt>alg</tt> is -19, the fully specified Ed25519 algorithm in <xref target="RFC9864" />; polymorphic Edwards-curve Digital Signature Algorithm (EdDSA) value -8, negotiation, and fallback are not accepted. <tt>kid</tt> contains UTF-8 bytes of the canonical absolute DID key URL.</t>
      <t>The protected content type is the exact object-specific string, such as <tt>application/hail-grant+cbor</tt>. Together with the payload type, closed schema, fixed algorithm, and key role, it provides domain separation. The HTTP entity type is <tt>application/cose; cose-type="cose-sign1"</tt>. HTTP media types are parsed according to their syntax, not compared as unparsed strings. Signed representations have no HTTP content coding.</t>
      <t>Envelopes instead use the COSE hash envelope <xref target="RFC9995" />. Their protected map contains exactly labels 1: -19, 4: key identifier bytes, 258: -16 (SHA-256), and 259: <tt>application/hail-envelope+cbor</tt>. The embedded payload is the 32-byte SHA-256 digest of the exact deterministic envelope descriptor. The unprotected map contains exactly the domain-controlled text key <tt>https://racrproto.com/ns/racr/preimage</tt> with the descriptor bytes. The verifier MUST check this preimage hash before exposing descriptor fields, and MUST verify the signature and current authority before admission or retrieval. Envelopes that do not conform to this profile MUST be rejected.</t>
      <ul>
        <li>
          <t>Address Binding, Sender Profile, and Grant revision digests hash complete signed COSE representation bytes. A Grant predecessor and its ETag therefore change if its signature wrapper changes.</t>
        </li>
        <li>
          <t>Envelope replay and Delivery Status correlation hash deterministic envelope descriptor bytes, excluding the COSE wrapper; they do not hash the embedded digest a second time.</t>
        </li>
        <li>
          <t>Body identity hashes exact uncompressed deterministic body bytes using SHA-256.</t>
        </li>
        <li>
          <t>URL digest segments and bearer credentials use canonical unpadded base64url <xref target="RFC4648" />. A 32-byte digest renders as 43 ASCII characters. Content-Digest <xref target="RFC9530" /> instead follows its structured-field syntax and hashes transferred content, including gzip coding when present.</t>
        </li>
      </ul>
      <section anchor="budgets">
        <name>Resource Budgets</name>
        <t>All providers MUST support otherwise valid bodies through 1048576 encoded uncompressed octets. The budget includes CBOR framing and bundled asset data. It does not promise unlimited account quota or delivery capacity. Envelope descriptors are bounded at 16384 octets and complete envelope representations at 17408 octets; Delivery Status representations at 16384 octets; Address Bindings at 16384 octets; Grants at 262144 octets. Other object-specific constraints remain applicable.</t>
        <t>The following limits apply to each independently decoded application CBOR domain and to the outer COSE domain. Application limits remain subject to the overall encoded limit and stricter object-specific limits.</t>
        <table anchor="decoder-limits">
          <name>Decoder Resource Limits</name>
          <thead>
            <tr><th>Resource</th><th>Application CBOR</th><th>Outer COSE</th></tr>
          </thead>
          <tbody>
            <tr><td>Maximum depth</td><td>32</td><td>8</td></tr>
            <tr><td>Total items</td><td>16384</td><td>256</td></tr>
            <tr><td>Array length</td><td>4096</td><td>8</td></tr>
            <tr><td>Map entries</td><td>256</td><td>8</td></tr>
            <tr><td>Text string bytes</td><td>1048576</td><td>1024</td></tr>
            <tr><td>Byte string bytes</td><td>1048576</td><td>Object limit</td></tr>
            <tr><td>Encoded bytes</td><td>Object limit</td><td>Object limit</td></tr>
          </tbody>
        </table>
        <t>In the table, "Object limit" means the applicable object representation limit. The application root counts as one item at depth zero. Container elements, map keys, and map values count recursively; string contents do not. Map length counts pairs. Byte budgets include headers and use UTF-8 bytes rather than character counts.</t>
        <t>For the outer COSE domain, tag 18 counts as a root item and its array has depth one. Protected headers restart counting at their map with a 1024-byte encoded and byte-string limit and no tag. Embedded payloads are checked separately. Transfer snapshots have distinct limits and are not authorized by these budgets.</t>
        <t>Implementations MUST bound allocation before trusting declared lengths. Wire-byte limits do not by themselves bound aggregate concurrent work or decoder scratch space. Providers MUST bound outstanding accepted and <tt>on-hold</tt> work, rejected replay records and their evidence bytes, and pre-authentication Grant verification and DID resolution. Resource admission MUST be atomic across concurrent requests. Fair scheduling and bounded per-sender retrieval concurrency MUST prevent one sender from monopolizing delivery. Include detached attachments in resource reservations. Exact quotas and concurrency values are provider policy, not wire constants. Unauthenticated requests MUST NOT cause unbounded durable resolution-evidence growth.</t>
      </section>
    </section>
    <section anchor="grants">
      <name>Recipient Grants</name>
      <t>Grant version 1 binds one grantor DID to one grantee DID, with a Universally Unique Identifier version 7 (UUIDv7) <tt>grant_id</tt> <xref target="RFC9562" />, revision, predecessor digest, scope, status, timestamps, consent context, and identity key identifier. Scope contains exactly one <tt>categories</tt> selector with a nonempty set of offered category IDs. General (<tt>general</tt>) is an ordinary category requiring explicit consent, not a wildcard. Connection-based messages do not use subscription Grants and MUST NOT contain a category. A Grant identifier is a lookup hint, not a bearer capability.</t>
      <t>A Grant becomes active when the recipient's provider validates and stores the recipient-authorized signed Grant. No separate activation action or sender acknowledgment is required. Restrictions and revocations likewise take effect locally without sender acknowledgment. The recipient's latest Grant revision is authoritative for delivery. This profile permits one active Grant per grantor/grantee pair.</t>
      <t>Every revision is a full-state snapshot. Revision 1 has a null predecessor. Subsequent revisions increment by one and name the SHA-256 digest of the previous complete signed representation. The fields <tt>type</tt>, <tt>version</tt>, <tt>grant_id</tt>, <tt>grantor</tt>, <tt>grantee</tt>, and <tt>issued_at</tt> are immutable within the lineage. Revision gaps, forks, conflicting representations, and changed immutable fields are rejected. Revocation is terminal for that lineage.</t>
      <t>Expanding the selected categories requires fresh explicit consent against current verified discovery evidence. Restriction or revocation MUST NOT depend on sender-profile availability and carries the previous consent context forward. A category omitted from the replacement snapshot is removed, not implicitly retained.</t>
      <t>Before identity-key rotation, the current Grant revision is acknowledged by the grantee. Following rotation, the grantor issues a higher revision under the new key rather than re-signing the same revision. Unacknowledged-rotation recovery is unresolved; this draft does not authorize accepting stale keys merely to bridge that gap.</t>
      <section anchor="grant-http">
        <name>Publication and Conditional Updates</name>
        <t>Grant publication is <tt>PUT grants/{grant_id}</tt> at the grantee service using the COSE entity type and no content coding. Revision 1 uses If-None-Match: * and no If-Match. A later revision uses one strong If-Match ETag whose opaque value is the base64url digest of the preceding complete signed representation, matching <tt>previous</tt>. Wildcards, weak tags, lists, and conflicting conditional fields are invalid for updates. HTTP conditional semantics follow <xref target="RFC9110" />.</t>
        <t>Creation returns 201 with Location and ETag; an applied update or exact current update retry returns 204 with ETag. An exact creation retry returns 412 with the matching current ETag. Only an exact submitted-representation digest match makes that 412 idempotent convergence. Other conflicts require reconciliation. Responses use Cache-Control: no-store.</t>
        <t>Before valid grantor authentication and local target confirmation, protected failures use a uniform 400 Problem Details result. Missing required preconditions may be disclosed as 428 only after authentication. Source-wide transport limits and public routing errors retain the independently selected exceptions defined in the HTTP binding. Grant publication does not permit querying unrelated relationships.</t>
      </section>
    </section>
    <section anchor="delivery">
      <name>Core Envelope Delivery</name>
      <t>A Grant-authorized Envelope version 1 contains <tt>type</tt>, <tt>version</tt>, <tt>message_id</tt>, <tt>from</tt>, <tt>to</tt>, <tt>authorization</tt>, <tt>created_at</tt>, <tt>expires_at</tt>, <tt>body</tt>, and <tt>reply</tt>; <tt>category</tt> and <tt>message_type</tt> have object-specific conditional semantics. <tt>authorization</tt> identifies type <tt>grant</tt> and the <tt>grant_id</tt>. The messaging signature authenticates <tt>from</tt>, which MUST equal the Grant grantee; <tt>to</tt> MUST equal the Grant grantor. A Grant-authorized Envelope MUST contain a <tt>category</tt> authorized by the Grant. The complete closed schema and conditional fields are defined by <xref target="HAIL-SPEC" />.</t>
      <t>A body descriptor contains a SHA-256 digest, <tt>size</tt> from 1 through 1048576, <tt>media_type</tt> <tt>application/hail-body+cbor</tt>, profile spt-1/spt-2/spt-3, <tt>available_until</tt>, and bearer access metadata. <tt>available_until</tt> is at least <tt>created_at</tt> plus 2592000 seconds and <tt>expires_at</tt> plus 300 seconds. The access expiration is no earlier than <tt>available_until</tt>. Both <tt>available_until</tt> and <tt>access.expires_at</tt> MUST be no later than <tt>created_at</tt> plus 2678400 seconds (31 days). Overlong commitments MUST be rejected rather than silently shortened. The immutable body and its authorization MUST exist before envelope submission and be retained through that availability commitment.</t>
      <t><tt>POST envelopes</tt> submits one signed envelope. No additional federation authentication beyond HTTPS and COSE is required. Deployments may use private controls, but those controls do not replace protocol signature verification. Batch federation submission is not defined.</t>
      <section anchor="acceptance">
        <name>Validation and Atomic Acceptance</name>
        <ul>
          <li>
            <t>Enforce transport and representation limits, then bounded deterministic COSE and payload decoding, closed-schema validation, and inexpensive field relationships.</t>
          </li>
          <li>
            <t>Use claimed fields only for relationship-independent syntax and resource rejection and the narrowly defined public DID routing check. Protected relationship lookups MUST NOT precede signature verification or select whether public key resolution occurs.</t>
          </li>
          <li>
            <t>Resolve and verify the exact sender messaging key and COSE signature. Authentication MUST precede protected relationship lookup, protected detail, authenticated replay-state mutation, or body retrieval. After authentication, a candidate authorization miss follows the generic path without body retrieval or a replay reservation.</t>
          </li>
          <li>
            <t>Serialize the authenticated (<tt>from</tt> DID, <tt>message_id</tt>) record. Identical payload digests reuse stored state; different payload digests conflict. Before reserving a new ID, apply bounded resource admission. When resource budgets are exhausted, providers MAY refuse new work without creating a replay reservation or mutating a capability; eligible authenticated callers receive 429 with Retry-After. Existing authenticated replay state remains recoverable. Reserve ordinary authenticated rejection results only after resource admission succeeds.</t>
          </li>
          <li>
            <t>Atomically recheck current recipient authorization and policy, then persist accepted delivery and required capability state. Grant changes and acceptance share an ordering: a revocation committed first rejects the new message; acceptance committed first allows its body processing to continue.</t>
          </li>
          <li>
            <t>Retrieve or reuse content only under the body authorization and provenance rules. Verify and stage it, then serialize the final deadline check, durable message publication, terminal state, and any capability consumption.</t>
          </li>
        </ul>
        <t><tt>created_at</tt> cannot be more than 300 seconds in the future. The effective delivery deadline is the earliest of <tt>expires_at</tt> plus 300 seconds, <tt>body.available_until</tt>, and <tt>access.expires_at</tt>. Acceptance and durable delivery MUST occur no later than that deadline. Clock tolerance never extends body or token retention promises. If completion misses the deadline, the terminal result is <tt>failed</tt> with reason <tt>delivery-expired</tt>.</t>
        <t>The replay key is the authenticated sender DID plus <tt>message_id</tt>, not the body digest. The sender MUST NOT reuse a message ID, including after rejection. Retained replay state lasts through at least max(<tt>expires_at</tt>, <tt>body.available_until</tt>) plus 300 seconds. Authenticated identical retries can recover stored state even after the original permission changes; they do not authorize a new delivery.</t>
      </section>
      <section anchor="responses">
        <name>Submission Responses and Disclosure</name>
        <t>Receipt, acceptance, and delivery are distinct. Before a sender is authenticated with a current or previous local relationship, protected outcomes use HTTP 202, Content-Type <tt>application/json</tt> without parameters, Cache-Control: no-store, and exactly the JSON object below. It contains no status-query handle or acceptance promise.</t>
        <sourcecode type="json">{"outcome":"received"}</sourcecode>
        <t>An eligible authenticated accepted or duplicate submission returns HTTP 200 with the current signed Delivery Status. Explicit protected errors map <tt>message-id-conflict</tt> to 409, <tt>invalid-envelope</tt> to 400, <tt>unauthorized</tt> to 403, <tt>message-expired</tt> to 410, <tt>rate-limited</tt> to 429, and <tt>temporarily-unavailable</tt> to 503. Every explicit unsuccessful response uses Problem Details <xref target="RFC9457" /> without disclosing more than the caller is entitled to learn.</t>
        <t>Relationship-independent method, media type, size, framing, and service-wide rate limits may return safe transport errors. A 421 is permitted only when sufficiently fresh authenticated public DID state proves an endpoint mismatch; local account or relationship absence does not justify it. Body retrieval has no public target DID and does not use this exception.</t>
        <t>Concealed outcomes MUST have common status, response shape, privacy-relevant headers, and a bounded response schedule based on measured validation behavior. Implementations must bound network-dependent resolution. Shared admission outcomes, including 429, MUST NOT depend on protected processing duration. Operations that ignore cancellation MUST remain bounded until they actually settle.</t>
        <t>Implementers must test repeated timing observations, including burst-and-probe observations as well as individual response timing. A guessed constant delay alone is not evidence that rejection paths are indistinguishable.</t>
      </section>
    </section>
    <section anchor="bodies">
      <name>Body Content and Retrieval</name>
      <t>A body is a closed Safe Portable Text (SPT) document, not arbitrary HTML. Every provider MUST validate, retrieve, and store <tt>spt-1</tt>, <tt>spt-2</tt>, and <tt>spt-3</tt>. Plain-text-only support is insufficient. <tt>spt-1</tt> contains normal text blocks and unmarked spans. <tt>spt-2</tt> adds specified headings, blockquotes, captions, lists, <tt>strong</tt>, <tt>em</tt>, and <tt>code</tt> decorators, and declared HTTPS links, plus optional <tt>left</tt>, <tt>center</tt>, or <tt>right</tt> text alignment and a <tt>cta</tt> style for prominent navigation links. <tt>spt-3</tt> interleaves 1 to 24 image blocks referencing bundled static Portable Network Graphics (PNG) or Joint Photographic Experts Group (JPEG) assets with rich text. All assets must be referenced. Image-role assets may appear anywhere; a header-role asset is reserved for a leading image.</t>
      <t>Clients MUST treat text as text, validate link schemes and attributes, and not interpret unknown nodes as executable markup. The <tt>spt-1</tt>, <tt>spt-2</tt>, and <tt>spt-3</tt> profiles define neither arbitrary HTML/CSS/scripts nor sender-controlled remote image loading. Advanced publisher layouts require new explicit nodes, validation, and presentation rules. A profile is not extensible merely because its data is represented as a map.</t>
      <t>A <tt>cta</tt> text block has exactly one <tt>spt.link</tt> annotation, with every span carrying only that annotation key, no list fields, and a concatenated single-line label of at most 128 UTF-8 bytes containing a character other than ASCII whitespace. Carriage return (CR) and line feed (LF) are prohibited. Its absolute HTTPS destination has no credentials and is at most 2048 UTF-8 bytes. It renders as an accessible navigation link with client-controlled button styling, never fetching its destination until explicit navigation. Optional text-block alignment is <tt>left</tt>, <tt>center</tt>, or <tt>right</tt>; absent means <tt>left</tt>. This hint changes neither reading order nor directionality and may be adapted for accessibility. These fields are supported by the <tt>spt-2</tt> and <tt>spt-3</tt> definitions in <xref target="HAIL-SPEC" />, not <tt>spt-1</tt>.</t>
      <t>Each image is limited to 524288 bytes, width and height 2400, and 2000000 pixels; header-role height remains 1200. Image occurrences total at most 24 and 8000000 decoded pixels, including repeated references. Readers preserve document order and aspect ratio. The declared media type selects the validator, and asset size, digest, and dimensions must agree with the bytes. PNG assets must be static; animated PNG is prohibited. JPEG assets must be baseline or progressive 8-bit images with exactly one frame, one to four components, only frame, table, restart-interval, scan, comment, and application segments, and no bytes after the end-of-image marker; arithmetic-coded, lossless, hierarchical, and multi-frame JPEG is prohibited. A message image requires plain-text alt text and may carry a caption, each at most 1024 UTF-8 bytes under the specified NFC and character rules. The complete body, including bundled bytes, still fits within 1 MiB. Sender Profile avatars remain PNG only, with separate limits of 32768 bytes, 512 by 512, and 262144 pixels.</t>
      <t>These byte, pixel, and structural budgets apply to encoded bodies and bundled assets. Detached file attachments have separate limits: at most 20 files totaling 25 MiB per message. Attachment metadata counts toward the encoded-body limit; detached file bytes do not. Attachment formats, authorization, retrieval, and delivery requirements are specified separately in <xref target="HAIL-ATTACHMENTS" />.</t>
      <section anchor="body-origin">
        <name>Relayed Origin</name>
        <t>An <tt>spt-2</tt> or <tt>spt-3</tt> body MAY contain one <tt>origin</tt> member: the sender's signed statement that it obtained the content from an external source and relayed it, for example a bridge that receives email and delivers it as a hail. An <tt>spt-1</tt> body MUST NOT contain <tt>origin</tt>. The member is covered by the body digest and therefore by the envelope signature. It attests only what the sender says about where the content came from. It is not evidence of authorship and grants no authority: delivery is authorized exactly as for any other body from that sender.</t>
        <t>The only current origin type is <tt>email</tt>. It carries the author address the sender read from the source message (<tt>from_address</tt>), an optional display name (<tt>from_name</tt>), an optional mailing-list identifier (<tt>list_id</tt>), the sender's DomainKeys Identified Mail (DKIM) result (<tt>authentication</tt>), and the time the sender received the source message (<tt>received_at</tt>). <tt>dkim-aligned</tt> means the sender verified a DKIM signature whose signing domain is the <tt>from_address</tt> domain or shares its registrable domain; any other outcome, including a valid signature for an unrelated domain, is <tt>none</tt>. Recipients cannot re-verify this result from the body. Address, name, and list-identifier syntax are defined in <xref target="HAIL-SPEC" />. Unknown origin types, authentication values, and members MUST be rejected.</t>
        <t>A reader that displays <tt>origin</tt> MUST keep the verified sender visible and distinct from the origin, and MUST NOT present the origin address as a RACR address, a verified identity, or the sender of the hail. It MUST indicate that the content was relayed and SHOULD show <tt>authentication</tt> when it is <tt>none</tt>. Readers MUST NOT use <tt>origin</tt> for authorization, reply addressing, contact matching, or sender-avatar selection. A reader MAY ignore <tt>origin</tt> for presentation, but a provider MUST still validate it. The member does not change what a body may contain. A participant that forwards or quotes a relayed body is composing new content and MUST NOT copy the original <tt>origin</tt> into it. Whether an account may state an origin at all is provider policy.</t>
      </section>
      <section anchor="body-auth">
        <name>Token and Recipient Proof of Possession</name>
        <t>For each recipient envelope, the sender generates exactly 32 cryptographically random token bytes. The signed body descriptor carries the token, body identity, and expiry. A token may be reused for retries of the same envelope, but MUST NOT be reused for another recipient or unrelated envelope. The server stores a token digest associated with body digest, recipient, message, expiry, and active state.</t>
        <t><tt>GET bodies/{digest}</tt> sends Authorization: Bearer followed by the canonical unpadded base64url token, using the scheme syntax of <xref target="RFC6750" /> without adopting OAuth issuance flows. Tokens MUST NOT appear in URLs. The token is necessary but insufficient. Every body and attachment GET MUST also carry the recipient HTTP signature defined below. The signed descriptor retains <tt>access.type = "bearer"</tt> to describe the token representation; it does not enable bearer-only retrieval.</t>
        <t>Missing, malformed, unknown, mismatched, inactive, or expired tokens and invalid or unavailable signature verification receive uniform 404 responses that conceal body existence. Authorization-lookup and replay-store outages also use this path. A missing or unavailable body may produce retryable 503 only after BOTH token authorization and recipient proof succeed. Concealed 404 results use authenticated endpoint refresh and bounded retries through the effective deadline, never a bearer-only fallback.</t>
        <t>The <tt>hail-retrieval-v1</tt> profile of HTTP Message Signatures <xref target="RFC9421" /> requires one <tt>hail</tt> member in each of Signature-Input and Signature. It covers <tt>@method</tt>, <tt>@target-uri</tt>, and <tt>authorization</tt>, in that order. The six parameters are <tt>created</tt>, <tt>expires</tt>, <tt>nonce</tt>, <tt>keyid</tt>, <tt>alg</tt> equal to <tt>ed25519</tt>, and <tt>tag</tt> equal to <tt>hail-retrieval-v1</tt>. Expiry is exactly creation plus 60 seconds with 30 seconds of clock tolerance. Each request uses a fresh random 32-byte nonce in canonical unpadded base64url. The exact header grammar, signature base and canonical serialization are defined in the retrieval-signature profile in <xref target="HAIL-SPEC" />.</t>
        <t>Token lookup fixes the authorized recipient before key resolution. Verify the current recipient <tt>#hail-messaging</tt> key; untrusted signature fields cannot select an arbitrary signer. After verification, atomically consume the recipient-DID/nonce pair provider-wide through signature expiry plus clock tolerance. Replay state survives restart. Target binding includes the full external HTTPS origin and path; queries and redirects are prohibited. Sign every retry and each attachment separately. Provider-local nonce state is not account history; same-origin storage replacement must preserve unexpired state or refuse retrieval for at least 120 seconds before using an empty store.</t>
        <t>Hashing token lookup records does not remove secrets from retained signed envelopes, outboxes, backups, or transfer history. Those copies need access controls and log redaction. A signature authenticates token bytes but does not encrypt them.</t>
      </section>
      <section anchor="body-validation">
        <name>Content Verification and Compression</name>
        <t>A successful retrieval returns 200 with <tt>application/hail-body+cbor</tt> and private, no-store caching policy. Receivers MUST support identity and gzip coding; gzip emission is optional. No other coding is defined. Gzip-coded input is limited to 2097152 octets. Decompression MUST enforce an output cap equal to the already-validated signed size, not merely check size after unbounded expansion. Streaming and bounded buffered implementations are both permitted.</t>
        <t>After decompression, the recipient verifies exact signed length, SHA-256 digest, HTTP media type, profile, deterministic CBOR equality, and complete schema/resource validity before delivery. Content-Digest, when supplied, covers coded HTTP content and does not replace the signed uncompressed digest. Aggregate decompressor output, including concatenated gzip members, remains subject to the same cap.</t>
        <t>A verified cache may avoid retrieval only for matching provenance (recipient DID, sender DID, body digest, media type, profile). Global storage deduplication MUST NOT change another recipient delivery path based on blob presence. Without matching provenance, a recipient-specific retrieval is required even if the underlying bytes already exist. This prevents probing cross-tenant content possession with deliberately unusable authorizations.</t>
        <t>Retrieval is a provider delivery operation, not an open or read signal. Clients render verified local content rather than contact the sender when the user opens a message.</t>
      </section>
    </section>
    <section anchor="status">
      <name>Delivery State and Status Reporting</name>
      <t>The delivery states are <tt>accepted</tt>, <tt>on-hold</tt>, <tt>delivered</tt>, <tt>failed</tt>, and <tt>cancelled</tt>. The <tt>accepted</tt> state fixes core Grant authorization and queues content processing; <tt>on-hold</tt> records a retryable impediment. The <tt>delivered</tt> state means verified body and recipient-specific record are durable. The <tt>delivered</tt>, <tt>failed</tt>, and <tt>cancelled</tt> states are terminal and cannot transition to another result. A terminal transaction prevents a concurrent retry from publishing a message after failure or cancellation. Later Grant revocation affects future acceptance, not already accepted Grant delivery.</t>
      <t>Retryable reasons are <tt>sender-unreachable</tt>, <tt>body-temporarily-unavailable</tt>, <tt>body-transfer-interrupted</tt>, <tt>sender-rate-limited</tt>, and <tt>receiver-resource-constrained</tt>. Permanent failure reasons are <tt>body-authorization-failed</tt>, <tt>body-integrity-failed</tt>, <tt>body-invalid</tt>, <tt>body-unsupported</tt>, <tt>delivery-expired</tt>, and <tt>receiver-policy-rejected</tt>. Cancellation reasons are <tt>recipient-cancelled</tt> and <tt>receiver-administrative-cancellation</tt>. The recipient owns bounded retrieval retries and scheduling within the signed deadline.</t>
      <t>Delivery Status version 1 is a complete signed snapshot with the original message ID, envelope payload digest, original sender and recipient, revision increasing by exactly one per created snapshot, <tt>state</tt>, and <tt>occurred_at</tt>. The <tt>accepted</tt> state is revision 1; later states begin at revision 2. <tt>on-hold</tt> includes <tt>reason</tt> and <tt>retry_at</tt>; failure and cancellation include the appropriate reason; other states omit them. The status object's <tt>from</tt> field equals the original envelope's <tt>to</tt> field, and its <tt>to</tt> field equals the original envelope's <tt>from</tt> field. The original recipient messaging key signs it. <tt>retry_at</tt> is no earlier than <tt>occurred_at</tt> and no later than the effective delivery deadline. Other cross-field rules are fixed by the Delivery State specification.</t>
      <t>The original recipient's provider sends the status to the original sender's current service using <tt>PUT deliveries/{envelope_digest}</tt>. The original sender's provider verifies the original recipient signer and retained envelope correlation before disclosure or state mutation. HTTP 204 acknowledges a valid new revision, exact duplicate, or valid stale lower revision. Same-revision conflicts, impossible transitions, and higher revisions after terminal state are rejected. Unauthenticated or uncorrelated protected outcomes use the generic 202 and do not acknowledge delivery status. No federation status-query endpoint is defined.</t>
      <t>Terminal status is attempted immediately. Nominal retry delays are 30 seconds, 2 minutes, 10 minutes, 1 hour, 6 hours, and then 24 hours. Let <tt>D</tt> be the nominal retry delay in seconds. Each actual delay is sampled independently and uniformly from the integers <tt>ceil(0.8D)</tt> through <tt>floor(1.2D)</tt>, inclusive, and is measured in seconds. For 429/503, the next delay is the later of local jitter and valid Retry-After, with remote guidance capped at 24 hours. The counter and absolute next-attempt time survive restart, generic receipts, and endpoint migration.</t>
      <t>Absent acknowledgment or a specified permanent error, retries continue through at least max(envelope replay deadline, terminal <tt>occurred_at</tt> plus 2592000 seconds). The sender retains correlation records through at least the replay deadline plus 2592000 seconds. Key rotation can replace the status COSE wrapper around unchanged deterministic payload bytes without changing its revision. A delivery receipt does not attest client synchronization, display, opening, or reading.</t>
    </section>
    <section anchor="extensions">
      <name>Implemented Extensions and Deferred Features</name>
      <ul>
        <li>
          <t>Connections use deliberate invitation review, identity-signed confirmation, coordinator admission, and disconnect controls. Envelope version 2 carries unthreaded connection delivery. This is not an unsolicited inbox-request channel.</t>
        </li>
        <li>
          <t>Envelope version 3 carries a signed parent for threaded direct replies, with either reply-capability or connection authorization. Reply creation in the specification snapshot <xref target="HAIL-SPEC" /> uses Envelope version 3; historical unthreaded reply forms are not a mandatory compatibility baseline.</t>
        </li>
        <li>
          <t>Fixed-roster shared conversations use descriptors, per-recipient Envelope version 4, Reply all, leave, and individual participation expiry. The reference provider uses a 90-day timeout renewed only by that participant replying, not by reading. Leaving or expiry preserves saved history; expired participation requires a new conversation. Envelope version 4 does not replace Grant-authorized Envelope version 1. Connection and conversation permission is rechecked before retrieval and final delivery, unlike authorization fixed at core Grant acceptance.</t>
        </li>
        <li>
          <t>Detached attachments support PNG, JPEG, WebP, PDF, TXT, and LOG files in all three body profiles. The authenticated body binds each file's name, media type, size, and digest. The envelope body-access token and a separate target-bound recipient signature authorize retrieval of each declared file. Recipients MUST verify and durably retain every declared file before committing <tt>delivered</tt>. The complete format and lifecycle rules are defined in <xref target="HAIL-ATTACHMENTS" />.</t>
        </li>
        <li>
          <t>Provider transfer uses authenticated handover, fencing, and portable snapshot version 11, managed snapshot version 12, connection checkpoint version 3, and conversation checkpoint version 1. The user-signed transfer grant names the destination by its service base and its native address domain, which may differ; the source verifies the delegation between them. Copying an export or retaining a signature does not grant live service authority. Snapshots use RFC 9995 with exact retained JSON manifest preimages, an empty unprotected map, and purpose/version-specific <tt>preimage_type</tt> values. Their larger limits and live cutover authority remain separate from envelope admission. Read state, drafts and required uploads, preferences, Trash, category-send groups and Sent dispositions are preserved; local synchronization state resets.</t>
        </li>
      </ul>
      <t>The optional client-to-provider Hail JMAP profile uses <xref target="RFC8620" /> for Session discovery, typed methods, changes, binary transfer and connected events. Domain-controlled capabilities cover messages, drafts, account operations, events and optionally encrypted Web Push. These do not imply RFC 8621 Mail compatibility or a shared OAuth login profile. Provider authentication remains provider-owned, separate from owner/recovery authority. Notifications contain state hints, recover through synchronization, and neither mutate read state nor constitute RACR delivery evidence. The complete profiles are in <xref target="HAIL-SPEC" />.</t>
      <t>Attachment definitions are in <xref target="HAIL-ATTACHMENTS" />; the other extension definitions are in the fixed snapshot <xref target="HAIL-SPEC" />. Their eventual division into companion Internet-Drafts is an editorial decision, not removal of implemented functionality. Local account application programming interfaces (APIs), command-line interface (CLI) commands, passkey flows, database tables, and deployment topology are not federation requirements.</t>
      <t>End-to-end encryption, outbound email and bridge-to-bridge email profiles, attachment formats beyond PNG/JPEG/WebP/PDF/TXT/LOG, additional publisher layouts, optional-profile capability discovery, bulk federation submission, and federated read/open receipts remain deferred. A provider-local implementation of an undeclared feature is not a negotiated interoperable extension.</t>
    </section>
    <section anchor="security">
      <name>Security Considerations</name>
      <t>The protocol relies on HTTPS authentication, Ed25519 signatures, SHA-256 integrity, secure random tokens, protected signing keys, and correct DID resolution. A recipient provider can inspect delivered content and metadata; a sender provider can inspect outgoing content and tokens. Neither provider authentication nor local disk/key encryption provides end-to-end confidentiality.</t>
      <t>Identity and messaging keys have distinct authority. Compromise of a messaging key can impersonate its sender within available permissions. Compromise or provider custody of an identity key has broader consequences for Grants and bindings. PLC recovery and rollback can affect which keys are authoritative; this draft deliberately does not treat retained signature validity as a complete historical-authority proof.</t>
      <t>Implementations MUST verify algorithm, key role, controller, protected content type, payload type, schema, and canonical bytes in addition to the signature. Closed maps and exact digest domains reduce ambiguity and cross-protocol confusion. Unknown versions require explicit rejection or their separately defined extension handling; they are not best-effort parsing opportunities.</t>
      <t>Acceptance, revocation, replay reservation, reply consumption, cancellation, and terminal publication require atomic ordering. A valid signature does not resolve races. Incorrect transaction boundaries can create duplicate messages, bypass revocation, consume a capability more than once, or publish after a terminal failure.</t>
      <t>Resource attacks include large declared CBOR lengths, deeply nested structures, expensive signatures, DID-resolution amplification, stalled transfers, gzip expansion, and image decoder attacks. Apply structural limits before expensive work; bound concurrent work and scratch allocation separately. Grants authorize delivery categories, not unlimited resource consumption.</t>
      <t>A relayed-origin statement (<xref target="body-origin" />) is signed by the sender, not by the original author, and an authorized sender can state a false origin. Presenting it as the sender, or using it for authorization or reply addressing, would let a sender impersonate arbitrary email authors.</t>
      <t>Retrieval tokens remain sensitive even though possession alone no longer authorizes content access. The current recipient messaging-key proof is also mandatory; compromise of both proofs defeats that protection. Store lookup digests and redact secrets from logs, but also protect signed representations and backups that necessarily retain raw tokens. Network redirects, ambient cookies, arbitrary URLs, and unsafe DNS resolution can exfiltrate tokens or reach private services; endpoint derivation does not remove the need for safe-fetch validation.</t>
      <t>Retention and migration must preserve immutable bodies through their commitments, replay state through its deadline, and status evidence through retry/correlation windows. Storage deduplication cannot erase recipient-specific ownership and authorization. Operator recovery procedures require review beyond these wire requirements.</t>
    </section>
    <section anchor="privacy">
      <name>Privacy Considerations</name>
      <t>Public aliases, DID service entries, key history, and Sender Profiles allow identity correlation. A stable DID improves continuity but also links interactions across provider changes. DNS, directory operators, and providers can observe discovery and traffic metadata. HTTPS does not conceal those relationships from the services involved.</t>
      <t>Generic receipts and concealed body errors reduce relationship and content-existence probing, but timing, response size, resolution latency, cache state, rate limits, and connection behavior can still disclose information. Implementations need measured tests of all rejection paths, not merely identical JSON. Public 421 routing decisions must remain independent of protected account and relationship state.</t>
      <t>Signed delivery status exposes provider processing and availability, not user reading. Bodies and bundled images are fetched during delivery and rendered locally. User-initiated navigation to an HTTPS link can still disclose information to the destination; this is distinct from automatic content loading. Additional analytics or read-receipt extensions require separate privacy review.</t>
      <t>Recipient-specific cache provenance is required even when physical bytes are deduplicated. Retained consent context and history improve auditability but contain relationships and content metadata; retention policies should minimize unnecessary copies without violating protocol continuity requirements.</t>
    </section>
    <section anchor="iana">
      <name>IANA Considerations</name>
      <t>This revision makes no registration request. The <tt>application/hail-*+cbor</tt> strings used in the alpha are provisional and are not claimed to be registered media types. They are nevertheless exact cryptographic domain-separation values in this profile. Implementations MUST NOT independently rename them. Final allocation will require coordinated wire and signature updates if the names change.</t>
      <t>Prepared media-type templates and actual registration status are maintained in the working specification encoding inventory. No submission is asserted here. The unprefixed names require a standards-tree publication/approval path under <xref target="RFC6838" /> and the structured-suffix rules of <xref target="RFC6839" />. Candidate core types are <tt>application/hail-address-binding+cbor</tt>, <tt>application/hail-sender-profile+cbor</tt>, <tt>application/hail-grant+cbor</tt>, <tt>application/hail-envelope+cbor</tt>, <tt>application/hail-delivery-status+cbor</tt>, and <tt>application/hail-body+cbor</tt>. The extension types need coordinated registration in their companion documents.</t>
      <t>The existing <tt>application/cose</tt> media type, <tt>COSE_Sign1</tt> tag, COSE Ed25519 algorithm, SHA-256 identifier and RFC 9995 header parameters are reused without a new allocation. The address-binding relation is an extension relation URI, not a claim to a registered short relation token. The preimage header and Hail JMAP capabilities use domain-controlled URI namespaces; no numeric COSE label or IETF JMAP capability allocation is requested. DID fragments and the service type, the DNS TXT delegation convention, signature tags, object/profile identifiers, versions and reason values remain application-specific sets governed by their defining specifications. Unknown-value behavior remains profile-specific. No new IANA registry is proposed; future open extension points require an explicit allocation and negotiation policy.</t>
    </section>
    <section anchor="implementation">
      <name>Implementation and Evaluation Status</name>
      <t>The project at the specification snapshot cited in <xref target="HAIL-SPEC" /> includes a TypeScript reference provider, clients including a Rust CLI, and TypeScript and Go codec/vector implementations. Shared vectors exercise encodings, signatures, resource boundaries, and malformed inputs. Provider tests exercise delivery and persistence behavior. These are implementation evidence, not a complete security audit or independent-provider interoperability certification.</t>
      <t>No particular implementation language or independently operated second provider is a prerequisite for circulating this draft. Review can begin with published schemas, vectors, and implementation behavior. Independent implementations and deployments would provide additional evidence. A full independent-provider trial is not claimed here.</t>
      <t>Useful evaluation includes exact encoded body boundaries, multilingual and structured publisher content, bounded decompression, privacy timing tests, competing revocation/acceptance operations, replay after restart, endpoint migration, and storage failure after authorization. A client can preflight an encoded draft against size and structural limits; doing so cannot promise acceptance under dynamic authorization or quota policy.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="RFC9995" target="https://www.rfc-editor.org/info/rfc9995">
        <front><title>CBOR Object Signing and Encryption (COSE) Hash Envelope</title><author fullname="O. Steele" surname="Steele"/><date month="July" year="2026"/></front>
        <seriesInfo name="RFC" value="9995"/><seriesInfo name="DOI" value="10.17487/RFC9995"/>
      </reference>
      <reference anchor="RFC9421" target="https://www.rfc-editor.org/info/rfc9421">
        <front><title>HTTP Message Signatures</title><author fullname="A. Backman" surname="Backman"/><date month="February" year="2024"/></front>
        <seriesInfo name="RFC" value="9421"/><seriesInfo name="DOI" value="10.17487/RFC9421"/>
      </reference>
      <reference anchor="RFC8620" target="https://www.rfc-editor.org/info/rfc8620">
        <front><title>The JSON Meta Application Protocol (JMAP)</title><author fullname="N. Jenkins" surname="Jenkins"/><date month="July" year="2019"/></front>
        <seriesInfo name="RFC" value="8620"/><seriesInfo name="DOI" value="10.17487/RFC8620"/>
      </reference>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner" />
          <date month="March" year="1997" />
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14" />
        <seriesInfo name="RFC" value="2119" />
        <seriesInfo name="DOI" value="10.17487/RFC2119" />
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba" />
          <date month="May" year="2017" />
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14" />
        <seriesInfo name="RFC" value="8174" />
        <seriesInfo name="DOI" value="10.17487/RFC8174" />
      </reference>
      <reference anchor="RFC8949" target="https://www.rfc-editor.org/info/rfc8949">
        <front>
          <title>Concise Binary Object Representation (CBOR)</title>
          <author fullname="C. Bormann" initials="C." surname="Bormann" />
          <author fullname="P. Hoffman" initials="P." surname="Hoffman" />
          <date month="December" year="2020" />
          <abstract>
            <t>The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation. These design goals make it different from earlier binary serializations such as ASN.1 and MessagePack.</t>
            <t>This document obsoletes RFC 7049, providing editorial improvements, new details, and errata fixes while keeping full compatibility with the interchange format of RFC 7049. It does not create a new version of the format.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="94" />
        <seriesInfo name="RFC" value="8949" />
        <seriesInfo name="DOI" value="10.17487/RFC8949" />
      </reference>
      <reference anchor="RFC9052" target="https://www.rfc-editor.org/info/rfc9052">
        <front>
          <title>CBOR Object Signing and Encryption (COSE): Structures and Process</title>
          <author fullname="J. Schaad" initials="J." surname="Schaad" />
          <date month="August" year="2022" />
          <abstract>
            <t>Concise Binary Object Representation (CBOR) is a data format designed for small code size and small message size. There is a need to be able to define basic security services for this data format. This document defines the CBOR Object Signing and Encryption (COSE) protocol. This specification describes how to create and process signatures, message authentication codes, and encryption using CBOR for serialization. This specification additionally describes how to represent cryptographic keys using CBOR.</t>
            <t>This document, along with RFC 9053, obsoletes RFC 8152.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="96" />
        <seriesInfo name="RFC" value="9052" />
        <seriesInfo name="DOI" value="10.17487/RFC9052" />
      </reference>
      <reference anchor="RFC9864" target="https://www.rfc-editor.org/info/rfc9864">
        <front>
          <title>Fully-Specified Algorithms for JSON Object Signing and Encryption (JOSE) and CBOR Object Signing and Encryption (COSE)</title>
          <author fullname="M.B. Jones" initials="M.B." surname="Jones" />
          <author fullname="O. Steele" initials="O." surname="Steele" />
          <date month="October" year="2025" />
          <abstract>
            <t>This specification refers to cryptographic algorithm identifiers that fully specify the cryptographic operations to be performed, including any curve, key derivation function (KDF), and hash functions, as being "fully specified". It refers to cryptographic algorithm identifiers that require additional information beyond the algorithm identifier to determine the cryptographic operations to be performed as being "polymorphic". This specification creates fully-specified algorithm identifiers for registered JSON Object Signing and Encryption (JOSE) and CBOR Object Signing and Encryption (COSE) polymorphic algorithm identifiers, enabling applications to use only fully-specified algorithm identifiers. It deprecates those polymorphic algorithm identifiers.</t>
            <t>This specification updates RFCs 7518, 8037, and 9053. It deprecates polymorphic algorithms defined by RFCs 8037 and 9053 and provides fully-specified replacements for them. It adds to the instructions to designated experts in RFCs 7518 and 9053.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9864" />
        <seriesInfo name="DOI" value="10.17487/RFC9864" />
      </reference>
      <reference anchor="RFC4648" target="https://www.rfc-editor.org/info/rfc4648">
        <front>
          <title>The Base16, Base32, and Base64 Data Encodings</title>
          <author fullname="S. Josefsson" initials="S." surname="Josefsson" />
          <date month="October" year="2006" />
          <abstract>
            <t>This document describes the commonly used base 64, base 32, and base 16 encoding schemes. It also discusses the use of line-feeds in encoded data, use of padding in encoded data, use of non-alphabet characters in encoded data, use of different encoding alphabets, and canonical encodings. [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="4648" />
        <seriesInfo name="DOI" value="10.17487/RFC4648" />
      </reference>
      <reference anchor="RFC9530" target="https://www.rfc-editor.org/info/rfc9530">
        <front>
          <title>Digest Fields</title>
          <author fullname="R. Polli" initials="R." surname="Polli" />
          <author fullname="L. Pardue" initials="L." surname="Pardue" />
          <date month="February" year="2024" />
          <abstract>
            <t>This document defines HTTP fields that support integrity digests. The Content-Digest field can be used for the integrity of HTTP message content. The Repr-Digest field can be used for the integrity of HTTP representations. Want-Content-Digest and Want-Repr-Digest can be used to indicate a sender's interest and preferences for receiving the respective Integrity fields.</t>
            <t>This document obsoletes RFC 3230 and the Digest and Want-Digest HTTP fields.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9530" />
        <seriesInfo name="DOI" value="10.17487/RFC9530" />
      </reference>
      <reference anchor="RFC9562" target="https://www.rfc-editor.org/info/rfc9562">
        <front>
          <title>Universally Unique IDentifiers (UUIDs)</title>
          <author fullname="K. Davis" initials="K." surname="Davis" />
          <author fullname="B. Peabody" initials="B." surname="Peabody" />
          <author fullname="P. Leach" initials="P." surname="Leach" />
          <date month="May" year="2024" />
          <abstract>
            <t>This specification defines UUIDs (Universally Unique IDentifiers) --
also known as GUIDs (Globally Unique IDentifiers) -- and a Uniform
Resource Name namespace for UUIDs. A UUID is 128 bits long and is
intended to guarantee uniqueness across space and time. UUIDs were
originally used in the Apollo Network Computing System (NCS), later
in the Open Software Foundation's (OSF's) Distributed Computing
Environment (DCE), and then in Microsoft Windows platforms.</t>
            <t>This specification is derived from the OSF DCE specification with the
kind permission of the OSF (now known as "The Open Group"). Information from earlier versions of the OSF DCE specification have
been incorporated into this document. This document obsoletes RFC
4122.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9562" />
        <seriesInfo name="DOI" value="10.17487/RFC9562" />
      </reference>
      <reference anchor="RFC9110" target="https://www.rfc-editor.org/info/rfc9110">
        <front>
          <title>HTTP Semantics</title>
          <author fullname="R. Fielding" initials="R." role="editor" surname="Fielding" />
          <author fullname="M. Nottingham" initials="M." role="editor" surname="Nottingham" />
          <author fullname="J. Reschke" initials="J." role="editor" surname="Reschke" />
          <date month="June" year="2022" />
          <abstract>
            <t>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document describes the overall architecture of HTTP, establishes common terminology, and defines aspects of the protocol that are shared by all versions. In this definition are core protocol elements, extensibility mechanisms, and the "http" and "https" Uniform Resource Identifier (URI) schemes.</t>
            <t>This document updates RFC 3864 and obsoletes RFCs 2818, 7231, 7232, 7233, 7235, 7538, 7615, 7694, and portions of 7230.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="97" />
        <seriesInfo name="RFC" value="9110" />
        <seriesInfo name="DOI" value="10.17487/RFC9110" />
      </reference>
      <reference anchor="RFC9457" target="https://www.rfc-editor.org/info/rfc9457">
        <front>
          <title>Problem Details for HTTP APIs</title>
          <author fullname="M. Nottingham" initials="M." surname="Nottingham" />
          <author fullname="E. Wilde" initials="E." surname="Wilde" />
          <author fullname="S. Dalal" initials="S." surname="Dalal" />
          <date month="July" year="2023" />
          <abstract>
            <t>This document defines a "problem detail" to carry machine-readable details of errors in HTTP response content to avoid the need to define new error response formats for HTTP APIs.</t>
            <t>This document obsoletes RFC 7807.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9457" />
        <seriesInfo name="DOI" value="10.17487/RFC9457" />
      </reference>
      <reference anchor="RFC6750" target="https://www.rfc-editor.org/info/rfc6750">
        <front>
          <title>The OAuth 2.0 Authorization Framework: Bearer Token Usage</title>
          <author fullname="M. Jones" initials="M." surname="Jones" />
          <author fullname="D. Hardt" initials="D." surname="Hardt" />
          <date month="October" year="2012" />
          <abstract>
            <t>This specification describes how to use bearer tokens in HTTP requests to access OAuth 2.0 protected resources. Any party in possession of a bearer token (a "bearer") can use it to get access to the associated resources (without demonstrating possession of a cryptographic key). To prevent misuse, bearer tokens need to be protected from disclosure in storage and in transport. [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="6750" />
        <seriesInfo name="DOI" value="10.17487/RFC6750" />
      </reference>
      <reference anchor="RFC7033" target="https://www.rfc-editor.org/info/rfc7033">
        <front>
          <title>WebFinger</title>
          <author fullname="P. Jones" initials="P." surname="Jones" />
          <author fullname="G. Salgueiro" initials="G." surname="Salgueiro" />
          <author fullname="M. Jones" initials="M." surname="Jones" />
          <author fullname="J. Smarr" initials="J." surname="Smarr" />
          <date month="September" year="2013" />
          <abstract>
            <t>This specification defines the WebFinger protocol, which can be used to discover information about people or other entities on the Internet using standard HTTP methods. WebFinger discovers information for a URI that might not be usable as a locator otherwise, such as account or email URIs.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="7033" />
        <seriesInfo name="DOI" value="10.17487/RFC7033" />
      </reference>
      <reference anchor="RFC7565" target="https://www.rfc-editor.org/info/rfc7565">
        <front>
          <title>The 'acct' URI Scheme</title>
          <author fullname="P. Saint-Andre" initials="P." surname="Saint-Andre" />
          <date month="May" year="2015" />
          <abstract>
            <t>This document defines the 'acct' Uniform Resource Identifier (URI) scheme as a way to identify a user's account at a service provider, irrespective of the particular protocols that can be used to interact with the account.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="7565" />
        <seriesInfo name="DOI" value="10.17487/RFC7565" />
      </reference>
      <reference anchor="RFC8288" target="https://www.rfc-editor.org/info/rfc8288">
        <front>
          <title>Web Linking</title>
          <author fullname="M. Nottingham" initials="M." surname="Nottingham" />
          <date month="October" year="2017" />
          <abstract>
            <t>This specification defines a model for the relationships between resources on the Web ("links") and the type of those relationships ("link relation types").</t>
            <t>It also defines the serialisation of such links in HTTP headers with the Link header field.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8288" />
        <seriesInfo name="DOI" value="10.17487/RFC8288" />
      </reference>
      <reference anchor="RFC6838" target="https://www.rfc-editor.org/info/rfc6838">
        <front>
          <title>Media Type Specifications and Registration Procedures</title>
          <author fullname="N. Freed" initials="N." surname="Freed" />
          <author fullname="J. Klensin" initials="J." surname="Klensin" />
          <author fullname="T. Hansen" initials="T." surname="Hansen" />
          <date month="January" year="2013" />
          <abstract>
            <t>This document defines procedures for the specification and registration of media types for use in HTTP, MIME, and other Internet protocols. This memo documents an Internet Best Current Practice.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="13" />
        <seriesInfo name="RFC" value="6838" />
        <seriesInfo name="DOI" value="10.17487/RFC6838" />
      </reference>
      <reference anchor="RFC6839" target="https://www.rfc-editor.org/info/rfc6839">
        <front>
          <title>Additional Media Type Structured Syntax Suffixes</title>
          <author fullname="T. Hansen" initials="T." surname="Hansen" />
          <author fullname="A. Melnikov" initials="A." surname="Melnikov" />
          <date month="January" year="2013" />
          <abstract>
            <t>A content media type name sometimes includes partitioned meta- information distinguished by a structured syntax to permit noting an attribute of the media as a suffix to the name. This document defines several structured syntax suffixes for use with media type registrations. In particular, it defines and registers the "+json", "+ber", "+der", "+fastinfoset", "+wbxml" and "+zip" structured syntax suffixes, and provides a media type structured syntax suffix registration form for the "+xml" structured syntax suffix. This document is not an Internet Standards Track specification; it is published for informational purposes.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="6839" />
        <seriesInfo name="DOI" value="10.17487/RFC6839" />
      </reference>
      <reference anchor="HAIL-ATTACHMENTS" target="https://github.com/j4crev/hail/blob/7b21f960dee7c236972a6bda667e4e3f52762007/spec/attachments.md">
        <front>
          <title>Message attachments, commit 7b21f960dee7c236972a6bda667e4e3f52762007</title>
          <author fullname="Hail contributors" />
          <date year="2026" month="November" />
        </front>
      </reference>
      <reference anchor="HAIL-SPEC" target="https://github.com/j4crev/hail/tree/7b21f960dee7c236972a6bda667e4e3f52762007/spec">
        <front>
          <title>Hail alpha specification, commit 7b21f960dee7c236972a6bda667e4e3f52762007</title>
          <author fullname="Hail contributors" />
          <date year="2026" month="November" />
        </front>
      </reference>
      <reference anchor="RFC8610" target="https://www.rfc-editor.org/info/rfc8610">
        <front>
          <title>Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures</title>
          <author fullname="H. Birkholz" initials="H." surname="Birkholz" />
          <author fullname="C. Vigano" initials="C." surname="Vigano" />
          <author fullname="C. Bormann" initials="C." surname="Bormann" />
          <date month="June" year="2019" />
          <abstract>
            <t>This document proposes a notational convention to express Concise Binary Object Representation (CBOR) data structures (RFC 7049). Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8610" />
        <seriesInfo name="DOI" value="10.17487/RFC8610" />
      </reference>
    </references>
    <section anchor="open-issues" removeInRFC="true">
      <name>Open Protocol Questions</name>
      <t>These questions remain unresolved; they are not permission for implementers to choose incompatible behavior. The current snapshot remains the implementation target while these questions are reviewed.</t>
      <ul>
        <li>
          <t>Historical authority: define acceptable evidence and reconciliation after PLC recovery or nullified branches, including unacknowledged Grant identity-key rotation. Retention of signed bytes alone does not settle authority at acceptance time.</t>
        </li>
        <li>
          <t>Resolver interoperability: the strict-public reference policy already defines reader selection, audit validation, refusal conditions, evidence retention, and fresh reads without stale-cache substitution. Determine which resolution guarantees all interoperable deployments must provide and how providers reconcile differing views of authoritative PLC state, including the effects of caching and recovery windows.</t>
        </li>
      </ul>
    </section>
    <section anchor="source-map">
      <name>Source Map and Review Boundary</name>
      <t>The normative source snapshot is 7b21f960dee7c236972a6bda667e4e3f52762007 for both HAIL references. This document is maintained separately from the implementation specification. Its chapter mapping is: identity/discovery to did-profile.md, address-binding.md, sender-profile.md and plc-read-evidence.md; encoding to encoding.md and hail.cddl; Grants to grants.md; core delivery to core-delivery.md and envelopes.md; HTTP operations to http-binding.md; content to bodies.md, retrieval-signatures.md, assets.md, and the separately referenced attachments.md; state to delivery-state.md; transfer to transfer-formats.md and account-history.md; optional account access to provider-authentication.md and the jmap*.md profiles.</t>
      <t>This working revision advances the pinned snapshot to include the protocol namespace correction, the expanded <tt>spt-3</tt> image limits with JPEG assets, the signed relayed-origin body member, and transfer destinations whose service and address domains differ. Envelope preimage labels use the protocol domain, and Hail JMAP capability URIs use the prefix <tt>https://racrproto.com/ns/jmap/</tt>. Only the current envelope label is accepted; JMAP clients and providers upgrade together. The feature inventory includes the separately referenced attachment specification. Connections, shared conversations, detached attachments, and portability are implemented extensions. Additional attachment formats, advanced layouts, end-to-end encryption, and federated read/open receipts remain deferred.</t>
      <t>The open protocol questions do not reopen established requirements. In particular, current body size, mandatory SPT support, token-plus-signature body retrieval, Address Binding non-expiration, and permission ordering are already specified; they are not re-opened by this draft.</t>
    </section>
    <section anchor="body-cddl">
      <name>Body Structural Schema Excerpt</name>
      <t>The following Concise Data Definition Language (CDDL) excerpt (<xref target="RFC8610" />) uses the pinned <tt>hail.cddl</tt> body, asset, and attachment definitions, with attachment semantics from <xref target="HAIL-ATTACHMENTS" /> and the digest and timestamp dependencies included. It defines structure only: the prose and source specification impose additional mark-reference, role, image-format, origin-syntax, text, attachment-content, aggregate-size, and cross-field validation. In particular, <tt>spt-3</tt> permits 1 to 24 image or header assets, all referenced, and at most 24 image blocks with eight million total displayed pixels; only the first block may reference a header asset, and an avatar asset is PNG only. Unknown fields are not permitted.</t>
      <sourcecode type="cddl">hail-uint = 0..9007199254740991
timestamp = hail-uint
sha256 = bstr .size 32

digest = {
  "algorithm": "sha-256",
  "value": sha256
}

; Detached file sizes total at most 26,214,400 bytes per body.
hail-attachment = {
  "filename": tstr,
  "media_type": "application/pdf" / "text/plain" / "image/png" /
                "image/jpeg" / "image/webp",
  "size": 1..26214400,
  "digest": digest
}

; spt-1 remains the initial plain-text Portable Text-shaped profile.
hail-body-spt-1 = {
  "version": 1,
  "profile": "spt-1",
  "blocks": [* spt-1-text-block],
  ? "attachments": [1*20 hail-attachment]
}

spt-1-text-block = {
  "_type": "block",
  "style": "normal",
  "children": [1* spt-1-span],
  "markDefs": []
}

spt-1-span = {
  "_type": "span",
  "text": tstr,
  "marks": []
}

; spt-2 adds a closed set of styles, lists, decorators
; and HTTPS links.
hail-body-spt-2 = {
  "version": 1,
  "profile": "spt-2",
  "blocks": [* spt-2-text-block],
  ? "attachments": [1*20 hail-attachment],
  ? "origin": body-origin
}

spt-2-text-block = {
  "_type": "block",
  "style": "normal" / "h1" / "h2" / "h3" /
           "blockquote" / "caption" / "cta",
  "children": [1* spt-2-span],
  "markDefs": [* spt-link],
  ? "listItem": "bullet" / "number",
  ? "level": 1..3,
  ? "alignment": "left" / "center" / "right"
}

spt-2-span = {
  "_type": "span",
  "text": tstr,
  "marks": [* tstr]
}

spt-link = {
  "_key": tstr,
  "_type": "spt.link",
  "href": tstr,
  ? "title": tstr
}

; spt-3 interleaves bounded, digest-bound PNG or JPEG images
; and rich text. Role-specific formats and sizes (avatar: PNG,
; 32768 bytes) are semantic checks.
hail-body-spt-3 = {
  "version": 1,
  "profile": "spt-3",
  "assets": asset-manifest-v1,
  "blocks": [1* (spt-image-block / spt-2-text-block)],
  ? "attachments": [1*20 hail-attachment],
  ? "origin": body-origin
}

spt-image-block = {
  "_type": "spt.image",
  "asset": tstr,
  "alt": tstr,
  ? "caption": tstr
}

; The sender's statement that it relayed the content from an
; external source. Address, name and list-identifier syntax
; are semantic checks.
body-origin = body-origin-email

body-origin-email = {
  "type": "email",
  "from_address": tstr,
  ? "from_name": tstr,
  ? "list_id": tstr,
  "authentication": "dkim-aligned" / "none",
  "received_at": timestamp
}

; Reusable bundled-image manifest for future body
; and profile versions.
asset-manifest-v1 = {
  "version": 1,
  "assets": [1*24 bundled-image-asset-v1]
}

bundled-image-asset-v1 = {
  "id": tstr,
  "role": "avatar" / "header" / "image",
  "media_type": "image/png" / "image/jpeg",
  "loading": "bundled",
  "size": 1..524288,
  "digest": digest,
  "width": 1..2400,
  "height": 1..2400,
  "data": bstr
}
</sourcecode>
    </section>
  </back>
</rfc>
