Skip to content

Commit

Permalink
Constant for AuthBJJ credential type added (#101)
Browse files Browse the repository at this point in the history
* Constant for AuthBJJ credential json schema
* Constant AuthBJJ json schema and json-ld context
* Embedded Auth BJJ json and ls schemas
  • Loading branch information
demonsh authored Dec 17, 2024
1 parent f27ac93 commit 602d60b
Show file tree
Hide file tree
Showing 2 changed files with 231 additions and 1 deletion.
7 changes: 6 additions & 1 deletion verifiable/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
225 changes: 225 additions & 0 deletions verifiable/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
}]
}`
)

0 comments on commit 602d60b

Please sign in to comment.