-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add verifyAll and change the verify(verificationLevel, options) #104
base: master
Are you sure you want to change the base?
Conversation
…om the verify(verificationLevel, options)
&& hVerifyLevel >= VERIFY_LEVELS.GRANTED | ||
&& this.verifyGrant(requestorId, requestId, keyName)) verifiedlevel = VERIFY_LEVELS.GRANTED; | ||
|
||
return verifiedlevel; | ||
}; | ||
|
||
this.verifyAll = async (options) => { |
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.
Is there a test for this?
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.
Not yet... Only proposing it :-)
@@ -476,17 +476,19 @@ function VerifiableCredentialBaseConstructor(identifier, issuer, expiryIn, ucas, | |||
|
|||
// Test next level | |||
if (verifiedlevel === VERIFY_LEVELS.PROOFS | |||
&& hVerifyLevel >= VERIFY_LEVELS.ANCHOR |
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.
Is it correct that verify(leve) can now verify everything up to Anchor but not including Anchor? If so this should be probably documented.
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 you are correct needs better documentation
}); | ||
|
||
it('should check all verifications and fail - tampered grant', async (done) => { | ||
const credentialContents = fs.readFileSync('__test__/creds/fixtures/VCPermanentAnchor.json', 'utf8'); |
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 think that a require in test/creds/fixtures/VCPermanentAnchor.json is better.
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.
The anchor on this test is not checked. it fails before that.
}); | ||
|
||
it('should check all verifications and fail - tampered claims', async (done) => { | ||
const credentialContents = fs.readFileSync('__test__/creds/fixtures/VCPermanentAnchor.json', 'utf8'); |
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.
see above
}); | ||
|
||
it('should check all verifications and fail - anchor fails', async (done) => { | ||
const credentialContents = fs.readFileSync('__test__/creds/fixtures/VCPermanentAnchor.json', 'utf8'); |
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.
here as well
Since
verifyAttestation()
ins an ASYNC method it can't be part of theverify
method. Changing the verify method to async will impact a lot of implementation that doesn't need to verify the anchor. This PR has a proposal to add a new ASYNC verification methodverifyAll
and remove the anchor verification for theverify
method