manifest.schema.json

The signed index of every device-visible file of an account (config-schema §2).

All pages ↓

manifest.schema.json JSON · 82 lines · Validates manifest.json Raw file
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://streamliner.work/schema/v1/manifest.schema.json",
  "title": "manifest.json",
  "description": "The signed index of every device-visible file of an account (config-schema §2). The app polls this one small file and fetches a file only when its hash changes; it switches to a new version only when every changed file has arrived and verified. Written by scripts/sign-tenant.mjs (or the publisher), never by hand.",
  "type": "object",
  "required": ["schema", "tenant", "version", "published", "files", "signature"],
  "additionalProperties": false,
  "properties": {
    "$schema": { "$ref": "defs.schema.json#/$defs/schemaRef" },
    "schema": { "const": "streamline.config/1", "description": "`streamline.config/1`. An app that does not know the major version keeps its last good config and asks for an update." },
    "tenant": { "$ref": "defs.schema.json#/$defs/tenantId", "description": "Account id. Must equal the folder, `tenant.json` `id` and the enrolled account." },
    "version": { "type": "integer", "minimum": 1, "description": "Monotonic. The app refuses a manifest whose version is lower than the one it holds (rollback protection); every publish is a new version." },
    "published": { "type": "string", "format": "date-time", "description": "When it was signed (RFC 3339). Shown in Settings → About this setup." },
    "minApp": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+( \\([0-9]+\\))?$", "patternErrorMessage": "a version like 1.0.0 (1)", "description": "Oldest app build that understands this config, e.g. `1.0.0 (1)`. Older builds keep the last good config and ask for an update." },
    "refresh": {
      "type": "object",
      "description": "How often the app polls this file.",
      "additionalProperties": false,
      "properties": {
        "foregroundSeconds": { "type": "integer", "minimum": 30, "description": "Poll interval while the app is in the foreground. Default 900." },
        "minSeconds": { "type": "integer", "minimum": 30, "description": "Floor the app never polls faster than. Default 60, minimum 30." }
      }
    },
    "files": {
      "type": "array",
      "description": "Every device-visible file (everything but `private/`, `manifest.json` and `enrolment.json`), with its hash and size.",
      "items": {
        "type": "object",
        "required": ["path", "sha256", "bytes"],
        "additionalProperties": false,
        "properties": {
          "path": { "type": "string", "pattern": "^(tenant\\.json|(agents|templates|forms)/[A-Za-z0-9_-][A-Za-z0-9._-]{0,79}\\.json|assets/[a-f0-9]{16,64}\\.(png|jpe?g|pdf)|demo/(backend\\.js|agent\\.js|fixtures\\.json|tour\\.json))$", "patternErrorMessage": "a device-visible path: tenant.json, agents|templates|forms/<id>.json, assets/<sha256>.<ext> or demo/*; never private/", "description": "Relative to `t/<tenant>/`." },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$", "patternErrorMessage": "a lower-case hex SHA-256 (64 characters)", "description": "SHA-256 of the file's bytes, lower-case hex." },
          "bytes": { "type": "integer", "minimum": 0, "description": "The file's size in bytes." },
          "withheld": { "type": "boolean", "description": "Set by the config host per member (§8b), never published: this member does not get the file. The app deletes it before verifying the signature." }
        }
      }
    },
    "signature": {
      "type": "object",
      "description": "Ed25519 over the manifest's JCS canonical bytes (RFC 8785) without the `signature` member, by one of the account's publisher keys (pinned at enrollment, never the Worker's).",
      "required": ["alg", "keyId", "sig"],
      "additionalProperties": false,
      "properties": {
        "alg": { "const": "Ed25519", "description": "`Ed25519`." },
        "keyId": { "type": "string", "pattern": "^[A-Za-z0-9_.-]{1,64}$", "description": "Names one of the account's publisher keys (`enrolment.json` `keys[]`, or a previous manifest's `nextKeys`), or an owner-approved device key endorsed in `signers`." },
        "sig": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$", "patternErrorMessage": "a 64-byte Ed25519 signature in base64url (86 characters)", "description": "The signature, base64url without padding." }
      }
    },
    "nextKeys": {
      "type": "array",
      "description": "Key rotation: publisher keys the app adds to its pinned set because the current key signed them.",
      "items": {
        "type": "object",
        "required": ["keyId", "pub"],
        "additionalProperties": false,
        "properties": {
          "keyId": { "type": "string", "pattern": "^[A-Za-z0-9_.-]{1,64}$", "description": "The new key's id." },
          "pub": { "$ref": "defs.schema.json#/$defs/base64url32", "description": "The new key's public half." }
        }
      }
    },
    "signers": {
      "type": "array",
      "description": "The endorsement chain of the key that signed this manifest when it is an owner-approved device key, not a publisher key (config-schema §2 *Signers*, §8b *Publishing devices*). Each entry is endorsed by `endorsedBy`: a publisher key the app pinned at enrollment, or another entry (at most four links). The app accepts the signature only when the chain reaches a pinned key; the Worker also requires every device entry to be approved and not revoked. Written by the publishing device and signed with the rest of the manifest.",
      "items": {
        "type": "object",
        "required": ["keyId", "pub", "endorsedBy", "endorsement"],
        "additionalProperties": false,
        "properties": {
          "keyId": { "type": "string", "pattern": "^[A-Za-z0-9_.-]{1,64}$", "description": "The endorsed key's id (`dev-<16 hex>` for a device key)." },
          "pub": { "$ref": "defs.schema.json#/$defs/base64url32", "description": "The endorsed key's public half." },
          "endorsedBy": { "type": "string", "pattern": "^[A-Za-z0-9_.-]{1,64}$", "description": "The key that endorsed it: a pinned publisher key or another entry's keyId." },
          "endorsement": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$", "description": "Ed25519 by `endorsedBy` over `streamline.signer.v1|<account>|<keyId>|<pub>`, base64url." },
          "label": { "type": "string", "maxLength": 64, "description": "The device's name, for people reading the manifest." }
        }
      }
    },
    "withdrawn": { "type": "boolean", "description": "The account's config has been withdrawn; the config host answers 410." }
  }
}

← All Schemas