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

VC 2.0 Add validUntil & validFrom / make credentialStatus.id checks optional #168

Merged
merged 52 commits into from
Apr 29, 2024

Conversation

aljones15
Copy link
Contributor

@aljones15 aljones15 commented Dec 8, 2023

Features:

  1. changes the DateRegexp to an XML schema DateTime and expands tests on it
  2. move expirationDate into the VC 1.0 validators and only checks date when mode is verify
  3. adds validUntil and associated tests
  4. adds validFrom and associated tests
  5. make some minor corrections with test data for better consistency
  6. This pr now contains credentialStatus check changes from here
  7. Makes credentialStatus.id optional
  8. Checks to ensure if credentialStatus.id is present it must be a URL.

@aljones15 aljones15 changed the title Move expirationDate test to v1 tests & use mockCredential in all tests. VC 2.0 add validUntil and validBefore Dec 8, 2023
@aljones15 aljones15 marked this pull request as ready for review December 8, 2023 19:25
Copy link
Contributor

@JSAssassin JSAssassin left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor comments. TY!

Edit: In the PR title and the description it says validBefore, but maybe you intended to refer to validAfter instead?

lib/index.js Outdated Show resolved Hide resolved
test/10-verify.spec.js Outdated Show resolved Hide resolved
test/helpers.js Outdated Show resolved Hide resolved
@aljones15 aljones15 mentioned this pull request Dec 8, 2023
12 tasks
@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2024

Codecov Report

❗ No coverage uploaded for pull request base (update-vc-2.0@9ff44fe). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             update-vc-2.0     #168   +/-   ##
================================================
  Coverage                 ?   90.54%           
================================================
  Files                    ?        5           
  Lines                    ?     1058           
  Branches                 ?        0           
================================================
  Hits                     ?      958           
  Misses                   ?      100           
  Partials                 ?        0           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ff44fe...0bb92ad. Read the comment docs.

error = e;
}
should.exist(error,
'Should throw error when "evidence" is not a URI');
Copy link
Contributor

Choose a reason for hiding this comment

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

What's "evidence" here? Looks like a copy/paste error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually was assuming as evidence is moving out the spec that credentialStatus was now a piece of evidence? @davidlehn is this a mistake or should the credentialStatus.id not being a URI be taken as an evidence error?

Copy link
Member

Choose a reason for hiding this comment

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

Looks like typo. Fixed. Do these id changes need a changelog entry? Not sure what's going in this for this PR.

@BigBlueHat
Copy link
Contributor

@aljones15 it looks like this PR has moved (or is moving) well beyond validUntil and validBefore. Is that correct? If so, we should relabel the PR at least.

I'm also a bit concerned about us ending up with one massive PR to review. Can we do more, smaller PRs against a non-main branch (as this one is against update-vc-2.0)? That would make reviews much faster, safer, and more sane. 😃

@aljones15
Copy link
Contributor Author

aljones15 commented Jan 11, 2024

I will refrain from merging any further PRs into this PR, but as this PR and the other PR: #170 had both been approved it seemed safe to merge the two.

As for this PR moving beyond validUntil & validBefore that was not intentional, but the feature making credentialStatus.id optional branched from the validUntil branch so it couldn't be aimed at the core VC 2.0 branch/PR.

@@ -808,7 +808,7 @@ for(const [version, mockCredential] of versionedCredentials) {
.contain('"issuer" must be a URI');
});

it('should reject credentialStatus that is not a URI', () => {
it('should reject credentialStatus id that is not a URI', () => {
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 spec says URL actually. Also, only one id is allowed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you match the spec text where possible? Makes it much easier to match tests to the spec. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I don't know what needs changing here. Please do whatever is needed. If only one status is allowed, the check code should check that, and tests should be written to fail on multiple statuses.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BigBlueHat the tests inside of the libraries usually don't match the spec text so what you're asking might be better as a separate issue. If you want it done here I could get a start on it in this pr.

@BigBlueHat
Copy link
Contributor

I will refrain from merging any further PRs into this PR, but as this PR and the other PR: #170 had both been approved it seemed safe to merge the two.

As for this PR moving beyond validUntil & validBefore that was not intentional, but the feature making credentialStatus.id optional branched from the validUntil branch so it couldn't be aimed at the core VC 2.0 branch/PR.

Mostly, my aim is to keep topics clear...and now it's pretty muddied what's going on.

Also, as @JSAssassin mentioned earlier, the fields are validFrom and validUntil--and we should change this PR to match.

Thanks!

CHANGELOG.md Outdated Show resolved Hide resolved
test/10-verify.spec.js Outdated Show resolved Hide resolved
@aljones15 aljones15 changed the title VC 2.0 add validUntil and validBefore VC 2.0 Add validUntil & validBefore / make credentialStatus.id checks optional Jan 13, 2024
@aljones15 aljones15 changed the title VC 2.0 Add validUntil & validBefore / make credentialStatus.id checks optional VC 2.0 Add validUntil & validFrom / make credentialStatus.id checks optional Jan 15, 2024
aljones15 and others added 20 commits April 29, 2024 15:51
- Make "id" optional.
- If "id" present, check it's a URL.
- Add tests.
@aljones15
Copy link
Contributor Author

@BigBlueHat @davidlehn please double check this as this is your last chance before merge into update-vc-2.0.

@aljones15 aljones15 removed the request for review from JSAssassin April 29, 2024 15:58
@dlongley dlongley merged commit d3abfab into update-vc-2.0 Apr 29, 2024
5 checks passed
@dlongley dlongley deleted the vc-2.0-time-props branch July 25, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants