From dee980fbc6a525ab491cceb056eefd50ec073cf5 Mon Sep 17 00:00:00 2001 From: Dmytro Sukhyi Date: Sat, 14 Dec 2024 19:05:26 +0000 Subject: [PATCH 1/4] Constant for AuthBJJ credential type added --- verifiable/constants.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/verifiable/constants.go b/verifiable/constants.go index 9ed489e..bc09da0 100644 --- a/verifiable/constants.go +++ b/verifiable/constants.go @@ -15,6 +15,9 @@ const ( // JSONLDSchemaW3CCredential2020 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" + // SparseMerkleTreeProof is CredentialStatusType for standard MTP result handlers SparseMerkleTreeProof CredentialStatusType = "SparseMerkleTreeProof" From 5a854d32d82d6dbe0d1b57e9756e174a4bbb79d9 Mon Sep 17 00:00:00 2001 From: Dmytro Sukhyi Date: Tue, 17 Dec 2024 10:25:32 +0000 Subject: [PATCH 2/4] Constant for AuthBJJ credential json schema --- verifiable/constants.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/verifiable/constants.go b/verifiable/constants.go index bc09da0..5b818c2 100644 --- a/verifiable/constants.go +++ b/verifiable/constants.go @@ -12,12 +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" From 3418d86ed8fac24b3e29608bd7cea575526db06b Mon Sep 17 00:00:00 2001 From: Dmytro Sukhyi Date: Tue, 17 Dec 2024 10:48:10 +0000 Subject: [PATCH 3/4] Constant AuthBJJ json schema and json-ld context --- verifiable/schema.go | 229 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) diff --git a/verifiable/schema.go b/verifiable/schema.go index 5f88e05..f667ecd 100644 --- a/verifiable/schema.go +++ b/verifiable/schema.go @@ -245,4 +245,233 @@ 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" + }, + "serialization": { + "indexDataSlotA": "x", + "indexDataSlotB": "y" + } + }, + "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" + } + } + } + } + } + }] +}` ) From b381cc966b7f7c4f6f18a1df40748321b4147b4a Mon Sep 17 00:00:00 2001 From: Dmytro Sukhyi Date: Tue, 17 Dec 2024 13:42:04 +0000 Subject: [PATCH 4/4] Update AuthBJJ json schema --- verifiable/schema.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/verifiable/schema.go b/verifiable/schema.go index f667ecd..d5a3ce3 100644 --- a/verifiable/schema.go +++ b/verifiable/schema.go @@ -253,10 +253,6 @@ const ( "uris": { "jsonLdContext": "https://schema.iden3.io/core/jsonld/auth.jsonld", "jsonSchema": "https://schema.iden3.io/core/json/auth.json" - }, - "serialization": { - "indexDataSlotA": "x", - "indexDataSlotB": "y" } }, "type": "object",