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

split signature verification from verifier #2683

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

gerardsn
Copy link
Member

the Verifier interface contains the Verify, Validate, and VerifyVP methods. The naming of these methods is ambiguous and there seems to be no clear separation of responsibilities.

I've split/renamed the methods to

  • Verify/VerifyVP methods on the Verifier that should check the full correctness of the VC/VP
  • VerifySignature/verifyVPSignature that only check if the signature on a VC/VP was valid at the given time.
    where the later are now on their own struct. This should make it easier to reuse in other places

@reinkrul
Copy link
Member

Is it only a refactor, no functional changes?

}

// verifyVPSignature implements the Proof Verification Algorithm: https://w3c-ccg.github.io/data-integrity-spec/#proof-verification-algorithm
func (sv *signatureVerifier) verifyVPSignature(presentation vc.VerifiablePresentation, validateAt *time.Time) error {
Copy link
Member

Choose a reason for hiding this comment

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

that this one unexported, and the VerifySignature exported is weird

Copy link
Member Author

Choose a reason for hiding this comment

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

exported; the signatureVerifier should probably get its own interface, but out of scope for now

_, err := crypto.ParseJWT(jwtDocumentToVerify, func(kid string) (crypt.PublicKey, error) {
keyID = kid
return sv.resolveSigningKey(kid, issuer, at)
}, jwt.WithClock(jwt.ClockFunc(func() time.Time {
Copy link
Member

Choose a reason for hiding this comment

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

I realized clock skew is missing here..

Copy link
Member Author

Choose a reason for hiding this comment

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

deferred to #2684

@gerardsn gerardsn requested a review from reinkrul December 14, 2023 12:20
@gerardsn gerardsn merged commit d892381 into master Dec 14, 2023
8 of 9 checks passed
@gerardsn gerardsn deleted the split-signatureVerifier-from-verifier branch December 14, 2023 12:46
rolandgroen added a commit to Headease/nuts-node that referenced this pull request Dec 18, 2023
* master:
  complete s2s e2e test (nuts-foundation#2677)
  Cleanup unused file (nuts-foundation#2692)
  Discovery: implement server API (nuts-foundation#2659)
  VCR: Use JWT/JSON-LD constants from go-did (nuts-foundation#2691)
  Bump github/codeql-action from 2 to 3 (nuts-foundation#2687)
  split signature verification from verifier (nuts-foundation#2683)
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.

2 participants