TCT renewal (RFC-AITP-0013)
Status: opt-in, tracks a Draft RFC. RFC-AITP-0013 is Draft. It is not part of v0.3 core conformance; its fixtures (
ren-*) carry the runner featureexperimental-renewal. Inaitp-rsit lives in theaitp-experimentalcrate, moduleaitp_experimental::renewal:
- The core (request, PoP input, issuer checks, holder checks, envelopes) needs no feature.
RenewalServer, the issuer's HTTP endpoint, needs featurehttp-server.renew_tct, the holder's HTTP client, needs featurehttp-client.- Language bindings: their
experimental-renewalfeature, off by default and absent from the published packages.No stability promise (STABILITY.md).
A holder renews its TCT by presenting it, with a proof of possession of the
subject key, to the issuer that issued it. The issuer mints a TCT for the
same sub, aud and cnf with a new jti. This page describes what
aitp-rs does; see also Known limitations.
Wire format
TCTs cross this exchange as opaque compact JWS strings (RFC-AITP-0001 §5.4.5).
Request
The body of a POST to renew_uri is an unenveloped JSON object with
exactly these members (TctRenewalPayload; parse_renewal_request):
{
"current_tct": "<compact JWS string: the TCT being renewed>",
"pop_nonce": "<22 base64url characters: 16 fresh random bytes>",
"pop_signature": "<sign(holder_key, sha256(renewal_pop_input))>"
}The PoP input (renewal_pop_input, RFC-AITP-0013 §3.1) is
"aitp-renewal-pop-v1" || 0x00 || iss || 0x00 || jti || 0x00 || noncewhere iss and jti are the current TCT's claims exactly as written and
nonce is the 16 decoded bytes of pop_nonce. The holder signs
sha256 of it once, with the key encoded in the TCT's sub, in the
RFC-AITP-0001 §5.4.6 form (p256.-tagged for P-256). The SDKs and
renew_tct draw a fresh nonce per request.
Response
Every answer is an RFC-AITP-0001 envelope signed by the issuer, whose
sender.agent_id is the current TCT's iss:
-
success:
message_typetct, status 200, payload (RenewalResponsePayload, built byrenewal_response_envelope):{ "tct": "<compact JWS string: the renewed TCT>", "grant_voucher": "<compact JWS string, when minted>", "pop_nonce_echo": "<the request's pop_nonce>" } -
refusal:
message_typeerror, status 4xx (503 when retryable), payload{code, reason, retryable}(RFC-AITP-0001 §5.6), built byrenewal_error_envelope.
Endpoint discovery (renew_uri)
The issuer advertises its renewal endpoint as the Manifest extension
rfc-aitp-0005.renew_uri (RENEW_URI_EXT), an
absolute HTTPS URL (http is accepted only for localhost /
127.0.0.1, for development). Because the Manifest is signed, the
extension is set when the Manifest is built:
let manifest = ManifestBuilder::new(&key)
// ...
.extension(RENEW_URI_EXT, "https://issuer.example/aitp/renew".into())
.build()?;- Server.
RenewalServer::router()mounts the renewal route at the path of that URL. A Manifest without a usablerenew_uriisRenewalServerError::NotAdvertised; a path another AITP route uses isRenewalServerError::PathCollision. - Client.
renew_tct(holder, current, &issuer_manifest)reads the extension from the issuer's (verified) Manifest and POSTs there. It uses only anhttpsrenew_uri; for a plain-httploopback one in local development, callrenew_tct_with_insecure_localhost_dangerousinstead (never in production). With no usablerenew_uriit fails withRenewClientError::NotAdvertisedbefore sending anything: per RFC-AITP-0013 §2 the holder MUST NOT probe a guessed path and falls back to a full handshake.
Issuer side (process_renewal_request)
parse_renewal_request(body) parses the request (RFC-AITP-0013 §4 step
1). process_renewal_request(request, issuer_key, &RenewalContext) is
async (the replay guard is a pluggable NonceStore). RenewalContext
carries the issuer's current Manifest expiry, the grants it offers now, a
revocation check, the replay-guard store, an optional grant-policy hook,
the new TTL and whether to mint a voucher. The steps run in this order
(RFC-AITP-0013 §4) and stop at the first failure:
- Parse. The body is an object with exactly the three string
members, no repeated key (
RenewalError::RequestMalformed), andpop_noncedecodes to 16 bytes (RenewalError::NonceMalformed). - Verify
current_tctas its issuer withverify_tct(failures areRenewalError::Tct):typ,alg, signature under the issuer's own key, claims,exp(Expired) and the issuer's current Manifest expiry (ExpiresAfterManifest). Itsaudmust equal itssub(AudienceMismatch). - PoP.
pop_signatureverifies under thesubkey overrenewal_pop_input, rebuilt from the verifiedissandjti(PopFailed). - Revocation. The
jtiis not in the issuer's deny list (Revoked). - Replay guard. The nonce is recorded in the
NonceStore(aitp::core::nonce_store) until the presented TCT'sexp; a nonce already recorded isRenewalError::Replayed. A store failure isRenewalError::NonceStore. - Grants. The current grants intersected with the grants the issuer
offers now, then narrowed by the optional policy hook. A grant the hook
returns outside its input is dropped. None left is
RenewalError::GrantsWithdrawn. - Mint with
TctBuilder: sameiss,sub,audandcnf, the surviving grants, a new randomjti,iat = now,exp = min(now + ttl, Manifest expires_at). - Voucher. A grant voucher is minted by default
(
RenewalContext::without_voucherturns it off), withsrc_jti= the newjti.
RenewalError::error_code gives each failure's registry code as a
RenewalErrorCode: a core ErrorCode, or RENEWAL_UNAVAILABLE when the
issuer's revocation state or its renewal nonce store is unavailable
(RFC-AITP-0013 §4 step 4, §5). RenewalError::is_local_fault is true for
the issuer's own nonce store or signer failing.
Holder side (verify_renewal_response)
verify_renewal_response(&envelope, &RenewalResponseContext) checks the
issuer's answer (RFC-AITP-0013 §6.1) before the renewed TCT is used:
- The envelope timestamp is in the window,
message_typeistctorerror, and the signature verifies undersender.agent_id. sender.agent_idis the current TCT'siss(PEER_MISMATCH). Anerrorenvelope that passes steps 1 and 2 isRenewalResponseError::Refusedwith the issuer's code.pop_nonce_echois the nonce sent (NONCE_MISMATCH).- The renewed TCT verifies with
verify_tctas addressed to the holder, issued by the current TCT'siss, and within the issuer Manifest'sexpires_atwhen the context carries it. - Its
subis the holder and itscnf.jktthe current TCT's (AUDIENCE_MISMATCH). - Its grants are a subset of the current TCT's (
GRANT_OVERFLOW).
message_id deduplication (RFC-AITP-0001 §5.5) is the caller's.
renew_tct runs this check, with the issuer Manifest's
expires_at, and returns the verified RenewedTct.
Server (RenewalServer)
let renewal = RenewalServer::new(
Arc::new(issuer_key), // the Manifest's key
manifest.clone(),
revocation_producer.clone(), // the same producer as the handshake server's
Arc::new(InMemoryNonceStore::default()),
)?;
let app = handshake_server
.into_router() // aitp feature `experimental-axum`
.merge(ManifestServer::new(manifest).into_router())
.merge(renewal.router()?);
axum::serve(listener, app.into_make_service_with_connect_info::<SocketAddr>()).await?;RenewalServer::new refuses a signer whose AID is not the Manifest's
aid (RenewalServerError::KeyMismatch). Each request is rate limited
per transport source, then the content type and body are checked, then
process_renewal_request runs with:
- revocation from the
RevocationListProducer's current list; - grants from the Manifest's
offered_capabilities, plus the optionalwith_grant_policyhook; - the
NonceStorepassed tonewas the replay guard (use a shared store when several replicas serve one issuer); - TTL
aitp::tct::DEFAULT_TCT_TTL, capped by the Manifest window.
Rate limiting:
- On by default with
RateLimitConfig::default();with_rate_limitreplaces it andwithout_rate_limit_dangerousturns it off. Onlyrequests_per_source_per_60sandtrusted_proxiesapply. - Its counters are its own, separate from the handshake server's.
- A rate-limited request gets HTTP 429 with an empty body.
- With the rate limit on, a request without a client address (a router
served without
into_make_service_with_connect_info) gets a retryable error envelope with HTTP 500.
The body limit is DEFAULT_MAX_BODY_BYTES (with_request_body_limit
changes it), read within DEFAULT_BODY_READ_TIMEOUT.
Each refusal is a signed error envelope carrying the failing step's
registry code:
| Failure | Code |
|---|---|
| request not exactly the three string members, repeated key, bad JSON, malformed nonce | POP_RESPONSE_INVALID |
current_tct not a JWS, malformed claims | INVALID_ENVELOPE |
| unknown claim | UNKNOWN_FIELD |
unknown ver | UNKNOWN_VERSION |
another issuer's TCT, aud other than sub, bad signature, self-issued or attestation TCT | TCT_SIGNATURE_INVALID |
alg / typ mismatch | TOKEN_ALG_MISMATCH / TOKEN_TYP_MISMATCH |
| expired TCT | TCT_EXPIRED |
| TCT outlives the issuer's current Manifest | TCT_EXPIRES_AFTER_MANIFEST |
PoP signature does not verify under sub | POP_RESPONSE_INVALID |
revoked TCT (its jti on the deny list) | TCT_REVOKED |
| revocation state unreadable | RENEWAL_UNAVAILABLE, retryable, HTTP 503 |
replayed pop_nonce | REPLAY_DETECTED |
| no grant survives re-evaluation | POLICY_VIOLATION |
| wrong content type | POP_RESPONSE_INVALID |
| body over the limit, unreadable or too slow | INVALID_ENVELOPE |
| replay guard failure or full | RENEWAL_UNAVAILABLE, retryable, HTTP 503 |
| no client address with the rate limit on (local) | retryable error envelope, HTTP 500 |
Known limitations
- Same subject, narrower-or-equal grants only. Renewal cannot widen scope or rebind to a new key; those need a fresh handshake (or delegation).
- Issuer key-rotation boundary. A TCT that outlives the issuer's
current Manifest is refused (
TCT_EXPIRES_AFTER_MANIFEST); the holder re-handshakes. - Default replay guard is per process. It is bounded and in memory; a
multi-replica deployment needs a shared
NonceStore. - Binding replay guard. The Python and Node bindings keep one process-wide in-memory replay guard shared by every agent.
- No metrics.
aitp-experimentalhas nometricsfeature. The renewal route emits tracing (spanhandle_renew) but no counters, and its rate limiter is separate fromHandshakeServer's rate-limit metrics. Only the sharedNonceStoregauge fires, whenaitp/metricsis on.
SDK example (holder ↔ issuer, Python)
import json
# Holder side: build the renewal request bound to a fresh nonce.
# current_tct is the holder's TCT as a compact JWS string.
req_json = holder_agent.build_renewal_request(current_tct_token=current_tct)
# Issuer side: verify PoP + mint a fresh TCT (bounded by the issuer manifest).
# The issuer must have called build_manifest(): grants it no longer offers
# are dropped. A revoked jti or a replayed request raises RuntimeError.
# Returns a JSON string: {"tct": "<jws>", "grant_voucher": "<jws>"}.
result = json.loads(
issuer_agent.process_renewal_request(
req_json, manifest_exp_unix_secs, new_ttl_secs, revoked_jtis=revoked
)
)
fresh_tct = result["tct"]In Node, processRenewalRequest(...) returns the same fields as an object,
{ tct, grantVoucher }.
bindings/aitp-py/tests/test_renewal.py covers the holder → issuer
round-trip and rejection of a wrong holder key, a replayed request, a
revoked TCT and withdrawn grants; bindings/aitp-node/tests/test_renewal.mjs
covers the same in Node.