SHAR Production
← All contracts

JSON Schema 2020-12

Checksum Inventory

SHA-256 inventory with safe relative paths.

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sharprod.com/schemas/checksum-inventory.schema.json",
  "title": "SHAR Production Checksum Inventory Contract",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "algorithm": {
      "const": "sha256"
    },
    "files": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "path",
          "sha256"
        ],
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^[^./][^\\\\]*$"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      }
    }
  },
  "required": [
    "algorithm",
    "files"
  ]
}

Verified example

{
  "input": {
    "algorithm": "sha256",
    "files": [
      {
        "path": "masters/final.mov",
        "sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
      }
    ]
  },
  "result": {
    "valid": true,
    "errors": []
  }
}

Rejected example

{
  "input": {
    "algorithm": "md5",
    "files": []
  },
  "result": {
    "valid": false,
    "errors": [
      {
        "instancePath": "/algorithm",
        "schemaPath": "#/properties/algorithm/const",
        "keyword": "const",
        "params": {
          "allowedValue": "sha256"
        },
        "message": "must be equal to constant"
      }
    ]
  }
}

SHAR Production · sharprod.com