Skip to content
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

Update algorithm for Verify Proof #64

Merged
merged 8 commits into from Oct 23, 2022
Merged

Update algorithm for Verify Proof #64

merged 8 commits into from Oct 23, 2022

Conversation

msporny
Copy link
Member

@msporny msporny commented Oct 17, 2022

This PR updates the algorithm used to verify proofs to align with the language used to generate proofs (now merged into main).

At present, both the proof generation and proof verification algorithms presume only a single proof. The algorithms will need to be updated to support proof sets and proof chains in a future PR.


Preview | Diff

@iherman
Copy link
Member

iherman commented Oct 17, 2022

A minor comment, though not strictly to §4.2: do we have to say somewhere what "raise XYZ ERROR" means (e.g., in 2.1), or do we intend to leave it at that and leave it to the implementations?

Copy link
Member

@iherman iherman left a comment

Choose a reason for hiding this comment

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

There is an inconsistency in the value references. $4.2/(2) uses "dotted" term references like proof.type, proof.verificationMethod, etc. However, §4.1/(5) uses references to the same terms without the "dotted" formalism. (I did not check all items, there may be such discrepancies elsewhere, too.) Even §4.2 is not fully consistent; shouldn't (5) and (6) say proof.cryptosuite rather than "the cryptosuite specified in proof"?

Technically, it is not clear to me where the parameters like options come from. Or is this the ISSUE right after the algorithm (that only refers to verificationMethod)?

@TallTed
Copy link
Member

TallTed commented Oct 17, 2022

I would reword your original comment slightly, from algorithms only presume a single proof to algorithms presume only a single proof.

Copy link
Member

@TallTed TallTed left a comment

Choose a reason for hiding this comment

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

Some minor rephrasing

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
Copy link
Contributor

@dlongley dlongley left a comment

Choose a reason for hiding this comment

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

