ShaclValidator
SHACL (Shapes Constraint Language) validator implementation.
Supports SHACL Core validation for RDF data structures. Validates credential structure and credentialSubject against SHACL shapes.
Note: This is a basic implementation. A full implementation would require a SHACL validation library (e.g., TopQuadrant/shacl-java, Apache Jena SHACL).
Example Usage:
val validator = ShaclValidator()
SchemaRegistries.defaultValidatorRegistry().register(validator)
val schema = buildJsonObject {
put("@context", "https://www.w3.org/ns/shacl#")
put("sh:targetClass", "EducationCredential")
put("sh:property", buildJsonArray {
add(buildJsonObject {
put("sh:path", "credentialSubject.degree")
put("sh:datatype", "http://www.w3.org/2001/XMLSchema#string")
put("sh:minCount", 1)
})
})
}
val result = validator.validate(credential, schema)Content copied to clipboard
Functions
Link copied to clipboard
open suspend override fun validate(credential: VerifiableCredential, schema: JsonObject): SchemaValidationResult
Link copied to clipboard
open suspend override fun validateClaims(claims: Claims, schema: JsonObject): SchemaValidationResult