@@ -5256,15 +5256,17 @@ <h3>Fitness for Purpose</h3>
5256
5256
</ section >
5257
5257
5258
5258
< section class ="appendix informative ">
5259
- < h2 > Base Context </ h2 >
5259
+ < h2 > Contexts, Types, and Credential Schemas </ h2 >
5260
5260
5261
- < p >
5261
+ < section class ="informative ">
5262
+ < h3 > Base Context</ h3 >
5263
+ < p >
5262
5264
The base context, located at
5263
5265
< code > https://www.w3.org/2018/credentials/v1</ code > with a SHA-256 digest of
5264
5266
< strong > < code > ab4ddd9a531758807a79a5b450510d61ae8d147eab966cc9a200c07095b0cdcc</ code > </ strong > ,
5265
5267
can be used to implement a local cached copy. For convenience, the base context
5266
5268
is also provided in this section.
5267
- </ p >
5269
+ </ p >
5268
5270
5269
5271
< pre class ="informative ">
5270
5272
{
@@ -5505,7 +5507,108 @@ <h2>Base Context</h2>
5505
5507
}
5506
5508
}
5507
5509
</ pre >
5510
+ </ section >
5511
+
5512
+ < section class ="informative ">
5513
+ < h3 > Differences between Contexts, Types, and CredentialSchemas</ h3 >
5514
+
5515
+ < p >
5516
+ The < a > verifiable credential</ a > and < a > verifiable presentation</ a > data models
5517
+ leverage a variety of underlying technologies including [[JSON-LD]] and
5518
+ [[JSON-SCHEMA-2018]]. This section will provide a comparison of the
5519
+ < code > @context</ code > , < code > type</ code > , and < code > credentialSchema</ code >
5520
+ properties, and cover some of the more specific use cases where it is possible
5521
+ to use these features of the data model.
5522
+ </ p >
5523
+
5524
+ < p >
5525
+ The < code > type</ code > property is used to uniquely identify
5526
+ the type of the < a > verifiable credential</ a > in which it appears, i.e., to
5527
+ indicate which set of claims the < a > verifiable credential</ a > contains.
5528
+ This property, and the value < code > VerifiableCredential</ code > within the set of
5529
+ its values, are mandatory. Whilst it is good practice to include one additional
5530
+ value depicting the unique subtype of this < a > verifiable credential</ a > , it is permitted
5531
+ to either omit or include additional type values in the array. Many
5532
+ verifiers will request a < a > verifiable credential</ a > of a specific subtype, then
5533
+ omitting the subtype value could make it more difficult for verifiers to inform
5534
+ the holder which < a > verifiable credential</ a > they require. When a < a > verifiable
5535
+ credential</ a > has multiple subtypes, listing all of them in the < code > type</ code >
5536
+ property is sensible. While the semantics are the same in both a [[JSON]] and
5537
+ [[JSON-LD]] representation, the usage of the < code > type</ code > property in a
5538
+ [[JSON-LD]] representation of a < a > verifiable credential</ a > is able to enforce the semantics of the
5539
+ < a > verifiable credential</ a > better than a [[JSON]] representation of the same
5540
+ credential because the machine is able to check the semantics. With [[JSON-LD]],
5541
+ the technology is not only describing the categorization of the set of claims,
5542
+ the technology is also conveying the structure and semantics of the sub-graph of
5543
+ the properties in the graph. In [[JSON-LD]], this represents the type of the node
5544
+ in the graph which is why some [[JSON-LD]] representations of a < a > verifiable
5545
+ credential</ a > will use the < code > type</ code > property on many objects in the
5546
+ < a > verifiable credential</ a > .
5547
+ </ p >
5548
+
5549
+ < p >
5550
+ The primary purpose of the < code > @context</ code > property, from a [[JSON-LD]]
5551
+ perspective, is to convey the meaning of the data and term definitions of the
5552
+ data in a < a > verifiable credential</ a > , in a machine readable way. When encoding a pure
5553
+ [[JSON]] representation, the < code > @context</ code > property remains mandatory and
5554
+ provides some basic support for global semantics. The < code > @context</ code >
5555
+ property is used to map the globally unique URIs for properties in < a > verifiable
5556
+ credentials</ a > and < a > verifiable presentations</ a > into short-form alias names,
5557
+ making both the [[JSON]] and [[JSON-LD]] representations more human-friendly
5558
+ to read. From a [[JSON-LD]] perspective, this mapping also allows the data in
5559
+ a < a > credential</ a > to be modeled in a network of machine-readable data, by
5560
+ enhancing how the data in the < a > verifiable credential</ a > or < a > verifiable
5561
+ presentation</ a > relates to a larger machine-readable data graph. This is
5562
+ useful for telling machines how to relate the meaning of data to
5563
+ other data in an ecosystem where parties are unable to coordinate. This
5564
+ property, with the first value in the set being
5565
+ < code > https://www.w3.org/2018/credentials/v1</ code > , is mandatory.
5566
+ </ p >
5567
+
5568
+ < p >
5569
+ Since the < code > @context</ code > property is used to map data to a graph
5570
+ data model, and the < code > type</ code > property in [[JSON-LD]] is used to
5571
+ describe nodes within the graph, the < code > type</ code > property becomes
5572
+ even more important when using the two properties in combination. For example,
5573
+ if the < code > type</ code > property is not included within the resolved
5574
+ < code > @context</ code > resource using [[JSON-LD]], it could lead to claims being
5575
+ dropped and/or their integrity no longer being protected during production and
5576
+ consumption of the < a > verifiable credential</ a > . Alternatively, it could lead to
5577
+ errors being raised during production or consumption of a < a > verifiable
5578
+ credential</ a > . This will depend on the design choices of the implementation and
5579
+ both paths are used in implementations today, so it's important to pay attention
5580
+ to these properties when using a [[JSON-LD]] representation of a < a > verifiable
5581
+ credential</ a > or < a > verifiable presentation</ a > .
5582
+ </ p >
5583
+
5584
+ < p >
5585
+ The primary purpose of the < code > credentialSchema</ code > property is to
5586
+ define the structure of the < a > verifiable credential</ a > , and the datatypes for
5587
+ the values of each property that appears. A < code > credentialSchema</ code > is useful
5588
+ for defining the contents and structure of a set of claims in a < a > verifiable
5589
+ credential</ a > , whereas [[JSON-LD]] and a < code > @context</ code > in a < a > verifiable
5590
+ credential</ a > are best used only for conveying the semantics and term
5591
+ definitions of the data, and can be used to define the structure of the
5592
+ < a > verifiable credential</ a > as well.
5593
+ </ p >
5594
+
5595
+ < p >
5596
+ While it is possible to use some [[JSON-LD]] features to allude to the
5597
+ contents of the < a > verifiable credential</ a > , it's not generally
5598
+ suggested to use < code > @context</ code > to constrain the data types of the
5599
+ data model. For example, < code > "@type": "@json"</ code > is useful for leaving the
5600
+ semantics open-ended and not strictly defined. This can be dangerous if
5601
+ the implementer is looking to constrain the data type of the claims in the
5602
+ < a > credential</ a > , and is expected not to be used.
5603
+ </ p >
5508
5604
5605
+ < p >
5606
+ When the < code > credentialSchema</ code > and < code > @context</ code > properties
5607
+ are used in combination, both producers and consumers can be more confident
5608
+ about the expected contents and data types of the < a > verifiable credential</ a >
5609
+ and < a > verifiable presentation</ a > .
5610
+ </ p >
5611
+ </ section >
5509
5612
</ section >
5510
5613
5511
5614
< section class ="informative appendix ">
0 commit comments