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

Enveloped proofs helper functions #114

Merged
merged 7 commits into from
Sep 20, 2024
Merged

Conversation

PatStLouis
Copy link
Collaborator

Moved securing mechanism tests and added enveloped related helper functions.

I think we need a tagging option for EnvelopedProof vs EmbededProof.

@PatStLouis PatStLouis changed the title moved securing mechanism tests and added enveloped related functions Enveloped proofs helper functions Aug 27, 2024
'./input/credential-ok.json'));
} catch(e) {
console.error(
`Issuer: ${name} failed to issue "credential-ok.json".`,
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably store this error and ensure it shows up in the report so they know that the issuance failed.

'for that property',
async function() {
this.test.link = `https://www.w3.org/TR/vc-data-model-2.0/#conformance:~:text=MUST%20include%20all%20required%20properties%20in%20the%20conforming%20documents%20it%20produces`;
this.test.cell.skipMessage = 'Tested by other tests in this suite.';
Copy link
Contributor

@aljones15 aljones15 Aug 28, 2024

Choose a reason for hiding this comment

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

this can be handled by awaiting a previous call, you can do something like this

async function testSomething(){
  return endpoints.post('goo');
}

// store a promise here
const somethingTest = testSomething();

// await the promise
it('assertion 1', async function() {
  await somethingTest;
})

// await the promise again
it('assertion 2', async function() {
  await somethingTest;
})

Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't go that far. In fact, I realized when going back through the MUSTs just now that all of Section 1 Introduction (of which 1.3 Conformance is a part) is non-normative...so we can remove the 1-3-conformance.js file altogether (and should for maintainability).

Let's merge this PR first, though.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, since you've brought them all in the way you have, we could do what @aljones15 is suggesting. It'll make the code read a little strangely (all the test's will get called outside of any it() and then their results awaited in each it()), but if y'all feel this will comfort developers and spec reviewers who will see those MUSTs and wonder why they're not tested, I'm more than happy for these to stay.

Just still on the fence as to whether the await approach is worth the effort. Maybe let's discuss it soon.

.include('data:application/vc+jwt',
`Expecting id field to be a data: URL [RFC2397].`);
const extractedCredential = extractIfEnveloped(issuedVc);
shouldBeCredential(extractedCredential);
this.skip();
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we assert here and then skip?

Copy link
Member

Choose a reason for hiding this comment

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

@PatStLouis guessing the above this.skip() just got overlooked?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem here is because this test will also be executed on a non enveloped credential. I put the skip there until we have some way to tag implementations, I should of left a comment!

this.test.cell.skipMessage = 'TBD';
issuedVc.should.have.property('type').that.does
.include('EnvelopedVerifiableCredential',
`Expecting type field to be EnvelopedVerifiableCredential`);
this.skip();
Copy link
Contributor

Choose a reason for hiding this comment

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

this is odd we assert and then skip that seems off.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same as above, currently skipped until we have a way to tag EnvelopedProof implementations as otherwise this test will always fail on other implementations

Copy link
Contributor

@aljones15 aljones15 left a comment

Choose a reason for hiding this comment

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

Overall really good, but those assertions above those skips seem weird to me.

Copy link
Member

@BigBlueHat BigBlueHat left a comment

Choose a reason for hiding this comment

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

Overall this looks great. I do think we need to chat about the 1-3-conformance.js tests, though, and how we want to see the tagging and configuration done per implementation.

'for that property',
async function() {
this.test.link = `https://www.w3.org/TR/vc-data-model-2.0/#conformance:~:text=MUST%20include%20all%20required%20properties%20in%20the%20conforming%20documents%20it%20produces`;
this.test.cell.skipMessage = 'Tested by other tests in this suite.';
Copy link
Member

Choose a reason for hiding this comment

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

Actually, since you've brought them all in the way you have, we could do what @aljones15 is suggesting. It'll make the code read a little strangely (all the test's will get called outside of any it() and then their results awaited in each it()), but if y'all feel this will comfort developers and spec reviewers who will see those MUSTs and wonder why they're not tested, I'm more than happy for these to stay.

Just still on the fence as to whether the await approach is worth the effort. Maybe let's discuss it soon.

@BigBlueHat
Copy link
Member

@PatStLouis what are your thoughts about handling the 1.3 Conformance stuff. How you have it now is fine by me (and I'll update my review), but we actually don't need to even provide that 1.3 section...as it's non-normative.

@BigBlueHat
Copy link
Member

@PatStLouis what are your thoughts about handling the 1.3 Conformance stuff. How you have it now is fine by me (and I'll update my review), but we actually don't need to even provide that 1.3 section...as it's non-normative.

Discussed this more with Manu and think proceeding with what you have here would be best.

Copy link
Contributor

@aljones15 aljones15 left a comment

Choose a reason for hiding this comment

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

unblocking the improvements here

Copy link
Member

@BigBlueHat BigBlueHat left a comment

Choose a reason for hiding this comment

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

Actually...code's got bugs...

tests/assertions.js Show resolved Hide resolved
@BigBlueHat
Copy link
Member

@PatStLouis let's also remove the first (currently skipped) entry:

Conforming document (compliance): VCDM "MUST be enforced." ("all relevant normative statements in Sections 4. Basic Concepts, 5. Advanced Concepts, and 6. Syntaxes")

That's rather the point of the whole test suite. 😁

Copy link
Member

@TallTed TallTed left a comment

Choose a reason for hiding this comment

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

Small, human-facing.

tests/1-3-conformance.js Outdated Show resolved Hide resolved
tests/413-verifiable-presentations.js Outdated Show resolved Hide resolved
tests/413-verifiable-presentations.js Outdated Show resolved Hide resolved
Copy link
Member

@BigBlueHat BigBlueHat left a comment

Choose a reason for hiding this comment

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

Looks good!

Signed-off-by: Patrick <[email protected]>
tests/413.2-envelopes.js Outdated Show resolved Hide resolved
@PatStLouis
Copy link
Collaborator Author

once @TallTed approves the changes I will merge this, the location of the file changed (outdated) but I've implemented your suggestions!

@PatStLouis PatStLouis merged commit 14703c7 into main Sep 20, 2024
2 checks passed
@PatStLouis PatStLouis deleted the enveloped-credentials-functions branch September 20, 2024 17:47
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.

5 participants