{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ishare.eu/v3/claims/idp-assertion/schema.json",
  "title": "Verifiable Credential: iSHARE Identity Provider Assertion Claim",
  "description": "Verifiable Credential envelope for an iSHARE Identity Provider Assertion Claim. VC 2.0 fields at the top level; domain-specific claims under credentialSubject. This schema describes the unsigned VC envelope (without proof).",
  "type": "object",
  "properties": {
    "@context": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "prefixItems": [
        {
          "const": "https://www.w3.org/ns/credentials/v2"
        },
        {
          "const": "https://schemas.ishare.eu/v3/claims/idp-assertion/context.jsonld"
        }
      ]
    },
    "type": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "prefixItems": [
        {
          "const": "VerifiableCredential"
        },
        {
          "const": "IdpAssertionCredential"
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "issuer": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": true
        }
      ]
    },
    "validFrom": {
      "type": "string",
      "format": "date-time"
    },
    "validUntil": {
      "type": "string",
      "format": "date-time"
    },
    "credentialStatus": {
      "$ref": "https://schemas.ishare.eu/v3/common/credential-status.json#/$defs/CredentialStatus",
      "description": "Credential status for checking revocation, suspension, or refresh status using bitstring status lists (BitstringStatusListEntry) as defined in W3C Bitstring Status List v1.0"
    },
    "credentialSubject": {
      "$ref": "#/$defs/IdpAssertionClaimSubject"
    }
  },
  "required": [
    "@context",
    "type",
    "issuer",
    "credentialStatus",
    "credentialSubject"
  ],
  "additionalProperties": false,
  "$defs": {
    "IdpAssertionClaimSubject": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "const": "idpAssertion"
        },
        "registrarId": {
          "type": "string"
        },
        "assertion": {
          "type": "string",
          "description": "Value of the assertion",
          "examples": [
            "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
          ]
        },
        "verificationHash": {
          "type": "string",
          "description": "The calculated hash of the assertion that has been uploaded. The verificationHash must be calculated using the SHA256 hashing algorithm.",
          "examples": [
            "aef5bb5e3ab49150a53b89628ab8593315b6686f3f96497277feb9d658527acb"
          ]
        }
      },
      "required": [
        "id",
        "type",
        "registrarId",
        "assertion"
      ],
      "additionalProperties": false
    }
  }
}
