Skip to content
Registry StackDocsDevelopment (unreleased)

What a Render template receives

View as Markdown

Registry Render injects exactly one input into a template, sys.inputs.data, as a JSON string. Those bytes are the RFC 8785 canonicalisation of the envelope below. The sha256 of those exact bytes is the dataDigest the caller stores on the record.

#let payload = json(bytes(sys.inputs.data))
#let d = payload.data
#let L = payload.labels.ar
{
"data": {},
"assets": {
"photo": "<base64>"
},
"labels": {
"ar": {},
"fr": {}
},
"locale": "ar",
"issuedAt": "2026-09-16T10:32:00Z",
"document": {
"id": "receipt",
"version": 3
},
"signing": {
"mode": "seal",
"signerName": "Ministry of Licensing",
"testOnly": false
}
}
  • data is your request data, validated against the document’s schema.
  • assets holds request images. The template reads them as virtual files, such as image("/assets/photo").
  • labels holds every label table the document declared in its manifest.
  • locale is present only when the request sent one, and is validated.
  • issuedAt is the document’s issuance claim. It is also the world clock and the PDF date.
  • document carries the document type’s id and its version from the manifest.
  • signing is present only on the seal route, POST /v1/seal/{type}, and in compile --preview-seal.

labels is bundle-owned content: one label table per labels/<locale>.yaml (kind: RenderLabels), whose labels map of key to text the template receives flat. Label keys match ^[a-z][a-z0-9_-]{0,63}$, for example example_title. The Registry Render configuration reference lists the label table fields.

Label values use the shared display-text rules: multilingual joiners and direction marks remain valid, while controls that can invisibly reorder text are refused.

The manifest lists the locales in labels: [...], and the template receives every declared table, so a bilingual document consumes both. A key present in one locale and missing from another is a registry-render check error, not a runtime surprise. A key no locale declares is a template error at compile time.

assets values are the base64 text as received. The template never decodes them: reference the decoded image as image("/assets/photo"), with the leading slash, because the assets namespace sits at the bundle root. Hashing covers the exact bytes.

issuedAt is the clock. datetime.today(), set document(date: auto), and the PDF creation date all derive from it. A re-render with the same issuedAt and data is byte-identical; changing it changes bytes.

The instant is normalised to UTC: 2026-09-16T13:32:00+03:00 and 2026-09-16T10:32:00Z are the same render. The caller’s UTC offset is deliberately not preserved, and the envelope carries the Z form only.

A local-date layout can still shift the instant: datetime.today(offset: 3) answers “what date is it 3 hours after issuance”. The offset is total hours, so fractional values work and land at full-second precision. An offset large enough to overflow the shift answers none instead of failing.

document.version is the template’s own version from the manifest, so print it on paper if you like. The renderer version appears nowhere in the envelope or the PDF bytes.

Data is inert. Values are Typst values and are never evaluated; a string that looks like code is only a string.

Paths are contained. image() and read() resolve only exact keys in the immutable bundle snapshot and the virtual /assets/... namespace. The renderer’s world refuses .. and absolute paths, and bundle symlinks are refused before a snapshot is accepted.

Each render starts a fresh Typst world, so no state or cached layout passes between requests. The world offers three roots: the bundle, the request’s assets under a virtual assets/ path, and the vendored packages. A path outside them is refused even when request data supplies it, and error messages name virtual paths, never the host’s. Fonts load in a fixed order, the binary’s baseline set and then the bundle’s sorted by path, because order decides fallback.

The PDF names a fixed creator with no version, so an upgrade that changes no layout changes no bytes. Below Typst, the workspace lockfile pins the compression libraries, because a patch release there can re-encode a stream and move every byte after it. The same inputs give the same bytes on Linux and macOS. A seal takes its signing time from the host’s clock instead of issuedAt.

signing means the file will be sealed. Only the seal route adds it. The render route and every other render never do, so a template prints its seal block only on files that carry a seal.

The one exception is a preview. registry-render compile --preview-seal test-only (or production, which sets testOnly) adds the member, with --signer-name <text> as signerName, and signs nothing. Its output is byte for byte the first revision the seal route signs for the same inputs, so a golden can cover a template’s sealed variant.

Read the member with payload.at("signing", default: none) so one template serves both routes.

  • mode is always "seal".
  • signerName is the seal certificate’s display name (its organisation, else its common name). It is absent when the certificate names neither.
  • testOnly is true when the runtime declares assuranceProfile: local. Print a visible test marking then, because a test seal is not an official document. The registry-render init scaffold prints the block below, labelled.

The member is part of the canonical envelope, so a sealed render’s dataDigest differs from a plain render of the same request. The signature itself is added after the template runs, as an invisible field: the template draws no signature appearance.

#let signing = payload.at("signing", default: none)
#if signing != none [
Electronically sealed by #signing.at("signerName", default: "the issuing authority").
#if signing.testOnly [ TEST SEAL: not a valid official document. ]
]

Edit templates freely with upstream tooling: tinymist and VS Code give a live preview when you point them at the source bundle. registry-render compile, validate and check accept raw source during authoring.

When the bundle is ready, registry-render package --bundle <source> --output <new-directory> validates the source and writes the shared SHA256SUMS envelope plus an optional REVISION. registry-render serve always verifies that package, including an optional package.expectedDigest pin, before it listens.

registry-render check verifies everything, including that every label character is drawable by some bundle or baseline font. A successful render that prints tofu is wrong on paper, so coverage gaps are named at check time and warnings fail --strict at render time.

serve includes X-Registry-Warning-Count on every PDF response, including zero for a render without warnings. A host can withhold a document when that count is nonzero, and request Accept: application/json to inspect warnings. Only the count reaches the header, never warning text or document values.

When in doubt, the exact injected bytes are the ground truth:

Terminal window
registry-render compile ... --emit-envelope env.json

The repository carries three complete working example bundles: a bilingual right-to-left receipt, a PDF/A certificate, and an ID-1 card with a photo.