HWT project

Hash Web Token (HWT)

canonical documentation issues discussions

A stateless, network-native token protocol for cross-domain delegation.

Tokens are signed by an issuing origin, verifiable by any party that can reach the issuer's domain, and carry authorization context either literally or by reference.

Status: Draft v0.7.


What HWT does

What HWT does not address


Token format

hwt.signature.key-id.expires-unix-seconds.format.payload

Six dot-separated fields. The dot is the field separator and MUST NOT appear in key-id, format, or top-level name.

format declares the codec. j (JSON) is the only required codec. Additional community codecs are documented in CONVENTIONS.md.

Expiry is structural — a token past its expires value is unconditionally invalid regardless of signature validity.


Delegation chain example

Three hops: a user at an identity provider → an orchestration agent → a worker service → the final API target.

Root token (held by the user, issued by auth.example.com):

{
  "iss": "https://auth.example.com",
  "sub": "user:4503599627370495",
  "tid": "root-a1b2",
  "authz": { "scheme": "RBAC/1.0.2", "roles": ["editor"] }
}

Intermediate token (issued by agent.example.com for the worker):

{
  "iss": "https://agent.example.com",
  "sub": "svc:orchestrator",
  "aud": "https://worker.example.com",
  "tid": "mid-c3d4",
  "authz": { "scheme": "RBAC/1.0.2", "roles": ["editor"] },
  "del": [
    { "iss": "https://auth.example.com", "sub": "user:4503599627370495", "tid": "root-a1b2" }
  ]
}

Final derived token (issued by worker.example.com for the target API):

{
  "iss": "https://worker.example.com",
  "sub": "svc:worker",
  "aud": "https://api.target.example.com",
  "tid": "final-e5f6",
  "authz": { "scheme": "RBAC/1.0.2", "roles": ["editor"] },
  "del": [
    { "iss": "https://auth.example.com", "sub": "user:4503599627370495", "tid": "root-a1b2" },
    { "iss": "https://agent.example.com", "sub": "svc:orchestrator", "tid": "mid-c3d4" }
  ]
}

The target API verifies the final token's signature against worker.example.com's published keys, confirms the del chain is structurally intact (it is covered by the outer signature), and can trace the full authorization lineage back to the original user. Authorization was not escalated at any hop — roles: ["editor"] throughout.


Key discovery

GET https://{issuer-domain}/.well-known/hwt-keys.json

JWKS format (RFC 7517). alg per key is mandatory. Multiple concurrent keys supported for rotation.

Origin metadata

GET https://{issuer-domain}/.well-known/hwt.json

Declares the issuer URL, protocol version, supported authz schemas, audience configuration, delegation depth limit, and endpoint URLs.


Trust model

The trust anchor is the issuer's domain, not a central authority. Verification depends on DNS resolving correctly and TLS connecting to the issuer's well-known endpoint. The recommended production posture is a pre-registered issuer allowlist — verifiers reject tokens from issuers not in the list, converting key discovery into a local cache lookup with no runtime DNS dependency.


Documentation

Implementations

Reference library

Demos


License

Apache License 2.0