{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/infocert/main/json-schema/infocert-signature-request-schema.json",
  "title": "SignatureRequest",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/infocert-sign-openapi.yml#/components/schemas/SignatureRequest",
  "type": "object",
  "properties": {
    "applicationId": {
      "type": "string"
    },
    "pin": {
      "type": "string"
    },
    "hashAlgoOid": {
      "type": "string",
      "description": "Allowed hashAlgoOid:\n\n- SHA-256 (2.16.840.1.101.3.4.2.1)\n- SHA-384 (2.16.840.1.101.3.4.2.2)\n- SHA-512 (2.16.840.1.101.3.4.2.3)\n\nIts usage depends on the certificate's keyAlgorithm"
    },
    "authorization": {
      "$ref": "#/$defs/AuthorizationData"
    },
    "asicSignatures": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AsicSignature"
      }
    },
    "cadesSignatures": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CadesSignature"
      }
    },
    "hashSignatures": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HashSignature"
      }
    },
    "padesSignatures": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PadesSignature"
      }
    },
    "xadesSignatures": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/XadesSignature"
      }
    }
  },
  "$defs": {
    "AsicSignature": {
      "type": "object",
      "title": "AsicSignature",
      "description": "parameters to be used for asic signature",
      "properties": {
        "requestId": {
          "type": "string"
        },
        "signatureType": {
          "type": "string",
          "enum": [
            "CAdES",
            "XAdES"
          ],
          "description": "signature type"
        },
        "signatureLevel": {
          "type": "string",
          "enum": [
            "BASELINE-B",
            "BASELINE-T",
            "BASELINE-LT",
            "BASELINE-LTV"
          ]
        },
        "containerType": {
          "type": "string",
          "enum": [
            "ASiC_S",
            "ASiC_E"
          ],
          "description": "container type"
        },
        "documents": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Document"
          }
        }
      },
      "required": [
        "requestId",
        "signatureType",
        "signatureLevel",
        "containerType",
        "documents"
      ]
    },
    "AuthorizationData": {
      "type": "object",
      "title": "AuthorizationData",
      "properties": {
        "sat": {
          "$ref": "#/$defs/sat"
        },
        "sac": {
          "$ref": "#/$defs/sac"
        },
        "sacSchema": {
          "$ref": "#/$defs/sacSchema"
        },
        "transactionId": {
          "type": "string"
        },
        "otp": {
          "type": "string"
        },
        "authorizedSignatures": {
          "type": "integer",
          "format": "int32"
        },
        "authorizedDigests": {
          "$ref": "#/$defs/SignatureDigests"
        }
      }
    },
    "CadesSignature": {
      "type": "object",
      "title": "CadesSignature",
      "description": "parameters to be used for CADES signature",
      "properties": {
        "counterSignCertificate": {
          "type": "string",
          "description": "counter sign certificate used for CADES signatures",
          "format": "byte"
        },
        "parallelSign": {
          "type": "boolean",
          "description": "should signature happen in parallel"
        }
      },
      "allOf": [
        {
          "$ref": "#/$defs/Signature"
        }
      ]
    },
    "CommitmentType": {
      "type": "object",
      "title": "CommitmentType",
      "properties": {
        "proofOfCreation": {
          "type": "boolean"
        },
        "proofOfApproval": {
          "type": "boolean"
        },
        "proofOfDelivery": {
          "type": "boolean"
        },
        "proofOfOrigin": {
          "type": "boolean"
        },
        "proofOfReceipt": {
          "type": "boolean"
        },
        "proofOfSender": {
          "type": "boolean"
        }
      }
    },
    "DigestDocument": {
      "type": "object",
      "title": "DigestDocument",
      "properties": {
        "content": {
          "type": "string",
          "description": "the inline digest  to sign",
          "format": "byte"
        },
        "algo": {
          "type": "string",
          "enum": [
            "SHA-256",
            "SHA-384",
            "SHA-512"
          ],
          "description": "The algoritm used to compute the digest"
        }
      }
    },
    "Document": {
      "type": "object",
      "title": "Document",
      "properties": {
        "content": {
          "type": "string",
          "description": "the inline content to sign",
          "format": "byte"
        },
        "contentType": {
          "type": "string"
        },
        "attachName": {
          "type": "string"
        },
        "digest": {
          "$ref": "#/$defs/DigestDocument"
        }
      }
    },
    "HashSignature": {
      "type": "object",
      "title": "HashSignature",
      "properties": {
        "requestId": {
          "type": "string"
        },
        "hash": {
          "type": "string",
          "format": "byte"
        },
        "withTimestamp": {
          "type": "boolean",
          "description": "If true, the timestamp is applied to the hash"
        }
      },
      "required": [
        "requestId",
        "hash"
      ]
    },
    "PadesSignature": {
      "type": "object",
      "title": "PadesSignature",
      "description": "Parameters to be used for PADES Signature",
      "properties": {
        "signatureFields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SignatureField"
          }
        },
        "isVisible": {
          "type": "boolean",
          "description": "The signature is visible"
        },
        "reason": {
          "type": "string",
          "description": "The reason for the signature. This field is only effective if `isVisible` is `false`."
        },
        "location": {
          "type": "string",
          "description": "The location where the signature was made. This field is only effective if `isVisible` is `false`."
        },
        "baselineLTVmode": {
          "type": "string",
          "enum": [
            "ALL",
            "SELECTIVE"
          ],
          "default": "ALL"
        },
        "removeNeedAppearance": {
          "type": "boolean",
          "description": "If true, the PDF is analyzed and possibly corrected before signatures are applied. No changes are made if the PDF file already contains signatures.",
          "default": false
        }
      },
      "allOf": [
        {
          "$ref": "#/$defs/Signature"
        }
      ]
    },
    "ProductionPlacement": {
      "type": "object",
      "title": "ProductionPlacement",
      "properties": {
        "city": {
          "type": "string"
        },
        "postalCode": {
          "type": "string"
        },
        "stateOrProvince": {
          "type": "string"
        },
        "country": {
          "type": "string"
        }
      }
    },
    "Signature": {
      "type": "object",
      "title": "Signature",
      "properties": {
        "signatureLevel": {
          "type": "string",
          "enum": [
            "BASELINE-B",
            "BASELINE-T",
            "BASELINE-LT",
            "BASELINE-LTV"
          ]
        },
        "requestId": {
          "type": "string"
        },
        "document": {
          "$ref": "#/$defs/Document"
        },
        "packaging": {
          "type": "string",
          "enum": [
            "ENVELOPED",
            "ENVELOPING",
            "DETACHED",
            "COUNTERSIG"
          ]
        }
      },
      "required": [
        "signatureLevel",
        "requestId",
        "document",
        "packaging"
      ]
    },
    "SignatureDigests": {
      "type": "object",
      "title": "SignatureDigests",
      "properties": {
        "documentDigests": {
          "type": "array",
          "description": "List of document digests (used for document and document_digest signatures)",
          "items": {
            "type": "string"
          }
        },
        "dtbsDigests": {
          "type": "array",
          "description": "List of dtbs digests (used for hash signatures)",
          "items": {
            "type": "string"
          }
        },
        "digestAlgorithm": {
          "type": "string",
          "description": "Digest algorithm specification",
          "pattern": "^(SHA-256|SHA-384|SHA-512|SHA3-256|SHA3-384|SHA3-512)$"
        }
      },
      "allOf": [
        {
          "if": {
            "required": [
              "document_digests"
            ]
          },
          "then": {
            "required": [
              "digest_algorithm"
            ]
          }
        }
      ]
    },
    "SignatureField": {
      "type": "object",
      "title": "SignatureField",
      "description": "Signature fields presentation for PADES signatures",
      "properties": {
        "name": {
          "type": "string"
        },
        "reason": {
          "type": "string"
        },
        "reasonLabel": {
          "type": "string"
        },
        "location": {
          "type": "string"
        },
        "locationLabel": {
          "type": "string"
        },
        "contactInfo": {
          "type": "string"
        },
        "signedByLabel": {
          "type": "string"
        },
        "signatureDateLabel": {
          "type": "string"
        },
        "timestamp": {
          "type": "boolean"
        },
        "isPdfa": {
          "type": "boolean"
        },
        "keyword": {
          "type": "string"
        },
        "position": {
          "$ref": "#/$defs/SignatureFieldPosition"
        },
        "font": {
          "type": "string",
          "enum": [
            "HELR45W",
            "COURIER",
            "COURIERNEW",
            "ROBOTOMONO",
            "OPENSANS"
          ]
        },
        "fontSize": {
          "type": "integer",
          "format": "int32"
        },
        "lengthField": {
          "type": "integer",
          "format": "int32"
        },
        "widthField": {
          "type": "integer",
          "format": "int32"
        },
        "timezone": {
          "type": "string",
          "description": "signature field timezone id"
        },
        "visibleText": {
          "type": "string",
          "description": "signature field free text visible. Overwrite default value."
        },
        "signatureImage": {
          "type": "string",
          "format": "byte"
        },
        "avoidGraphicLayers": {
          "type": "boolean",
          "description": "signature fields presentation for PADES signatures"
        }
      }
    },
    "SignatureFieldPosition": {
      "type": "object",
      "title": "SignatureFieldPosition",
      "properties": {
        "page": {
          "type": "integer",
          "format": "int32"
        },
        "llx": {
          "type": "integer",
          "format": "int32"
        },
        "lly": {
          "type": "integer",
          "format": "int32"
        },
        "urx": {
          "type": "integer",
          "format": "int32"
        },
        "ury": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "XadesSignature": {
      "type": "object",
      "title": "XadesSignature",
      "description": "parameters to be used for XADES signature",
      "properties": {
        "signatureFormat": {
          "type": "string",
          "enum": [
            "ETSI EN 319 132",
            "ETSI TS 103 171"
          ],
          "description": "only 'ETSI EN 319 132' supported in the current implementation"
        },
        "productionPlacement": {
          "$ref": "#/$defs/ProductionPlacement"
        },
        "commitmentType": {
          "$ref": "#/$defs/CommitmentType"
        },
        "xpathExpression": {
          "$ref": "#/$defs/XpathExpression"
        },
        "signerRole": {
          "type": "string",
          "description": "Signer Role"
        },
        "signingTime": {
          "type": "string",
          "format": "date-time"
        },
        "isSHA1DigestEnabled": {
          "type": "boolean"
        },
        "canonicalizationWithoutCommentsEnabled": {
          "type": "boolean"
        },
        "includePublicKey": {
          "type": "boolean"
        },
        "signatureIdToCounterSign": {
          "type": "string"
        },
        "profile": {
          "type": "string"
        }
      },
      "allOf": [
        {
          "$ref": "#/$defs/Signature"
        }
      ]
    },
    "XpathExpression": {
      "type": "object",
      "title": "XpathExpression",
      "properties": {
        "xPathFilterType": {
          "type": "string",
          "enum": [
            "SUBSTRACT",
            "INTERSECT"
          ]
        },
        "checkValidXpathBeforeSignature": {
          "type": "boolean"
        },
        "xPathExpression": {
          "type": "string"
        }
      }
    },
    "sac": {
      "type": "string"
    },
    "sacSchema": {
      "type": "string"
    },
    "sat": {
      "type": "string"
    }
  }
}