{
  "$id": "https://schema.smartr.solutions/andon/v1/envelope.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": true,
  "description": "The sealed envelope a source uploads to the relay, envelope format v1. Generated from go/envelope; do not edit by hand.\n\nNOT NORMATIVE. spec/envelope.md is the specification and go/envelope the reference implementation. Three of the relay's rules cannot be expressed here: whether view matches the view ID in the request path, the 256 KiB limit on the whole document, and which of the stable error codes the relay answers with. Use this to catch a malformed envelope early - not to decide whether the relay will accept one.",
  "examples": [
    {
      "ct": "BPJ82bywLZVVfzh6NYEtohCh",
      "kv": 3,
      "nonce": "fDcgsU7nTxZlN5Op",
      "notify": true,
      "v": 1,
      "view": "vw_totavbtprh6rdpgg2m2f6vrwny"
    }
  ],
  "properties": {
    "ct": {
      "contentEncoding": "base64",
      "description": "AES-256-GCM ciphertext including the 16-byte tag, so at least 16 bytes once decoded. Standard base64, with or without padding.",
      "pattern": "^[A-Za-z0-9+/]{22,}={0,2}$",
      "type": "string",
      "x-minimum-decoded-length": 16
    },
    "kv": {
      "description": "Version of the content key. Write it as a plain integer literal: 1e2 is a number to a schema validator, but not to the relay.",
      "maximum": 2147483647,
      "minimum": 1,
      "type": "integer"
    },
    "nonce": {
      "contentEncoding": "base64",
      "description": "GCM nonce, exactly 12 bytes once decoded. Standard base64; the URL alphabet is not allowed.",
      "pattern": "^[A-Za-z0-9+/]{16}$",
      "type": "string",
      "x-decoded-length": 12
    },
    "notify": {
      "default": false,
      "description": "Whether the relay should wake the devices. Absent or null means false.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "v": {
      "const": 1,
      "description": "Envelope format version.",
      "type": "integer"
    },
    "view": {
      "description": "View ID. The relay additionally requires it to equal the view ID in the request path - that check cannot live in a schema.",
      "pattern": "^vw_[a-z2-7]{26}$",
      "type": "string"
    }
  },
  "required": [
    "v",
    "view",
    "kv",
    "nonce",
    "ct"
  ],
  "title": "Andon envelope v1",
  "type": "object"
}
