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

move status check before expiry check #29

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# @digitalcredentials/vc ChangeLog

## 9.0.0 - 2024-09-30
## 9.0.1 - TBD

### Fixed
- run status check before running expiry check because expiry check throws error that had prevented the status check from running

## 9.0.1 - 2024-09-30

### Fixed
- add signature checks to the log before running other verification checks whose errors might prevent that logging
Expand Down
8 changes: 5 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,6 @@ async function _verifyCredential(options = {}) {
log.push({id: 'valid_signature', valid: true});
log.push({id: 'issuer_did_resolves', valid: true});

// 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(
Expand All @@ -368,6 +365,10 @@ async function _verifyCredential(options = {}) {
if(credential.credentialStatus) {
await addStatusInfoToLog({options, result, log});
}

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

result.log = log;
if(result.results) {
result.results[0].log = log;
Expand Down Expand Up @@ -549,6 +550,7 @@ async function _verifyPresentation(options = {}) {

for(const [i, credentialResult] of credentialResults.entries()) {
credentialResult.credentialId = credentials[i].id;
credentialResult.credential = credentials[i];
}

const allCredentialsVerified = credentialResults.every(r => r.verified);
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.2",
"description": "Verifiable Credentials JavaScript library.",
"homepage": "https://github.com/digitalcredentials/vc",
"repository": {
Expand Down