-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
Is it only a refactor, no functional changes? |
vcr/verifier/signature_verifier.go
Outdated
} | ||
|
||
// 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 { |
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.
that this one unexported, and the VerifySignature exported is weird
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.
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 { |
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.
I realized clock skew is missing here..
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.
deferred to #2684
* 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)
the
Verifier
interface contains theVerify
,Validate
, andVerifyVP
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 theVerifier
that should check the full correctness of the VC/VPVerifySignature
/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