@digitalbazaar/vc
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -142,3 +142,3 @@ /** | ||
// run common credential checks | ||
_checkCredential({credential, now}); | ||
_checkCredential({credential, now, mode: 'issue'}); | ||
@@ -540,3 +540,3 @@ return jsigs.sign(credential, {purpose, documentLoader, suite}); | ||
*/ | ||
export function _checkCredential({credential, now = new Date()}) { | ||
export function _checkCredential({credential, now = new Date(), mode = 'verify'}) { | ||
if(typeof now === 'string') { | ||
@@ -591,8 +591,10 @@ now = new Date(now); | ||
} | ||
// check if `now` is before `issuanceDate` | ||
issuanceDate = new Date(issuanceDate); | ||
if(now < issuanceDate) { | ||
throw new Error( | ||
`The current date time (${now.toISOString()}) is before the ` + | ||
`"issuanceDate" (${issuanceDate.toISOString()}).`); | ||
// check if `now` is before `issuanceDate` on verification | ||
if(mode === 'verify') { | ||
issuanceDate = new Date(issuanceDate); | ||
if(now < issuanceDate) { | ||
throw new Error( | ||
`The current date time (${now.toISOString()}) is before the ` + | ||
`"issuanceDate" (${issuanceDate.toISOString()}).`); | ||
} | ||
} | ||
@@ -599,0 +601,0 @@ } |
{ | ||
"name": "@digitalbazaar/vc", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Verifiable Credentials JavaScript library.", | ||
@@ -85,3 +85,3 @@ "homepage": "https://github.com/digitalbazaar/vc", | ||
"test-karma": "karma start karma.conf.cjs", | ||
"lint": "eslint .", | ||
"lint": "eslint 'lib/**/*.js' 'test/**/*.js'", | ||
"coverage": "cross-env NODE_ENV=test c8 npm run test-node", | ||
@@ -88,0 +88,0 @@ "coverage-ci": "cross-env NODE_ENV=test c8 --reporter=lcovonly --reporter=text-summary --reporter=text npm run test-node", |
# Verifiable Credentials JS Library _(@digitalbazaar/vc)_ | ||
[![Build Status](https://img.shields.io/github/workflow/status/digitalbazaar/vc/Node.js%20CI)](https://github.com/digitalbazaar/vc/actions?query=workflow%3A%22Node.js+CI%22) | ||
[![Build Status](https://img.shields.io/github/actions/workflow/status/digitalbazaar/vc/main.yml)](https://github.com/digitalbazaar/vc/actions/workflow/main.yml) | ||
[![NPM Version](https://img.shields.io/npm/v/@digitalbazaar/vc.svg)](https://npm.im/@digitalbazaar/vc) | ||
@@ -5,0 +5,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41754
687