@blockcerts/schemas
Version:
One source of truth for Blockcerts schemas
407 lines (405 loc) • 14.6 kB
JSON
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Assertion schema",
"description": "Blockcerts 2.0 Assertion schema. Extends Open Badges v2.0 schema: https://w3id.org/openbadges#Assertion",
"type": "object",
"definitions": {
"JsonLdContext": {
"description": "A link to a valid JSON-LD context, or array of JSON-LD contexts",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "array"
}
]
}
}
]
},
"JsonLdType": {
"description": "A type or an array of types defined in a referenced JSON-LD context.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"ISODateTime": {
"description": "ISO 8601 date format string `yyyy-MM-dd'T'HH:mm:ss.SSS` with optional `.SSS` milliseconds",
"type": "string"
},
"UNIXTimeStamp": {
"description": "10-digit UNIX timestamp, epoch time",
"type": "integer",
"minimum": 0,
"maximum": 9999999999
},
"DateTime": {
"anyOf": [
{
"$ref": "#/definitions/ISODateTime"
},
{
"$ref": "#/definitions/UNIXTimeStamp"
}
]
},
"HashString": {
"type": "string",
"description": "Open Badges SHA-256 Hash",
"pattern": "^sha256\\$[a-fA-F0-9]{64}$"
},
"IdentityObject": {
"title": "Badge Identity Object",
"description": "From https://w3id.org/openbadges#IdentityObject, with extensions for recipient profile.",
"type": "object",
"properties": {
"identity": {
"description": "Defined by `identity` property of https://w3id.org/openbadges#IdentityObject",
"oneOf": [
{
"$ref": "#/definitions/HashString"
},
{
"type": "string",
"format": "email"
}
]
},
"type": {
"type": "string",
"enum": [
"email"
],
"description": "Defined by `type` property of https://w3id.org/openbadges#IdentityObject"
},
"hashed": {
"type": "boolean",
"description": "Defined by `hashed` property of https://w3id.org/openbadges#IdentityObject"
},
"salt": {
"description": "Defined by `salt` property of https://w3id.org/openbadges#IdentityObject",
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"recipientProfile": {
"$ref": "https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"
}
},
"required": [
"identity",
"type",
"hashed"
]
},
"VerificationObject": {
"description": "From https://w3id.org/openbadges#VerificationObject, with extensions for Blockcerts verification",
"type": "object",
"properties": {
"type": {
"$ref": "#/definitions/JsonLdType",
"description": "Defined by `type` property of https://w3id.org/openbadges#VerificationObject. Blockcerts extension: this should contain the entry `MerkleProofVerification2017`"
},
"creator": {
"type": "string",
"anyOf": [{
"type": "string",
"pattern": "^ecdsa-koblitz-pubkey:",
"description": "Issuer public key or blockchain address with `<scheme>:` prefix. For Bitcoin transactions, this would be the issuer public address prefixed with `ecdsa-koblitz-pubkey:`. Example: `ecdsa-koblitz-pubkey:14RZvYazz9H2DC2skBfpPVxax54g4yabxe`"
}, {
"type": "string",
"format": "uri"
}
],
"description": "Blockcerts extension: the expected blockchain address for the signer of the transaction containing the merkle proof. In Blockcerts `creator` IRIs are typically represented with a `<scheme>:` prefix. For Bitcoin transactions, this would be the issuer public Bitcoin address prefixed with `ecdsa-koblitz-pubkey:`; e.g. `ecdsa-koblitz-pubkey:14RZvYazz9H2DC2skBfpPVxax54g4yabxe`"
},
"verificationProperty": {
"type": "object",
"description": "Defined by `verificationProperty` property of https://w3id.org/openbadges#VerificationObject"
},
"startsWith": {
"type": "string",
"format": "uri",
"description": "Defined by `startsWith` property of https://w3id.org/openbadges#VerificationObject"
},
"allowedOrigins": {
"type": "string",
"format": "uri",
"description": "Defined by `allowedOrigins` property of https://w3id.org/openbadges#VerificationObject"
}
},
"required": [
"type"
]
},
"ImageUri": {
"description": "An image representative of the entity. In Blockcerts this is typically a data URI (https://en.wikipedia.org/wiki/Data_URI_scheme) embedded as a base-64 encoded PNG image, but it may also be a URI where the image may be found.",
"type": "string",
"anyOf": [
{
"type": "string",
"pattern": "^data:"
},
{
"type": "string",
"format": "uri"
}
]
},
"AlignmentObject": {
"description": "From https://w3id.org/openbadges#AlignmentObject",
"type": "object",
"properties": {
"targetName": {
"type": "string",
"description": "Defined by `targetName` property of https://w3id.org/openbadges#AlignmentObject"
},
"targetUrl": {
"type": "string",
"format": "uri",
"description": "Defined by `targetUrl` property of https://w3id.org/openbadges#AlignmentObject"
},
"targetDescription": {
"type": "string",
"description": "Defined by `targetDescription` property of https://w3id.org/openbadges#AlignmentObject"
}
},
"required": [
"targetName",
"targetUrl"
]
},
"AlignmentArray": {
"description": "List of objects describing which objectives or educational standards this badge aligns to, if any.",
"type": "array",
"items": {
"$ref": "#/definitions/AlignmentObject"
}
},
"TagsArray": {
"description": "List of tags that describe the type of achievement.",
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"SignatureLine": {
"$ref": "https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"
},
"MerkleProof2017": {
"$ref": "https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"
},
"BadgeClass": {
"description": "From https://w3id.org/openbadges#BadgeClass",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri",
"description": "Defined by `id` property of https://w3id.org/openbadges#BadgeClass. This field is required in Open Badges but currently optional in Blockcerts for compatibility. This may be an HTTP IRI, but only if the issuer plans to host the BadgeClass definitions on a long-term basis, or (at least) until expiration of certificates referencing this BadgeClass. Otherwise it is recommended to use a `urn:uuid:<UUID>`-formatted IRI."
},
"type": {
"$ref": "#/definitions/JsonLdType",
"description": "Defined by `type` property of https://w3id.org/openbadges#BadgeClass"
},
"name": {
"type": "string",
"description": "Defined by `name` property of https://w3id.org/openbadges#BadgeClass"
},
"subtitle": {
"type": "string",
"description": "Blockcerts extension: optional subtitle of the certificate"
},
"description": {
"type": "string",
"description": "Defined by `description` property of https://w3id.org/openbadges#BadgeClass"
},
"image": {
"$ref": "#/definitions/ImageUri",
"description": "Defined by `image` property of https://w3id.org/openbadges#BadgeClass"
},
"criteria": {
"type": "object",
"description": "Defined by `criteria` property of https://w3id.org/openbadges#BadgeClass. This field is required in Open Badges, currently optional in Blockcerts for compatibility. "
},
"issuer": {
"$ref": "#/definitions/Profile",
"description": "Defined by `issuer` property of https://w3id.org/openbadges#BadgeClass, with Blockcerts extensions for blockchain verification of badges."
},
"alignment": {
"$ref": "#/definitions/AlignmentArray",
"description": "Defined by `alignment` property of https://w3id.org/openbadges#BadgeClass"
},
"tags": {
"$ref": "#/definitions/TagsArray",
"description": "Defined by `tags` property of https://w3id.org/openbadges#BadgeClass"
},
"signatureLines": {
"anyOf": [
{
"$ref": "#/definitions/SignatureLine"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/SignatureLine"
}
}
],
"description": "Blockcerts extension: array of signature lines for display."
}
},
"required": [
"name",
"description",
"image",
"issuer"
]
},
"Profile": {
"description": "Defined by https://w3id.org/openbadges#Profile. This type is used in certificates, and in the issuer-hosted identification page. The minimal set of properties required in the certificate are `id` and `type`. In this case, additional issuer-identification properties are assumed to be available at the issuer-hosted identification page.",
"properties": {
"id": {
"type": "string",
"format": "uri",
"description": "Defined by `id` property of https://w3id.org/openbadges#Profile"
},
"type": {
"$ref": "#/definitions/JsonLdType",
"description": "Defined by `type` property of https://w3id.org/openbadges#Profile"
},
"name": {
"type": "string",
"description": "Defined by `name` property of https://w3id.org/openbadges#Profile"
},
"url": {
"type": "string",
"format": "uri",
"description": "Defined by `url` property of https://w3id.org/openbadges#Profile"
},
"telephone": {
"type": "string",
"description": "Defined by `telephone` property of https://w3id.org/openbadges#Profile"
},
"description": {
"type": "string",
"description": "Defined by `description` property of https://w3id.org/openbadges#Profile"
},
"image": {
"$ref": "#/definitions/ImageUri",
"description": "Defined by `image` property of https://w3id.org/openbadges#Profile"
},
"email": {
"type": "string",
"description": "Defined by `email` property of https://w3id.org/openbadges#Profile"
},
"revocationList": {
"anyOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "null"
}
],
"description": "Defined by `revocationList` property of https://w3id.org/openbadges#Profile. If embedded in a Blockcert and the issuer-hosted Profile, the value in the Blockcert should take preference."
}
},
"required": [
"id",
"type"
]
}
},
"properties": {
"id": {
"description": "Defined by `id` property in https://w3id.org/openbadges#Assertion. This may be an HTTP IRI, but only if the issuer plans to host the assertions on a long-term basis, or (at least) until their expiration. Otherwise it is recommended to use a `urn:uuid:<UUID>`-formatted IRI.",
"type": "string",
"anyOf": [
{
"type": "string",
"pattern": "^urn:uuid:"
},
{
"type": "string",
"format": "uri"
}
]
},
"type": {
"$ref": "#/definitions/JsonLdType",
"description": "Defined by `type` property of https://w3id.org/openbadges#Assertion"
},
"recipient": {
"$ref": "#/definitions/IdentityObject",
"description": "Defined by `recipient` property of https://w3id.org/openbadges#Assertion, with Blockcerts extensions for recipient proof of ownership."
},
"badge": {
"$ref": "#/definitions/BadgeClass",
"description": "Defined by `badge` property of https://w3id.org/openbadges#Assertion, with Blockcerts extensions for (display) signature images."
},
"verification": {
"$ref": "#/definitions/VerificationObject",
"description": "Defined by `verification` property of https://w3id.org/openbadges#Assertion, with Blockcerts extensions for verification of badges on a blockchain."
},
"issuedOn": {
"$ref": "#/definitions/DateTime",
"description": "Defined by `issuedOn` property of https://w3id.org/openbadges#Assertion"
},
"image": {
"$ref": "#/definitions/ImageUri",
"description": "Defined by `image` property of https://w3id.org/openbadges#Assertion"
},
"evidence": {
"type": "string",
"format": "uri",
"description": "Defined by `evidence` property of https://w3id.org/openbadges#Assertion"
},
"narrative": {
"type": "string",
"description": "Defined by `narrative` property of https://w3id.org/openbadges#Assertion"
},
"expires": {
"$ref": "#/definitions/DateTime",
"description": "Defined by `expires` property of https://w3id.org/openbadges#Assertion"
},
"signature": {
"ref": "#/definitions/MerkleProof2017"
}
},
"required": [
"id",
"type",
"recipient",
"badge",
"verification",
"issuedOn"
],
"additionalProperties": true
}