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

Add verifyAll and change the verify(verificationLevel, options) #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jpsantosbh
Copy link
Contributor

Since verifyAttestation() ins an ASYNC method it can't be part of the verify 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 method verifyAll and remove the anchor verification for the verify method

&& hVerifyLevel >= VERIFY_LEVELS.GRANTED
&& this.verifyGrant(requestorId, requestId, keyName)) verifiedlevel = VERIFY_LEVELS.GRANTED;

return verifiedlevel;
};

this.verifyAll = async (options) => {
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

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');
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 that a require in test/creds/fixtures/VCPermanentAnchor.json is better.

Copy link
Contributor Author

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');
Copy link
Contributor

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');
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

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