Skip to content

Commit 602d60b

Browse files
authored
Constant for AuthBJJ credential type added (#101)
* Constant for AuthBJJ credential json schema * Constant AuthBJJ json schema and json-ld context * Embedded Auth BJJ json and ls schemas
1 parent f27ac93 commit 602d60b

File tree

2 files changed

+231
-1
lines changed

2 files changed

+231
-1
lines changed

verifiable/constants.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ const (
1212
// JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type
1313
JSONLDSchemaW3CCredential2018 = "https://www.w3.org/2018/credentials/v1"
1414

15-
// JSONLDSchemaW3CCredential2020 is a schema for context with Display method type
15+
// JSONLDSchemaIden3DisplayMethod is a schema for context with Display method type
1616
JSONLDSchemaIden3DisplayMethod = "https://schema.iden3.io/core/jsonld/displayMethod.jsonld"
1717

18+
// JSONLDSchemaIden3AuthBJJCredential is a schema for context with AuthBJJCredential type
19+
JSONLDSchemaIden3AuthBJJCredential = "https://schema.iden3.io/core/jsonld/auth.jsonld"
20+
21+
JSONSchemaIden3AuthBJJCredential = "https://schema.iden3.io/core/json/auth.json"
22+
1823
// SparseMerkleTreeProof is CredentialStatusType for standard MTP result handlers
1924
SparseMerkleTreeProof CredentialStatusType = "SparseMerkleTreeProof"
2025

verifiable/schema.go

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,229 @@ const (
245245
"id"
246246
]
247247
}`
248+
249+
// AuthBJJJsonSchema is a basic schema of auth BJJ
250+
AuthBJJJsonSchema = `{
251+
"$schema": "http://json-schema.org/draft-07/schema#",
252+
"$metadata": {
253+
"uris": {
254+
"jsonLdContext": "https://schema.iden3.io/core/jsonld/auth.jsonld",
255+
"jsonSchema": "https://schema.iden3.io/core/json/auth.json"
256+
}
257+
},
258+
"type": "object",
259+
"required": [
260+
"@context",
261+
"id",
262+
"type",
263+
"issuanceDate",
264+
"credentialSubject",
265+
"credentialSchema",
266+
"credentialStatus",
267+
"issuer"
268+
],
269+
"properties": {
270+
"@context": {
271+
"type": [
272+
"string",
273+
"array",
274+
"object"
275+
]
276+
},
277+
"id": {
278+
"type": "string"
279+
},
280+
"type": {
281+
"type": [
282+
"string",
283+
"array"
284+
],
285+
"items": {
286+
"type": "string"
287+
}
288+
},
289+
"issuer": {
290+
"type": [
291+
"string",
292+
"object"
293+
],
294+
"format": "uri",
295+
"required": [
296+
"id"
297+
],
298+
"properties": {
299+
"id": {
300+
"type": "string",
301+
"format": "uri"
302+
}
303+
}
304+
},
305+
"issuanceDate": {
306+
"type": "string",
307+
"format": "date-time"
308+
},
309+
"expirationDate": {
310+
"type": "string",
311+
"format": "date-time"
312+
},
313+
"credentialSchema": {
314+
"type": "object",
315+
"required": [
316+
"id",
317+
"type"
318+
],
319+
"properties": {
320+
"id": {
321+
"type": "string",
322+
"format": "uri"
323+
},
324+
"type": {
325+
"type": "string"
326+
}
327+
}
328+
},
329+
"credentialSubject": {
330+
"type": "object",
331+
"required": [
332+
"x",
333+
"y"
334+
],
335+
"properties": {
336+
"id": {
337+
"title": "Credential Subject ID",
338+
"type": "string",
339+
"format": "uri"
340+
},
341+
"x": {
342+
"type": "string"
343+
},
344+
"y": {
345+
"type": "string"
346+
}
347+
}
348+
}
349+
}
350+
}`
351+
352+
// AuthBJJJsonLDSchema is a JSON-LD schema of auth BJJ
353+
AuthBJJJsonLDSchema = `{
354+
"@context": [{
355+
"@version": 1.1,
356+
"@protected": true,
357+
"id": "@id",
358+
"type": "@type",
359+
"AuthBJJCredential": {
360+
"@id": "https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential",
361+
"@context": {
362+
"@version": 1.1,
363+
"@protected": true,
364+
"id": "@id",
365+
"type": "@type",
366+
"iden3_serialization": "iden3:v1:slotIndexA=x&slotIndexB=y",
367+
"xsd": "http://www.w3.org/2001/XMLSchema#",
368+
"auth-vocab": "https://schema.iden3.io/core/vocab/auth.md#",
369+
"x": {
370+
"@id": "auth-vocab:x",
371+
"@type": "xsd:positiveInteger"
372+
},
373+
"y": {
374+
"@id": "auth-vocab:y",
375+
"@type": "xsd:positiveInteger"
376+
}
377+
}
378+
},
379+
"Iden3StateInfo2023": {
380+
"@id": "https://schema.iden3.io/core/jsonld/auth.jsonld#Iden3StateInfo2023",
381+
"@context": {
382+
"@version": 1.1,
383+
"@protected": true,
384+
"id": "@id",
385+
"type": "@type",
386+
"xsd": "http://www.w3.org/2001/XMLSchema#",
387+
"@vocab": "https://schema.iden3.io/core/vocab/state-info.md#",
388+
"@propagate": true,
389+
"stateContractAddress": {
390+
"@id": "stateContractAddress",
391+
"@type": "xsd:string"
392+
},
393+
"published": {
394+
"@id": "published",
395+
"@type": "xsd:boolean"
396+
},
397+
"info": {
398+
"@id": "info",
399+
"@type": "@id",
400+
"@context": {
401+
"@protected": true,
402+
"id": {
403+
"@id": "id",
404+
"@type": "xsd:string"
405+
},
406+
"state": {
407+
"@id": "state",
408+
"@type": "xsd:string"
409+
},
410+
"replacedByState": {
411+
"@id": "replacedByState",
412+
"@type": "xsd:string"
413+
},
414+
"createdAtTimestamp": {
415+
"@id": "createdAtTimestamp",
416+
"@type": "xsd:string"
417+
},
418+
"replacedAtTimestamp": {
419+
"@id": "replacedAtTimestamp",
420+
"@type": "xsd:string"
421+
},
422+
"createdAtBlock": {
423+
"@id": "createdAtBlock",
424+
"@type": "xsd:string"
425+
},
426+
"replacedAtBlock": {
427+
"@id": "replacedAtBlock",
428+
"@type": "xsd:string"
429+
}
430+
}
431+
},
432+
"global": {
433+
"@id": "global",
434+
"@type": "@id",
435+
"@context": {
436+
"@protected": true,
437+
"sec": "https://w3id.org/security#",
438+
"root": {
439+
"@id": "root",
440+
"@type": "xsd:string"
441+
},
442+
"replacedByRoot": {
443+
"@id": "replacedByRoot",
444+
"@type": "xsd:string"
445+
},
446+
"createdAtTimestamp": {
447+
"@id": "createdAtTimestamp",
448+
"@type": "xsd:string"
449+
},
450+
"replacedAtTimestamp": {
451+
"@id": "replacedAtTimestamp",
452+
"@type": "xsd:string"
453+
},
454+
"createdAtBlock": {
455+
"@id": "createdAtBlock",
456+
"@type": "xsd:string"
457+
},
458+
"replacedAtBlock": {
459+
"@id": "replacedAtBlock",
460+
"@type": "xsd:string"
461+
},
462+
"proof": {
463+
"@id": "sec:proof",
464+
"@type": "@id",
465+
"@container": "@graph"
466+
}
467+
}
468+
}
469+
}
470+
}
471+
}]
472+
}`
248473
)

0 commit comments

Comments
 (0)