Thanks! Approving to keep things moving, but see suggestions (and +1 to @TallTed's suggestions).

index.html Outdated
`MALFORMED_PROOF_ERROR` MUST be raised.
</li>
<li>
If the cryptographic suite does not support unlinkability and the
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we just want to say "if the cryptographic suite requires proof.created" rather than make it hinge on the unlinkability property.

index.html Outdated
Comment on lines 1716 to 1735
<var>proof</var>.<var>created</var> value is not set, a `MALFORMED_PROOF_ERROR`
MUST be raised.
Copy link
Contributor

Choose a reason for hiding this comment

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

This error description is fine for now -- but we will want to see if we can improve / draw from other specs for better error patterns and error type / code reuse.

index.html Outdated
<a href="#dfn-transformation">transforming</a> <var>unsecuredDocument</var>
according to a <a>transformation algorithm</a> associated with the
<var>cryptosuite</var> specified in <var>proof</var> and the <var>options</var>
parameters provided as inputs to the algorithm.
Copy link
Contributor

@dlongley dlongley Oct 17, 2022

Choose a reason for hiding this comment

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

Can we say how the cryptosuite is specified, i.e., via type (and perhaps other cryptosuite type-specific properties)?

Suggested change
parameters provided as inputs to the algorithm.
parameters provided as inputs to the algorithm. Note: The <var>cryptosuite</var>
is specified by <var>proof.type</var> and MAY be further described by
cryptosuite-specific properties.

Seeing as the <var>cryptosuite</var> specified in <var>proof</var> is mentioned in other steps as well -- we might want the above language more generally expressed in an early step.

Copy link
Member Author

Choose a reason for hiding this comment

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

This presumes the cryptosuite property is in the proof, which it isn't for anything other than DataIntegrityProof... If it is, that'll have to be fixed. I'm also hesitating to clarify this in the body of the algorithm. I'll try to think about the best way to integrate this into this section and agree that we want to say something about cryptosuites being able to define other properties in a proof.

Copy link
Member Author

Choose a reason for hiding this comment

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

I misunderstood what you were going for the first time I read your comments. I've applied your note and clarified the thing that threw me off the first time in f0732e5.

index.html Outdated Show resolved Hide resolved
index.html Outdated
<li>
If the <var>proof</var>.<var>proofPurpose</var> value does not match
<var>options</var>.<var>proofPurpose</var>, a `MISMATCHED_PROOF_PURPOSE_ERROR`
MUST be raised.
Copy link
Contributor

Choose a reason for hiding this comment

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

This step should be run before any effort is made to verify the proof, i.e., the expected proof purpose should be checked first to find a matching proof. We might want the options name to be "expectedProofPurpose" as well, for clarity.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, will look into rewriting the algorithm in this way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in f3a3d2c.

index.html Outdated Show resolved Hide resolved
@iherman
Copy link
Member

iherman commented Oct 19, 2022

The issue was discussed in a meeting on 2022-10-19

  • no resolutions were taken
View the transcript

2.3. Update algorithm for Verify Proof (pr vc-data-integrity#64)

See github pull request vc-data-integrity#64.

Manu Sporny: this is just updating the language.

@msporny
Copy link
Member Author

msporny commented Oct 21, 2022

A minor comment, though not strictly to §4.2: do we have to say somewhere what "raise XYZ ERROR" means (e.g., in 2.1), or do we intend to leave it at that and leave it to the implementations?

Ultimately, it's up to the implementations to expose those errors. Exactly how each one does it is implementation specific at the moment. We might want to do something like what the JSON-LD API did, though some have complained about the use of text strings instead of error codes.

We do plan to expose those error types in protocols such as the VC API via a code field, but that's out of scope for this spec (probably). In short, we're still working things out. I'm trying to be consistent with the error codes so that when it comes time to expose them further up the software stack, people aren't caught off guard.

There is an inconsistency in the value references. $4.2/(2) uses "dotted" term references like proof.type, proof.verificationMethod, etc. However, §4.1/(5) uses references to the same terms without the "dotted" formalism. (I did not check all items, there may be such discrepancies elsewhere, too.) Even §4.2 is not fully consistent; shouldn't (5) and (6) say proof.cryptosuite rather than "the cryptosuite specified in proof"?

Yes, thanks for spotting that, it is an oversight and I'll fix that in an upcoming commit. I was going back and forth on the easiest way to mark up these variables.

Technically, it is not clear to me where the parameters like options come from. Or is this the ISSUE right after the algorithm (that only refers to verificationMethod)?

options is specified as an input to the algorithm in the opening paragraph. I'm still trying to figure out if the ReSpec var parameter approach is more helpful than harmful... I think it's helping, but the github preview doesn't show the markup, so it's difficult to see it without checking out the source and rendering the document locally. The var parameter highlights everywhere the variable is used, so in theory, you should be able to click on the word options and it will highlight everywhere the variable is used in the algorithm. In short, if you had a properly rendered document, this might have been easier to find for you (or I screwed up the markup and I'll fix it :P ).

index.html Outdated Show resolved Hide resolved
@msporny
Copy link
Member Author

msporny commented Oct 23, 2022

@iherman wrote:

There is an inconsistency in the value references. $4.2/(2) uses "dotted" term references like proof.type, proof.verificationMethod, etc. However, §4.1/(5) uses references to the same terms without the "dotted" formalism. (I did not check all items, there may be such discrepancies elsewhere, too.) Even §4.2 is not fully consistent; shouldn't (5) and (6) say proof.cryptosuite rather than "the cryptosuite specified in proof"?

Yes, thanks for spotting that, it is an oversight and I'll fix that in an upcoming commit. I was going back and forth on the easiest way to mark up these variables.

Fixed in 520a357.

@msporny
Copy link
Member Author

msporny commented Oct 23, 2022

Normative, multiple reviews, changes requested and made, no objections.

@msporny msporny merged commit a7a04a2 into main Oct 23, 2022
@msporny msporny deleted the msporny-fix-verify-proof branch October 23, 2022 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants