Skip to content

Commit

Permalink
Account for issuer or verifier rejecting invalid validUntils.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Jan 2, 2024
1 parent c7ba7ca commit 8881a46
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions tests/10-vcdm2.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,20 @@ describe('Verifiable Credentials Data Model v2.0', function() {
'./input/credential-validUntil-validFrom-fail.json');
negativeTest.validFrom = createTimeStamp({skew: 2});
negativeTest.validUntil = createTimeStamp({skew: -2});
assert.rejects(issue(negativeTest));
let error;
let result;
try {
result = await issue(negativeTest);
} catch(e) {
error = e;
}
// spec is not entirely clear here so if an issuer checks for valid
// dates that's ok
if(error) {
return;
}
// all verifiers should reject a VC with invalid validUntil & validFrom
assert.rejects(verify(result));
});
it2('If a validFrom value also exists, the validUntil value MUST ' +
'express a datetime that is temporally the same or later than the ' +
Expand All @@ -406,7 +419,20 @@ describe('Verifiable Credentials Data Model v2.0', function() {
'./input/credential-validUntil-validFrom-fail.json');
negativeTest.validFrom = createTimeStamp({skew: 2});
negativeTest.validUntil = createTimeStamp({skew: -2});
assert.rejects(issue(negativeTest));
let error;
let result;
try {
result = await issue(negativeTest);
} catch(e) {
error = e;
}
// spec is not entirely clear here so if an issuer checks for valid
// dates that's ok
if(error) {
return;
}
// all verifiers should reject a VC with invalid validUntil & validFrom
assert.rejects(verify(result));
});
// FIXME remove as this doesn't seem to be in the spec
it.skip('At least one proof mechanism, and the details necessary ' +
Expand Down

0 comments on commit 8881a46

Please sign in to comment.