listing-version.schema.json

The signed index of one version of a Discover listing (config-schema §8c): its files with their hashes, signed by the key the listing was made with or (a listing made with the account's publisher key) by an approved publishing device whose endorsement chain reaches it.

All pages ↓

listing-version.schema.json JSON · 69 lines · Validates manifest.json (a Discover listing version) Raw file
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://streamliner.work/schema/v1/listing-version.schema.json",
  "title": "manifest.json (a Discover listing version)",
  "description": "The signed index of one version of a Discover listing (config-schema §8c): its files with their hashes, signed by the key the listing was made with or (a listing made with the account's publisher key) by an approved publishing device whose endorsement chain reaches it. The channel is that key's fingerprint, so anyone can check that a version came from the channel's key without trusting the server. Written by the app when it shares a link, never by hand.",
  "type": "object",
  "required": ["schema", "listing", "channel", "version", "published", "files", "signer", "signature"],
  "additionalProperties": false,
  "properties": {
    "$schema": { "$ref": "defs.schema.json#/$defs/schemaRef" },
    "schema": { "const": "streamline.listing-version/1", "description": "`streamline.listing-version/1`." },
    "listing": { "type": "string", "pattern": "^[a-z2-7]{26}$", "patternErrorMessage": "a listing id: 26 lower-case base32 characters", "description": "The listing's id (the server chose it; the link is `/s/<listing>`). A version can't be moved to another listing." },
    "channel": { "type": "string", "pattern": "^[a-f0-9]{32}$", "patternErrorMessage": "32 lower-case hex characters", "description": "The first 32 hex characters of sha256 of the raw public key the listing was made with (the signer's, or with `signers`, `root`'s)." },
    "version": { "type": "integer", "minimum": 1, "description": "Monotonic per listing: the server refuses one at or below the current (`409 stale_version`)." },
    "published": { "type": "string", "format": "date-time", "description": "When it was signed (RFC 3339)." },
    "files": {
      "type": "array", "minItems": 2, "maxItems": 13,
      "description": "Every file of the version: `listing.json` and each `streamlines/<id>.streamline.json` it lists.",
      "items": {
        "type": "object", "required": ["path", "sha256", "bytes"], "additionalProperties": false,
        "properties": {
          "path": { "type": "string", "pattern": "^(listing\\.json|streamlines/[a-z0-9_]{2,32}\\.streamline\\.json)$", "patternErrorMessage": "listing.json or streamlines/<id>.streamline.json", "description": "Relative to the version." },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$", "description": "SHA-256 of the file's bytes, lower-case hex." },
          "bytes": { "type": "integer", "minimum": 1, "maximum": 524288, "description": "The file's size in bytes." }
        }
      }
    },
    "signer": {
      "type": "object", "required": ["keyId", "pub"], "additionalProperties": false,
      "properties": {
        "keyId": { "type": "string", "pattern": "^dev-[a-f0-9]{16}$", "description": "`dev-` + the first 16 hex of sha256(raw public key)." },
        "pub": { "$ref": "defs.schema.json#/$defs/base64url32", "description": "The sharing key's public half." },
        "label": { "type": "string", "maxLength": 64, "description": "The device's name, for people reading the manifest." }
      },
      "description": "The key that signed this version. Without `signers` its fingerprint must equal `channel`; with them it is their first link (the signing device)."
    },
    "signers": {
      "type": "array", "minItems": 1, "maxItems": 4,
      "description": "The signing device's endorsement chain (config-schema §2 *Signers*, without labels), from `signer` up to `root`. Only for a listing made with the account's publisher key.",
      "items": {
        "type": "object", "required": ["keyId", "pub", "endorsedBy", "endorsement"], "additionalProperties": false,
        "properties": {
          "keyId": { "type": "string", "pattern": "^dev-[a-f0-9]{16}$", "description": "The device key's id." },
          "pub": { "$ref": "defs.schema.json#/$defs/base64url32", "description": "The device key's public half." },
          "endorsedBy": { "type": "string", "minLength": 1, "maxLength": 64, "description": "`root.keyId`, 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." }
        }
      }
    },
    "root": {
      "type": "object", "required": ["keyId", "pub"], "additionalProperties": false,
      "description": "The account's publisher key the listing was made with: the chain's end. Its fingerprint is `channel`. With `signers` only.",
      "properties": {
        "keyId": { "type": "string", "minLength": 1, "maxLength": 64, "description": "The publisher key's id (enrolment.json)." },
        "pub": { "$ref": "defs.schema.json#/$defs/base64url32", "description": "Its public half." }
      }
    },
    "account": { "$ref": "defs.schema.json#/$defs/tenantId", "description": "The account id the endorsements name. With `signers` only." },
    "signature": {
      "type": "object", "required": ["alg", "keyId", "sig"], "additionalProperties": false,
      "description": "The publisher's signature over everything else in this file.",
      "properties": {
        "alg": { "const": "Ed25519", "description": "`Ed25519`." },
        "keyId": { "type": "string", "pattern": "^dev-[a-f0-9]{16}$", "description": "Equals `signer.keyId`." },
        "sig": { "type": "string", "pattern": "^[A-Za-z0-9_-]{86}$", "description": "Ed25519 over the manifest's JCS bytes (RFC 8785) without `signature`, base64url." }
      }
    }
  }
}

← All Schemas