{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/Sharathvc23/forgetproof/main/schemas/forget-me/v1/index.schema.json",
  "title": "ForgetMe v1: the index document at GET {endpoint}",
  "description": "Public, unauthenticated, tenant-neutral. Where the issuer's receipt-signing keys live, the routes (all derived from the endpoint; listed here for readers), the scopes, the size bounds and the extension's status. A verifier checks a portable receipt's public_key against `keys[].public_key` here.",
  "type": "object",
  "properties": {
    "namespace": {
      "$ref": "common.schema.json#/$defs/namespace"
    },
    "version": {
      "$ref": "common.schema.json#/$defs/version"
    },
    "issuer": {
      "description": "The name that appears as `issuer` in this host's portable receipts.",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "keys": {
      "description": "Every key whose receipts should still verify: the current one and rotated-out predecessors.",
      "type": "array",
      "minItems": 1,
      "maxItems": 16,
      "items": {
        "type": "object",
        "properties": {
          "public_key": {
            "$ref": "common.schema.json#/$defs/public-key"
          },
          "key_fingerprint": {
            "$ref": "common.schema.json#/$defs/fingerprint"
          },
          "valid_from": {
            "$ref": "common.schema.json#/$defs/date-time"
          }
        },
        "required": [
          "public_key",
          "key_fingerprint"
        ],
        "additionalProperties": false
      }
    },
    "routes": {
      "type": "object",
      "properties": {
        "index": {
          "type": "string",
          "format": "uri"
        },
        "preview": {
          "type": "string",
          "format": "uri"
        },
        "submit": {
          "type": "string",
          "format": "uri"
        },
        "operation": {
          "type": "string",
          "format": "uri-template"
        },
        "evidence": {
          "type": "string",
          "format": "uri-template"
        }
      },
      "required": [
        "index",
        "preview",
        "submit",
        "operation",
        "evidence"
      ],
      "additionalProperties": false
    },
    "scopes": {
      "type": "array",
      "items": {
        "$ref": "common.schema.json#/$defs/scope"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "evidence_format": {
      "const": "forget-me-receipt/1"
    },
    "status": {
      "type": "string",
      "maxLength": 400
    },
    "limits": {
      "type": "object",
      "properties": {
        "max_body_bytes": {
          "type": "integer",
          "minimum": 1024
        },
        "idempotency_key": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "minItems": 2,
          "maxItems": 2
        },
        "poll_interval_ms": {
          "type": "integer",
          "minimum": 100
        }
      },
      "required": [
        "max_body_bytes",
        "idempotency_key",
        "poll_interval_ms"
      ],
      "additionalProperties": true
    },
    "well_known": {
      "description": "Where the Company's /.well-known/poppy.json is, and optionally a standalone provider's /.well-known/forgetproof.json.",
      "type": "object",
      "properties": {
        "poppy": {
          "type": "string",
          "format": "uri"
        },
        "forgetproof": {
          "type": "string",
          "format": "uri"
        }
      },
      "additionalProperties": false
    },
    "approval": {
      "description": "How destructive execution is approved at this host (phase 3): through Poppy's Operations extension (version 3). `approver` says whose approvals the host acts on: `user` (the person, in their agent's own interface) or `user-or-agent` (also an agent's approval on the person's instruction).",
      "type": "object",
      "properties": {
        "extension": {
          "const": "operations"
        },
        "version": {
          "const": "3"
        },
        "approver": {
          "type": "string",
          "enum": [
            "user",
            "user-or-agent"
          ]
        },
        "note": {
          "$ref": "common.schema.json#/$defs/text"
        }
      },
      "required": [
        "extension",
        "version",
        "approver"
      ],
      "additionalProperties": true
    },
    "identity": {
      "description": "Who decides the account on every request: Poppy 1.0 (the Session header and OAuth) with the host's issuer, and the OAuth scope names for `item` and `account`.",
      "type": "object",
      "properties": {
        "protocol": {
          "const": "poppy"
        },
        "version": {
          "type": "string",
          "pattern": "^[0-9]+\\.[0-9]+$"
        },
        "issuer": {
          "type": "string",
          "format": "uri"
        },
        "oauth_scopes": {
          "type": "object",
          "properties": {
            "item": {
              "type": "string"
            },
            "account": {
              "type": "string"
            }
          },
          "required": [
            "item",
            "account"
          ]
        }
      },
      "required": [
        "protocol",
        "version",
        "issuer"
      ],
      "additionalProperties": true
    }
  },
  "required": [
    "namespace",
    "version",
    "issuer",
    "keys",
    "routes",
    "scopes",
    "evidence_format",
    "status",
    "limits"
  ],
  "additionalProperties": true
}
