diff --git a/src/main/java/org/eclipse/tractusx/ssi/lib/proof/LinkedDataProofValidation.java b/src/main/java/org/eclipse/tractusx/ssi/lib/proof/LinkedDataProofValidation.java index 7c57c066..cf296555 100644 --- a/src/main/java/org/eclipse/tractusx/ssi/lib/proof/LinkedDataProofValidation.java +++ b/src/main/java/org/eclipse/tractusx/ssi/lib/proof/LinkedDataProofValidation.java @@ -22,6 +22,8 @@ package org.eclipse.tractusx.ssi.lib.proof; import java.util.logging.Logger; +// import org.eclipse.tractusx.ssi.lib.serialization.jsonLd.JsonLdValidator; +// import org.eclipse.tractusx.ssi.lib.serialization.jsonLd.JsonLdValidatorImpl; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; diff --git a/src/main/java/org/eclipse/tractusx/ssi/lib/validation/JsonLdValidatorImpl.java b/src/main/java/org/eclipse/tractusx/ssi/lib/validation/JsonLdValidatorImpl.java index cc4ff4b8..e32c36c1 100644 --- a/src/main/java/org/eclipse/tractusx/ssi/lib/validation/JsonLdValidatorImpl.java +++ b/src/main/java/org/eclipse/tractusx/ssi/lib/validation/JsonLdValidatorImpl.java @@ -41,24 +41,8 @@ /** The type Json ld validator. */ public class JsonLdValidatorImpl implements JsonLdValidator { - private static final String UNDEFINED_TERM_URI = "urn:UNDEFINEDTERM"; static final Logger LOG = Logger.getLogger(JsonLdValidatorImpl.class.getName()); - - public void validate(Verifiable verifiable) throws InvalidJsonLdException { - if (verifiable instanceof VerifiableCredential) { - validateJsonLd(verifiable); - } else if (verifiable instanceof VerifiablePresentation) { - VerifiablePresentation verifiablePresentation = (VerifiablePresentation) verifiable; - for (VerifiableCredential verifiableCredential : - verifiablePresentation.getVerifiableCredentials()) { - validate(verifiableCredential); - } - } else { - LOG.warning("Unsupported Verifiable type: " + verifiable.getClass().getName()); - throw new InvalidJsonLdException( - String.format("Unsupported Verifiable type: %s", verifiable.getClass().getName())); - } - } + private static final String UNDEFINED_TERM_URI = "urn:UNDEFINEDTERM"; private static void findUndefinedTerms(JsonArray jsonArray) throws InvalidJsonLdException { for (JsonValue entry : jsonArray) { @@ -114,4 +98,21 @@ private void validateJsonLd(JsonLdObject jsonLdObject) throws InvalidJsonLdExcep ex); } } + + public void validate(Verifiable verifiable) throws InvalidJsonLdException { + if (verifiable instanceof VerifiableCredential) { + validateJsonLd(verifiable); + } else if (verifiable instanceof VerifiablePresentation) { + VerifiablePresentation verifiablePresentation = (VerifiablePresentation) verifiable; + for (VerifiableCredential verifiableCredential : + verifiablePresentation.getVerifiableCredentials()) { + validate(verifiableCredential); + } + } else { + LOG.warning("Unsupported Verifiable type: " + verifiable.getClass().getName()); + throw new InvalidJsonLdException( + String.format( + "Verifiable type %s is not supported", verifiable.getClass().getSimpleName())); + } + } }