diff --git a/verifiable/constants.go b/verifiable/constants.go index 9ed489e..5b818c2 100644 --- a/verifiable/constants.go +++ b/verifiable/constants.go @@ -12,9 +12,14 @@ const ( // JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type JSONLDSchemaW3CCredential2018 = "https://www.w3.org/2018/credentials/v1" - // JSONLDSchemaW3CCredential2020 is a schema for context with Display method type + // JSONLDSchemaIden3DisplayMethod is a schema for context with Display method type JSONLDSchemaIden3DisplayMethod = "https://schema.iden3.io/core/jsonld/displayMethod.jsonld" + // JSONLDSchemaIden3AuthBJJCredential is a schema for context with AuthBJJCredential type + JSONLDSchemaIden3AuthBJJCredential = "https://schema.iden3.io/core/jsonld/auth.jsonld" + + JSONSchemaIden3AuthBJJCredential = "https://schema.iden3.io/core/json/auth.json" + // SparseMerkleTreeProof is CredentialStatusType for standard MTP result handlers SparseMerkleTreeProof CredentialStatusType = "SparseMerkleTreeProof" diff --git a/verifiable/schema.go b/verifiable/schema.go index 5f88e05..d5a3ce3 100644 --- a/verifiable/schema.go +++ b/verifiable/schema.go @@ -245,4 +245,229 @@ const ( "id" ] }` + + // AuthBJJJsonSchema is a basic schema of auth BJJ + AuthBJJJsonSchema = `{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$metadata": { + "uris": { + "jsonLdContext": "https://schema.iden3.io/core/jsonld/auth.jsonld", + "jsonSchema": "https://schema.iden3.io/core/json/auth.json" + } + }, + "type": "object", + "required": [ + "@context", + "id", + "type", + "issuanceDate", + "credentialSubject", + "credentialSchema", + "credentialStatus", + "issuer" + ], + "properties": { + "@context": { + "type": [ + "string", + "array", + "object" + ] + }, + "id": { + "type": "string" + }, + "type": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + }, + "issuer": { + "type": [ + "string", + "object" + ], + "format": "uri", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "format": "uri" + } + } + }, + "issuanceDate": { + "type": "string", + "format": "date-time" + }, + "expirationDate": { + "type": "string", + "format": "date-time" + }, + "credentialSchema": { + "type": "object", + "required": [ + "id", + "type" + ], + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "type": { + "type": "string" + } + } + }, + "credentialSubject": { + "type": "object", + "required": [ + "x", + "y" + ], + "properties": { + "id": { + "title": "Credential Subject ID", + "type": "string", + "format": "uri" + }, + "x": { + "type": "string" + }, + "y": { + "type": "string" + } + } + } + } +}` + + // AuthBJJJsonLDSchema is a JSON-LD schema of auth BJJ + AuthBJJJsonLDSchema = `{ + "@context": [{ + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "AuthBJJCredential": { + "@id": "https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "iden3_serialization": "iden3:v1:slotIndexA=x&slotIndexB=y", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "auth-vocab": "https://schema.iden3.io/core/vocab/auth.md#", + "x": { + "@id": "auth-vocab:x", + "@type": "xsd:positiveInteger" + }, + "y": { + "@id": "auth-vocab:y", + "@type": "xsd:positiveInteger" + } + } + }, + "Iden3StateInfo2023": { + "@id": "https://schema.iden3.io/core/jsonld/auth.jsonld#Iden3StateInfo2023", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "@vocab": "https://schema.iden3.io/core/vocab/state-info.md#", + "@propagate": true, + "stateContractAddress": { + "@id": "stateContractAddress", + "@type": "xsd:string" + }, + "published": { + "@id": "published", + "@type": "xsd:boolean" + }, + "info": { + "@id": "info", + "@type": "@id", + "@context": { + "@protected": true, + "id": { + "@id": "id", + "@type": "xsd:string" + }, + "state": { + "@id": "state", + "@type": "xsd:string" + }, + "replacedByState": { + "@id": "replacedByState", + "@type": "xsd:string" + }, + "createdAtTimestamp": { + "@id": "createdAtTimestamp", + "@type": "xsd:string" + }, + "replacedAtTimestamp": { + "@id": "replacedAtTimestamp", + "@type": "xsd:string" + }, + "createdAtBlock": { + "@id": "createdAtBlock", + "@type": "xsd:string" + }, + "replacedAtBlock": { + "@id": "replacedAtBlock", + "@type": "xsd:string" + } + } + }, + "global": { + "@id": "global", + "@type": "@id", + "@context": { + "@protected": true, + "sec": "https://w3id.org/security#", + "root": { + "@id": "root", + "@type": "xsd:string" + }, + "replacedByRoot": { + "@id": "replacedByRoot", + "@type": "xsd:string" + }, + "createdAtTimestamp": { + "@id": "createdAtTimestamp", + "@type": "xsd:string" + }, + "replacedAtTimestamp": { + "@id": "replacedAtTimestamp", + "@type": "xsd:string" + }, + "createdAtBlock": { + "@id": "createdAtBlock", + "@type": "xsd:string" + }, + "replacedAtBlock": { + "@id": "replacedAtBlock", + "@type": "xsd:string" + }, + "proof": { + "@id": "sec:proof", + "@type": "@id", + "@container": "@graph" + } + } + } + } + } + }] +}` )