-
Notifications
You must be signed in to change notification settings - Fork 112
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
Clarification of JWT encoding #828
Changes from all commits
b6c8bb0
1e877b7
9b74b45
4474a31
0b066bb
10a417d
6bc9b2e
1669a14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3490,12 +3490,12 @@ <h4>JSON Web Token Extensions</h4> | |||||
<li> | ||||||
<code>vc</code>: JSON object, which MUST be present in a JWT | ||||||
<a>verifiable credential</a>. The object contains the | ||||||
<a>verifiable credential</a> according to this specification. | ||||||
<a>credential</a> according to this specification. | ||||||
</li> | ||||||
<li> | ||||||
<code>vp</code>: JSON object, which MUST be present in a JWT | ||||||
<a>verifiable presentation</a>. The object contains the | ||||||
<a>verifiable presentation</a> according to this specification. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change should be accepted for the reasons I gave in https://github.com/w3c/vc-data-model/pull/828/files#r753698782 |
||||||
<a>presentation</a> according to this specification. | ||||||
</li> | ||||||
</ul> | ||||||
</section> | ||||||
|
@@ -3525,19 +3525,19 @@ <h5>JWT Encoding</h5> | |||||
|
||||||
<p> | ||||||
If no explicit rule is specified, <a>properties</a> are encoded in the same way | ||||||
as with a standard <a>verifiable credential</a>, and are added to the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change should be accepted for the reasons I gave in https://github.com/w3c/vc-data-model/pull/828/files#r753698782 |
||||||
<code>vc</code> JWT <a>claim</a>. As with all JWTs, the JWS-based | ||||||
as with a standard <a>credential</a>, and are added to the | ||||||
<code>vc</code> <a>claim</a> of the JWT. As with all JWTs, the JWS-based | ||||||
signature of a <a>verifiable credential</a> represented in the JWT syntax is | ||||||
calculated against the literal JWT string value as presented across the wire, | ||||||
before any decoding or transformation rules are applied. The following | ||||||
paragraphs describe these encoding rules. | ||||||
</p> | ||||||
|
||||||
<p> | ||||||
If a JWS is present, the digital signature either refers to the <a>issuer</a> | ||||||
If a JWS is present, the digital signature refers either to the <a>issuer</a> | ||||||
of the <a>verifiable credential</a>, or in the case of a | ||||||
<a>verifiable presentation</a>, the <a>holder</a> of the | ||||||
<a>verifiable credential</a>. The JWS proves that the <a>issuer</a> of the JWT | ||||||
<a>verifiable presentation</a>, to the <a>holder</a> of the | ||||||
<a>verifiable credential</a>. The JWS proves that the <code>iss</code> of the JWT | ||||||
signed the contained JWT payload and therefore, the <code>proof</code> | ||||||
<a>property</a> can be omitted. | ||||||
David-Chadwick marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
</p> | ||||||
|
@@ -3576,8 +3576,8 @@ <h5>JWT Encoding</h5> | |||||
|
||||||
<p> | ||||||
For backward compatibility with JWT processors, the following registered JWT | ||||||
claim names MUST be used instead of, or in addition to, their respective | ||||||
David-Chadwick marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
standard <a>verifiable credential</a> counterparts: | ||||||
claim names MUST be used instead of, or in addition to, their respective standard | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @David-Chadwick -- You marked this resolved, and said that such marking meant you had applied my suggested change. This change was not applied. I am applying it now in a new PR. |
||||||
<a>verifiable credential</a> counterparts: | ||||||
</p> | ||||||
|
||||||
<ul> | ||||||
|
@@ -3600,7 +3600,9 @@ <h5>JWT Encoding</h5> | |||||
</li> | ||||||
<li> | ||||||
<code>sub</code> MUST represent the <code>id</code> <a>property</a> contained | ||||||
in the <a>verifiable credential</a> <a>subject</a>. | ||||||
in the <code>credentialSubject</code>. | ||||||
<p class="note">In <code>bearer credentials</code> and <code>presentations</code>, | ||||||
<code>sub</code> will not be present.</p> | ||||||
</li> | ||||||
<li> | ||||||
<code>aud</code> MUST represent (i.e., identify) the intended audience | ||||||
|
@@ -3649,7 +3651,7 @@ <h5>JWT Encoding</h5> | |||||
<h5>JWT Decoding</h5> | ||||||
|
||||||
<p> | ||||||
To decode a JWT to a standard <a>verifiable credential</a>, the following | ||||||
To decode a JWT to a standard <a>credential</a> or <a>presentation</a>, the following | ||||||
transformation MUST be performed: | ||||||
</p> | ||||||
|
||||||
|
@@ -3658,11 +3660,11 @@ <h5>JWT Decoding</h5> | |||||
Create a JSON object. | ||||||
</li> | ||||||
<li> | ||||||
Add the content from the <code>vc</code> <a>claim</a> to the new JSON object. | ||||||
Add the content from the <code>vc</code> or <code>vp</code> <a>claim</a> to the new JSON object. | ||||||
</li> | ||||||
<li> | ||||||
Transform the remaining JWT specific headers and <a>claims</a>, and add the | ||||||
results to the new JSON object. | ||||||
results to the new <a>credential</a> or <a>presentation</a> JSON object. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is so great to see! I wonder if we might fully define these transformation functions, I would like to see them made explicit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OR13 -- I suggest creating a new issue "to see [these transformation functions] made explicit". |
||||||
</li> | ||||||
</ol> | ||||||
|
||||||
|
@@ -3680,8 +3682,8 @@ <h5>JWT Decoding</h5> | |||||
</li> | ||||||
<li> | ||||||
If <code>iss</code> is present, the value MUST be used to set the | ||||||
<code>issuer</code> <a>property</a> of the new verifiable credential JSON object | ||||||
or the <code>holder</code> <a>property</a> of the new verifiable presentation JSON object. | ||||||
<code>issuer</code> <a>property</a> of the new <a>credential</a> JSON object | ||||||
or the <code>holder</code> <a>property</a> of the new <a>presentation</a> JSON object. | ||||||
</li> | ||||||
<li> | ||||||
If <code>nbf</code> is present, the UNIX timestamp MUST be converted to an | ||||||
|
@@ -3691,7 +3693,7 @@ <h5>JWT Decoding</h5> | |||||
</li> | ||||||
<li> | ||||||
If <code>sub</code> is present, the value MUST be used to set the value of the | ||||||
<code>id</code> <a>property</a> of <code>credentialSubject</code> of the new | ||||||
<code>id</code> <a>property</a> of <code>credentialSubject</code> of the new <a>credential</a> | ||||||
JSON object. | ||||||
</li> | ||||||
<li> | ||||||
|
@@ -3745,7 +3747,7 @@ <h5>JWT Decoding</h5> | |||||
<a>property</a> because the JWT encoding uses the <code>jti</code> | ||||||
attribute to represent a unique identifier. The <code>sub</code> attribute | ||||||
encodes the information represented by the <code>id</code> <a>property</a> of | ||||||
<code>credentialSubject</code>. | ||||||
<code>credentialSubject</code>. The <code>nonce</code> has been added to stop a replay attack. | ||||||
</p> | ||||||
|
||||||
<pre class="example nohighlight" title="Verifiable credential using JWT compact serialization (non-normative)"> | ||||||
|
@@ -3807,7 +3809,8 @@ <h5>JWT Decoding</h5> | |||||
<a>property</a> because the JWT encoding uses the <code>jti</code> | ||||||
attribute to represent a unique identifier. <code>verifiableCredential</code> | ||||||
contains a string array of <a>verifiable credentials</a> using | ||||||
JWT compact serialization. | ||||||
<code>JWT</code> compact serialization. The <code>nonce</code> has been added | ||||||
to stop a replay attack. | ||||||
</p> | ||||||
|
||||||
<pre class="example nohighlight" title="Verifiable presentation using JWT compact serialization (non-normative)"> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify why a vast majority of the "verifiable" terms are being removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably because its not actually the same type... in JWT land, jwt.payload.vc.issuanceDate is maybe not required if the 'instead of' path is taken... leading to type ambiguity if the term
verifiable credential
is used to refer to thevc
payload... the jwt.payload.vc is in fact not verifiable... only the jwt (the outer container that includes it) make sit verifiable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is in line with the langauge we use as well:
credential: JSON with an
@context
that contains all required fields except forproof
-> issue ->
verifiable credential
<JWT or LD Proof>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if issuanceDate is a required attribute of a verifiable credential (thats what the spec says today)...then removing it destroys interoperability and conformance.... calling the thing that might not have that property the same as the thing that has to have that property is problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and (removing
issuer
andissuanceDate
and all other JWT-encoded properties) was exactly this was suggested on the call yesterday, which tells me that the entire VC-JWT ecosystem is not interoperable today.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, this change should be accepted, since
vc
is obviously not averifiable credential
under the current normative text... its possibly also not acredential
under the current text, but this is a step in the right direction. We should not be standing in the way of a "more truthful" editorial refinement.