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

Refactor verification, integrity, parsing #404

Merged
merged 11 commits into from
Jun 1, 2023
Merged

Conversation

decentralgabe
Copy link
Member

Small refactors / moving / renames before implementing generic data integrity verification

Copy link
Contributor

@andresuribe87 andresuribe87 left a comment

Choose a reason for hiding this comment

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

Seems like multiple string replacements happened that shouldn't have happened. Can you confirm?

assert.Error(tt, err)
assert.Contains(tt, err.Error(), "credential must have a proof")
assert.Contains(tt, err.Error(), "cred must have a proof")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentional?

assert.Error(tt, err)
assert.Contains(tt, err.Error(), "credential must have a proof")
assert.Contains(tt, err.Error(), "cred must have a proof")
Copy link
Contributor

Choose a reason for hiding this comment

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

Here as well

@@ -184,7 +182,7 @@ func TestVerifyJWTCredential(t *testing.T) {
jwtCred := getTestJWTCredential(tt, *signer)
_, err = VerifyJWTCredential(jwtCred, resolver)
assert.Error(tt, err)
assert.Contains(tt, err.Error(), "has no verification methods with kid: missing")
assert.Contains(tt, err.Error(), "has no validation methods with kid: missing")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should stay as verification

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@@ -250,7 +250,7 @@ func bitstringExpansion(compressedBitstring string) ([]string, error) {

// ValidateCredentialInStatusList determines whether a credential is contained in a status list 2021 credential
// https://w3c-ccg.github.io/vc-status-list-2021/#validate-algorithm
// NOTE: this method does not perform credential signature/proof block verification
// NOTE: this method does not perform credential signature/proof block validation
Copy link
Contributor

Choose a reason for hiding this comment

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

verification?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

Comment on lines +26 to +29
type Option struct {
ID OptionKey
Option any
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Using any is discouraged unless there is a very good reason to do so. Can this be updated to received typed params?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes I have a separate ticket to refactor this #352

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we doing credential validation? I thought we should only be doing verification

Copy link
Member Author

Choose a reason for hiding this comment

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

we'll need both - for checking status, schema, etc

@@ -231,7 +231,7 @@ type JSONWebKeyVerifier struct {
jwx.Verifier
}

// Verify attempts to verify a `signature` against a given `message`, returning nil if the verification is successful
// Verify attempts to verify a `signature` against a given `message`, returning nil if the validation is successful
Copy link
Contributor

Choose a reason for hiding this comment

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

verification?

@@ -142,7 +142,7 @@ func (b BBSPlusSignatureSuite) Verify(v cryptosuite.Verifier, p cryptosuite.With
// make sure we set it back after we're done verifying
defer p.SetProof(proof)

// remove the proof value in the proof before verification
// remove the proof value in the proof before validation
Copy link
Contributor

Choose a reason for hiding this comment

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

verification?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should keep verification?

@@ -153,7 +153,7 @@ func TestCredentialLDProof(t *testing.T) {
},
}

// create a copy for value verification later
// create a copy for value validation later
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like it shouldn't change

@codecov-commenter
Copy link

codecov-commenter commented May 31, 2023

Codecov Report

Merging #404 (57817e7) into main (07707db) will decrease coverage by 0.42%.
The diff coverage is 73.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #404      +/-   ##
==========================================
- Coverage   57.28%   56.86%   -0.42%     
==========================================
  Files          67       67              
  Lines        7297     7304       +7     
==========================================
- Hits         4180     4153      -27     
- Misses       2380     2415      +35     
+ Partials      737      736       -1     
Impacted Files Coverage Δ
credential/builder.go 64.94% <ø> (-0.45%) ⬇️
credential/manifest/validation.go 65.75% <ø> (ø)
crypto/jwx/jwt.go 52.79% <0.00%> (ø)
did/key/key.go 70.52% <ø> (ø)
did/peer/peer0.go 58.54% <ø> (ø)
credential/validation/validators.go 43.75% <30.77%> (ø)
credential/parsing/parsing.go 29.29% <50.00%> (ø)
credential/integrity/signature.go 77.33% <61.90%> (ø)
credential/integrity/jwt.go 40.43% <90.91%> (ø)
credential/exchange/submission.go 72.87% <100.00%> (ø)
... and 4 more

... and 1 file with indirect coverage changes

@decentralgabe
Copy link
Member Author

@andresuribe87 should have addressed all

@andresuribe87 andresuribe87 merged commit effaa78 into main Jun 1, 2023
@andresuribe87 andresuribe87 deleted the sign-verify-both branch June 1, 2023 20:23
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.

3 participants