Skip to content

Commit 74d0966

Browse files
committed
Update compareTime arguments.
1 parent 2d4bd57 commit 74d0966

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,15 +648,15 @@ export function _checkCredential({
648648
if(mode === 'verify') {
649649
// check if `now` is after `expirationDate`
650650
const expirationDate = new Date(credential.expirationDate);
651-
if(compareTime({t1: expirationDate, t2: now, maxClockSkew}) > 0) {
651+
if(compareTime({t1: now, t2: expirationDate, maxClockSkew}) > 0) {
652652
throw new Error('Credential has expired.');
653653
}
654654
}
655655
}
656656
// check if `now` is before `issuanceDate` on verification
657657
if(mode === 'verify') {
658658
const issuanceDate = new Date(credential.issuanceDate);
659-
if(compareTime({t1: now, t2: issuanceDate, maxClockSkew}) > 0) {
659+
if(compareTime({t1: issuanceDate, t2: now, maxClockSkew}) > 0) {
660660
throw new Error(
661661
`The current date time (${now.toISOString()}) is before the ` +
662662
`"issuanceDate" (${credential.issuanceDate}).`);
@@ -670,7 +670,7 @@ export function _checkCredential({
670670
assertDateString({credential, prop: 'validUntil'});
671671
if(mode === 'verify') {
672672
validUntil = new Date(credential.validUntil);
673-
if(compareTime({t1: validUntil, t2: now, maxClockSkew}) > 0) {
673+
if(compareTime({t1: now, t2: validUntil, maxClockSkew}) > 0) {
674674
throw new Error(
675675
`The current date time (${now.toISOString()}) is after ` +
676676
`"validUntil" (${credential.validUntil}).`);
@@ -682,7 +682,7 @@ export function _checkCredential({
682682
if(mode === 'verify') {
683683
// check if `now` is before `validFrom`
684684
validFrom = new Date(credential.validFrom);
685-
if(compareTime({t1: now, t2: validFrom, maxClockSkew}) > 0) {
685+
if(compareTime({t1: validFrom, t2: now, maxClockSkew}) > 0) {
686686
throw new Error(
687687
`The current date time (${now.toISOString()}) is before ` +
688688
`"validFrom" (${credential.validFrom}).`);

0 commit comments

Comments
 (0)