Skip to content

Add relatedResource and digestSRI to the vocabulary #1296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
.vscode
.idea
.gitignore
*.bkp

**/node_modules
**/.DS_Store
**/.vscode
**/package-lock.json
**/package-lock.json
12 changes: 12 additions & 0 deletions contexts/credentials/v2
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
"@id": "https://www.iana.org/assignments/jwt#..."
},

"digestSRI": {
"@id": "https://www.w3.org/2018/credentials#digestSRI",
"@type": "https://www.w3.org/2018/credentials#sriString"
},
"mediaType": {
"@id": "https://schema.org/encodingFormat"
},

Comment on lines +69 to +76
Copy link
Member

@msporny msporny Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do we want both of these as top-level values... or do we want them under relatedResource. I would imagine we'd want the latter? /cc @dlongley @davidlehn

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msporny I am open either way, I leave the decision to you guys.

My argument for this setup is that digestSRI might be useful elsewhere; there is nothing in the definition that is really bound to relatedResource. After all, this is a general mechanism. (Note that the domain of digestSRI is essentially open-ended, see also #1296 (comment)). But, again, I regard this as a VCDM domain issue, and I am not a VCDM expert, so to say...

"VerifiableCredential": {
"@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
"@context": {
Expand Down Expand Up @@ -149,6 +157,10 @@
"confidenceMethod": {
"@id": "https://www.w3.org/2018/credentials#confidenceMethod",
"@type": "@id"
},
"relatedResource": {
"@id": "https://www.w3.org/2018/credentials#relatedResource",
"@type": "@id"
}
}
},
Expand Down
52 changes: 50 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2972,7 +2972,7 @@ <h2>Integrity of Related Resources</h2>
<p>
To validate that a resource referenced by a <a>verifiable credential</a> is the
same at verification time as it is at issuing time, an implementer MAY include a
property named <code>relatedResource</code> that stores an array of objects that
property named <code id="defn-relatedResource">relatedResource</code> that stores an array of objects that
describe additional integrity metadata about each resource referenced by the
<a>verifiable credential</a>. If <code>relatedResource</code> is present, there
MUST be an object in the array for each remote resource for each context used in
Expand All @@ -2986,7 +2986,7 @@ <h2>Integrity of Related Resources</h2>
<p>
Each object in the <code>relatedResource</code> array MUST contain the
following: the [[URL]] to the resource named <code>id</code> and the
<code>digestSRI</code> information for the resource constructed using the method
<code id="defn-digestSRI">digestSRI</code> information for the resource constructed using the method
specified in <a href="https://www.w3.org/TR/SRI/#integrity-metadata">Subresource
Integrity</a>.
</p>
Expand Down Expand Up @@ -6173,6 +6173,54 @@ <h3>Vocabularies</h3>
</table>

</section>

<section>
<h3>Datatypes</h3>
<p>
This section defines datatypes that are used by this specification.
</p>

<section>
<h4>The <code>sriString</code> Datatype</h4>

<p>
The string provides the integrity information for a resource using the method specified in the [[SRI]] specification.
</p>

<p>
The `sriString` datatype is defined as follows:
</p>

<dl>
<dt>The URL denoting this datatype</dt>
<dd>
`https://www.w3.org/2018/credentials#sriString`
</dd>
<dt>The lexical space</dt>
<dd>
See the <a href="https://www.w3.org/TR/SRI/#the-integrity-attribute">ABNF grammar</a>, defining the `integrity`
attribute in the [[SRI]] specification, for the restrictions on the string format.
</dd>
<dt>The value space</dt>
<dd>
A (possibly empty) list of <i>(alg,val)</i> pairs, where <i>alg</i> identifies a hash function, and <i>val</i> is an integer as a standard mathematical concept.
</dd>
<dt>The lexical-to-value mapping</dt>
<dd>
Any element of the lexical space is mapped to the value space by
following the <a href="https://www.w3.org/TR/SRI/#parse-metadata">parse metadata algorithm</a> based
on the <a href="https://www.w3.org/TR/SRI/#the-integrity-attribute">ABNF grammar</a> in the [[SRI]] specification.
</dd>
<dt>The canonical mapping</dt>
<dd>
The canonical mapping consists of the lexical-to-value mapping.
</dd>
</dl>
</section>


</section>

<section class="informative">
<h3>Differences between Contexts, Types, and CredentialSchemas</h3>

Expand Down
6 changes: 5 additions & 1 deletion vocab/credentials/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ The generation of the final files is done via a github action (see `/.github/wor

- `Readme.md`: this file.
- `vocabulary.yml`: the core vocabulary specification. _Any change on the vocabulary must be made by modifying this file;_ see the separate [description](https://github.com/w3c/yml2vocab) of the underlying YAML format.
- `template.json`: an HTML template file used by the script; it is the skeleton of the final HTML format based on [ReSpec](https://respec.org/docs/). If the file is modified, care should be taken not to change the core structure and the various, possibly empty, HTML elements with `@id` values. The script fills those elements with content when generating the `vocabulary.html` file.
- `vocabulary.drawio`: the vocabulary diagram in the [draw.io](https://www.drawio.com/) format. _Any change on the vocabulary diagram must be made by modifying this file._

The corresponding application can be downloaded and used directly, or added to Google Docs. Note that, due to some bug in the software the exported SVG file must be ran through a [post-processing script](https://github.com/iherman/drawio-svg/), to be downloaded and run separately.
- `vocabulary.svg`: the SVG file for the vocabulary, generated from `vocabulary.drawio`.
- `template.json`: an HTML template file used by the script; it is the skeleton of the final HTML format based on [ReSpec](https://respec.org/docs/). If the file is modified, care should be taken not to change the core structure and the various, possibly empty, HTML elements with `@id` values. The script fills those elements with content when generating the `vocabulary.html` file (and removes any sections that remain empty after processing).

28 changes: 23 additions & 5 deletions vocab/credentials/v2/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const retval = content
.replace('<svg', '<svg aria-details="#vocabulary-diagram-alt" ')
.replace(/xlink:href/g, 'href')
.replace(/href="https:\/\/w3.org\/2018\/credentials\/#/g, 'href="#');
.replace(/href="https:\/\/www.w3.org\/2018\/credentials#/g, 'href="#');
return retval;
}

Expand Down Expand Up @@ -198,6 +198,10 @@ <h2>Class definitions</h2>
<h2>Property definitions</h2>
</section>

<section id="datatype_definitions" class="term_definitions">
<h2>Datatype definitions</h2>
</section>

<section id="individual_definitions" class="term_definitions">
<h2>Definitions for individuals</h2>
</section>
Expand All @@ -220,6 +224,10 @@ <h2>Reserved classes</h2>
<h2>Reserved properties</h2>
</section>

<section id="reserved_datatype_definitions" class="term_definitions">
<h2>Reserved datatype definitions</h2>
</section>

<section id="reserved_individual_definitions" class="term_definitions">
<h2>Reserved individuals</h2>
</section>
Expand All @@ -240,6 +248,10 @@ <h2>Deprecated classes</h2>
<h2>Deprecated properties</h2>
</section>

<section id="deprecated_property_definitions" class="term_definitions">
<h2>Deprecated properties</h2>
</section>

<section id="deprecated_individual_definitions" class="term_definitions">
<h2>Deprecated individuals</h2>
</section>
Expand Down Expand Up @@ -270,13 +282,14 @@ <h2>Diagram description</h2>
</p>
<p>
The "VerifiableCredential" ellipse is connected to the "credentialSchema", "credentialStatus",
"credentialSubject", "issuer", "evidence", "refreshService", "renderMethod", and "confidenceMethod"
boxes, through connecting lines styled as Domain Of.
"credentialSubject", "issuer", "relatedResource", "evidence", "refreshService", "renderMethod",
and "confidenceMethod" boxes, through connecting lines styled as Domain Of.
It is also connected to the crossing point circle with a similar connecting line,
styled as Domain Of.
The "VerifiablePresentation" ellipse is connected to the crossing point circle, as well as the "holder"
and "verifiableCredential" boxes, with a similar connecting line, styled as Domain Of.
The crossing point circle is connected to the "termsOfUse", "validFrom", and "validUntil" boxes with a connecting line styled as Domain Of.
The crossing point circle is connected to the "termsOfUse", "validFrom", and "validUntil" boxes with a
connecting line styled as Domain Of.
The "verifiableCredential" box is connected to the "VerifiableCredentialGraph" ellipse with a connecting
line styled as Range.
The "JsonSchemaCredential" ellipse is connected to the "VerifiableCredential" ellipse with a
Expand All @@ -292,13 +305,18 @@ <h2>Diagram description</h2>
connected to those Class ellipses, with connecting lines styled as Range.
</p>
<p>
Finally, the "CredentialSchema" ellipse is connected to one more ellipse, on the far right
The "CredentialSchema" ellipse is connected to one more ellipse, on the far right
side of the diagram, styled as Class and labeled as "JsonSchema", with a connecting line
styled as Superclass. This "JsonSchema" ellipse is also connected to a Property box
labeled as "jsonSchema", through a connector line styled as Domain Of. This "jsonSchema"
box is connected to a Datatype shape labeled as "rdf:JSON", with a connecting line
styled as Range.
</p>
<p>
Finally, on the lower far right side of the diagram, there is a separate Property box labeled as
"digestSRI", connected to a Datatype shape labeled as "sristring", with a connecting line
styled as Range.
</p>
</details>
</section>

Expand Down
Loading