Schemas are useful when enforcing a specific structure on a collection of data like a Verifiable Credential. Data Verification schemas, for example, are used to verify that the structure and contents of a Verifiable Credential conform to a published schema. On the other hand, Data Encoding schemas are used to map the contents of a Verifiable Credential to an alternative representation format, such as a binary format used in a zero-knowledge proof.
Truvera credential schemas are using json schema format and should follow this structure https://json-schema.org/understanding-json-schema/reference
Schemas are used to describe the structure of credentials, specifically the credential subject. It helps the issuer, holder, and verifier to unambiguously determine the claims contained within the credential. To create a schema, you need to define the object body using JSON schema.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | object | true | JSON-schema. |
{% openapi src="https://swagger-api.truvera.io/openapi.yaml" path="/schemas" method="post" %} https://swagger-api.truvera.io/openapi.yaml {% endopenapi %}
Return a list of all schemas created by the authenticated user.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| offset | query | integer | false | How many items to offset by for pagination |
| limit | query | integer | false | How many items to return at one time (max 64) |
{% openapi src="https://swagger-api.truvera.io/openapi.yaml" path="/schemas" method="get" %} https://swagger-api.truvera.io/openapi.yaml {% endopenapi %}
Reading a Schema from the blockchain can easily be achieved by using the get method which will return the JSON schema to a specific schema ID. The schemaIdneeds to be URL encoded (e.g. /schemas/https%3A%2F%2Fschema.dock.io%2FTestSchema-V1-1695817897561.json)
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| schemaId | path | String | true | A URL encoded schema id. |
{% openapi src="https://swagger-api.truvera.io/openapi.yaml" path="/schemas/{schemaId}" method="get" %} https://swagger-api.truvera.io/openapi.yaml {% endopenapi %}
{% openapi src="https://swagger-api.truvera.io/openapi.yaml" path="/schemas/{schemaId}" method="delete" %} https://swagger-api.truvera.io/openapi.yaml {% endopenapi %}