Skip to content

Commit

Permalink
move status check before expiry check
Browse files Browse the repository at this point in the history
  • Loading branch information
jchartrand committed Jan 16, 2025
1 parent 5eeabad commit 8884891
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,19 +355,21 @@ async function _verifyCredential(options = {}) {
log.push({id: 'valid_signature', valid: true});
log.push({id: 'issuer_did_resolves', valid: true});

// if credential status is provided, a `checkStatus` function must be given

Check failure on line 358 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 2 spaces but found 4
if(credential.credentialStatus && typeof checkStatus !== 'function') {

Check failure on line 359 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 2 spaces but found 4
throw new TypeError(

Check failure on line 360 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 4 spaces but found 6
'A "checkStatus" function must be given to verify credentials with ' +

Check failure on line 361 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 6 spaces but found 8
'"credentialStatus".');
}

Check failure on line 363 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 2 spaces but found 4

Check failure on line 364 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Trailing spaces not allowed
if(credential.credentialStatus) {

Check failure on line 365 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 2 spaces but found 4
await addStatusInfoToLog({options, result, log});

Check failure on line 366 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 4 spaces but found 6
}

Check failure on line 367 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Expected indentation of 2 spaces but found 4

Check failure on line 368 in lib/index.js

View workflow job for this annotation

GitHub Actions / lint (20.x)

Trailing spaces not allowed
// run common credential checks (add check results to log)
_checkCredential({credential, log, now});

// if credential status is provided, a `checkStatus` function must be given
if(credential.credentialStatus && typeof checkStatus !== 'function') {
throw new TypeError(
'A "checkStatus" function must be given to verify credentials with ' +
'"credentialStatus".');
}

if(credential.credentialStatus) {
await addStatusInfoToLog({options, result, log});
}
result.log = log;
if(result.results) {
result.results[0].log = log;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digitalcredentials/vc",
"version": "9.0.1",
"version": "9.0.1-beta.1",
"description": "Verifiable Credentials JavaScript library.",
"homepage": "https://github.com/digitalcredentials/vc",
"repository": {
Expand Down

0 comments on commit 8884891

Please sign in to comment.