{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openappdefinition.org/schema/0.2/signature.schema.json",
  "title": "OAD 0.2 signature sidecar",
  "description": "A signature sidecar beside a definition, catalog or design system, named after the document's file name with its final .json replaced by .sig.json (com.example.brand.oaddesign.json is signed by com.example.brand.oaddesign.sig.json): detached signatures over the document's digest.",
  "type": "object",
  "required": ["oadSignature", "digest", "signatures"],
  "properties": {
    "$schema": {
      "description": "Optional URI of a JSON Schema for this document, for editors. Hosts ignore it.",
      "$ref": "common.schema.json#/$defs/uriReference"
    },
    "oadSignature": {
      "title": "version marker",
      "description": "Spec version the sidecar targets, MAJOR.MINOR. This schema validates version 0.2.",
      "$ref": "common.schema.json#/$defs/specVersion",
      "const": "0.2"
    },
    "digest": {
      "description": "Digest of the signed document's canonical JSON form.",
      "$ref": "common.schema.json#/$defs/digest"
    },
    "signatures": {
      "description": "Detached signatures over the digest.",
      "type": "array",
      "items": { "$ref": "#/$defs/signature" },
      "minItems": 1
    }
  },
  "additionalProperties": false,
  "$defs": {
    "signature": {
      "title": "signature",
      "description": "One detached signature.",
      "type": "object",
      "required": ["keyId", "algorithm", "value", "signedAt", "signer"],
      "properties": {
        "keyId": {
          "description": "Identifier of the signing key.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "algorithm": {
          "description": "Signature algorithm. ed25519 in 0.2.",
          "const": "ed25519"
        },
        "value": {
          "description": "The 64-byte Ed25519 signature over the UTF-8 bytes of the digest string, encoded as unpadded base64url.",
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$"
        },
        "signedAt": {
          "description": "When the signature was made, as a UTC timestamp.",
          "$ref": "common.schema.json#/$defs/datetime"
        },
        "signer": {
          "description": "Reverse-DNS identity of the signer. Should match or be a parent of the document id.",
          "$ref": "common.schema.json#/$defs/reverseDnsId"
        }
      },
      "additionalProperties": false
    }
  }
}
