From c97c455d09aad52133707a57316cca71a4494bbc Mon Sep 17 00:00:00 2001 From: Xavi Aracil Date: Thu, 21 Mar 2024 17:24:50 +0100 Subject: [PATCH] better comments --- .../org/oneedtech/inspect/vc/probe/ExpirationProbe.java | 6 +++--- .../java/org/oneedtech/inspect/vc/probe/IssuanceProbe.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ExpirationProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ExpirationProbe.java index c616015..ac2825f 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ExpirationProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/ExpirationProbe.java @@ -22,7 +22,7 @@ public class ExpirationProbe extends Probe { @Override public ReportItems run(Credential crd, RunContext ctx) throws Exception { /* - * If the AchievementCredential or EndorsementCredential has an “expirationDate” property + * If the AchievementCredential or EndorsementCredential has an “expirationDate” or "validUntil" property * and the expiration date is prior to the current date, the credential has expired. */ JsonNode node = crd.getJson().get(crd.getExpiresAtPropertyName()); @@ -30,10 +30,10 @@ public class ExpirationProbe extends Probe { try { ZonedDateTime expirationDate = ZonedDateTime.parse(node.textValue()); if (ZonedDateTime.now().isAfter(expirationDate)) { - return fatal("The credential has expired (expiration date was " + node.asText() + ").", ctx); + return fatal("The credential has expired (expiration date or validUntil was " + node.asText() + ").", ctx); } } catch (Exception e) { - return exception("Error while checking expirationDate: " + e.getMessage(), ctx.getResource()); + return exception("Error while checking expirationDate or validUntil: " + e.getMessage(), ctx.getResource()); } } return success(ctx); diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/IssuanceProbe.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/IssuanceProbe.java index 2328199..b1c213f 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/IssuanceProbe.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/probe/IssuanceProbe.java @@ -22,7 +22,7 @@ public class IssuanceProbe extends Probe { @Override public ReportItems run(Credential crd, RunContext ctx) throws Exception { /* - * If the AchievementCredential or EndorsementCredential “issuanceDate” + * If the AchievementCredential or EndorsementCredential “issuanceDate” or "validFrom" * property after the current date, the credential is not yet valid. */ JsonNode node = crd.getJson().get(crd.getIssuedOnPropertyName()); @@ -30,10 +30,10 @@ public class IssuanceProbe extends Probe { try { ZonedDateTime issuanceDate = ZonedDateTime.parse(node.textValue()); if (issuanceDate.isAfter(ZonedDateTime.now())) { - return fatal("The credential is not yet issued (issuance date is " + node.asText() + ").", ctx); + return fatal("The credential is not yet issued or valid (issuance date or validFrom is " + node.asText() + ").", ctx); } } catch (Exception e) { - return exception("Error while checking issuanceDate: " + e.getMessage(), ctx.getResource()); + return exception("Error while checking issuanceDate or ValidFrom: " + e.getMessage(), ctx.getResource()); } } return success(ctx);