diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..2424c1ef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,32 @@
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# other directories
+target/
+.idea/
+*.p12
+*.iml
+.settings/
+.setting/
+.mvn/
+.project/
+helm/*/Chart.lock
+helm/*/charts/
\ No newline at end of file
diff --git a/README.md b/README.md
index 7b57e287..cef3c7b0 100644
--- a/README.md
+++ b/README.md
@@ -45,8 +45,8 @@ Execute installation script
* Set the hostname of the endpoints correctly as per your docker setup
* Now generate a DID, create a credential schema and create an issuance registry
* take note of `$.schema[0].author` and `$.schema[0].id` from the create credential schema request
-6. Add the jar file of Digital Credential Stack(DCS) plugin implementation in [loader_path](docker-compose-esignet/loader_path). The JAR can be built [from source](https://github.com/mosip/digital-credential-plugins/) or [downloaded directly](https://mvnrepository.com/artifact/io.mosip.esignet.sunbirdrc/sunbird-rc-esignet-integration-impl).
-7. Modify the properties of the Esignet service located in the [esignet-default.properties](docker-compose-esignet/config/esignet-default.properties) file:
+6. Add the jar file of Digital Credential Stack(DCS) plugin implementation in [loader_path](docker-compose/docker-compose-esignet/loader_path). The JAR can be built [from source](https://github.com/mosip/digital-credential-plugins/) or [downloaded directly](https://mvnrepository.com/artifact/io.mosip.esignet.sunbirdrc/sunbird-rc-esignet-integration-impl).
+7. Modify the properties of the Esignet service located in the [esignet-default.properties](docker-compose/docker-compose-esignet/config/esignet-default.properties) file:
- Include Issuer ID and credential schema ID for the following properties: `mosip.esignet.vciplugin.sunbird-rc.credential-type.{credential type}.static-value-map.issuerId`, `mosip.esignet.vciplugin.sunbird-rc.credential-type.{credential-type}.cred-schema-id`.
- The `$.schema[0].author` DID goes to the config ending in issuerId and `$.schema[0].id` DID goes to the config ending in `cred-schema-id`.
8. Once the Esignet properties are configured, proceed to select Esignet from the options provided for eSignet.
@@ -60,11 +60,11 @@ Execute installation script
## Properties for custom use case
-- Sample schemas for Insurance registry are provided [here](docker-compose-sunbird/schemas), change it according to use case.
+- Sample schemas for Insurance registry are provided [here](docker-compose/docker-compose-sunbird/schemas), change it according to use case.
- Change these properties for different use case `mosip.esignet.authenticator.sunbird-rc.auth-factor.kba.field-details`,`mosip.esignet.authenticator.sunbird-rc.auth-factor.kba.individual-id-field`
- Add the Sunbird registry URL for these properties: `mosip.esignet.vciplugin.sunbird-rc.issue-credential-url`,`mosip.esignet.authenticator.sunbird-rc.auth-factor.kba.registry-search-url`.
- Specify the list of supported credential types using the property: `mosip.esignet.vciplugin.sunbird-rc.supported-credential-types`.
-- For each supported credential type change the below properties. Sample properties are provided in the [default properties](docker-compose-esignet/config/esignet-default.properties) file.
+- For each supported credential type change the below properties. Sample properties are provided in the [default properties](docker-compose/docker-compose-esignet/config/esignet-default.properties) file.
* Issuer id `mosip.esignet.vciplugin.sunbird-rc.credential-type.{credential type}.static-value-map.issuerId`
* Credential schema id `mosip.esignet.vciplugin.sunbird-rc.credential-type.{credential type}.cred-schema-id`
* Registry Url `mosip.esignet.vciplugin.sunbird-rc.credential-type.{credential type}.registry-get-url`
diff --git a/certify-core/pom.xml b/certify-core/pom.xml
new file mode 100644
index 00000000..4af86876
--- /dev/null
+++ b/certify-core/pom.xml
@@ -0,0 +1,39 @@
+
+
+
+ 4.0.0
+
+
+ io.mosip.certify
+ certify-parent
+ 0.0.1-SNAPSHOT
+
+
+ io.mosip.certify
+ certify-core
+ certify-core
+ ${project.parent.version}
+ Certify Core Library
+
+
+
+ org.springdoc
+ springdoc-openapi-starter-webmvc-ui
+ ${springdoc-openapi-webmvc-ui-version}
+
+
+ commons-validator
+ commons-validator
+ ${commons.validator.version}
+
+
+ io.mosip.certify
+ certify-integration-api
+ ${project.version}
+
+
+
\ No newline at end of file
diff --git a/certify-core/src/main/java/io/mosip/certify/core/config/LocalAuthenticationEntryPoint.java b/certify-core/src/main/java/io/mosip/certify/core/config/LocalAuthenticationEntryPoint.java
new file mode 100644
index 00000000..ccd18c34
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/config/LocalAuthenticationEntryPoint.java
@@ -0,0 +1,29 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.config;
+
+import java.io.IOException;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.HandlerExceptionResolver;
+
+@Component
+public class LocalAuthenticationEntryPoint implements AuthenticationEntryPoint {
+ @Autowired
+ private HandlerExceptionResolver handlerExceptionResolver;
+
+ public LocalAuthenticationEntryPoint() {
+ }
+
+ public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
+ this.handlerExceptionResolver.resolveException(request, response, (Object)null, authException);
+ }
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/constants/Constants.java b/certify-core/src/main/java/io/mosip/certify/core/constants/Constants.java
new file mode 100644
index 00000000..9508918c
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/constants/Constants.java
@@ -0,0 +1,16 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.constants;
+
+public class Constants {
+
+ public static final String UTC_DATETIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+ public static final String SPACE = " ";
+
+ public static final String C_NONCE = "c_nonce";
+ public static final String C_NONCE_EXPIRES_IN = "c_nonce_expires_in";
+ public static final String CLIENT_ID = "client_id";
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java b/certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java
new file mode 100644
index 00000000..19cf956d
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java
@@ -0,0 +1,25 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.constants;
+
+public class ErrorConstants {
+
+ public static final String INVALID_REQUEST="invalid_request";
+ public static final String INVALID_SCOPE="invalid_scope";
+ public static final String INVALID_AUTH_TOKEN="invalid_token";
+ public static final String INVALID_ALGORITHM = "invalid_algorithm";
+ public static final String UNKNOWN_ERROR = "unknown_error";
+ public static final String UNSUPPORTED_VC_FORMAT = "unsupported_credential_format";
+ public static final String INVALID_VC_FORMAT = "invalid_vc_format";
+ public static final String INVALID_PROOF = "invalid_proof";
+ public static final String UNSUPPORTED_PROOF_TYPE = "unsupported_proof_type";
+ public static final String UNSUPPORTED_VC_TYPE = "unsupported_credential_type";
+ public static final String VC_ISSUANCE_FAILED = "vc_issuance_failed";
+ public static final String PROOF_HEADER_INVALID_TYP = "proof_header_invalid_typ";
+ public static final String PROOF_HEADER_INVALID_ALG = "proof_header_invalid_alg";
+ public static final String PROOF_HEADER_INVALID_KEY = "proof_header_invalid_key";
+ public static final String PROOF_HEADER_AMBIGUOUS_KEY = "proof_header_ambiguous_key";
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialDefinition.java b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialDefinition.java
new file mode 100644
index 00000000..f90c3ae9
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialDefinition.java
@@ -0,0 +1,29 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.mosip.certify.core.constants.ErrorConstants;
+import lombok.Data;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class CredentialDefinition {
+
+ @JsonProperty("@context")
+ private List<@NotBlank(message = ErrorConstants.INVALID_REQUEST) String> context;
+
+ @NotEmpty(message = ErrorConstants.INVALID_REQUEST)
+ private List<@NotBlank(message = ErrorConstants.INVALID_REQUEST) String> type;
+
+ private Map credentialSubject;
+
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialMetadata.java b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialMetadata.java
new file mode 100644
index 00000000..eb0df9f2
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialMetadata.java
@@ -0,0 +1,23 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import lombok.Data;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@Data
+public class CredentialMetadata {
+
+ private String id;
+ private String format;
+ private String scope;
+ private List proof_types_supported;
+ private List types;
+
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialProof.java b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialProof.java
new file mode 100644
index 00000000..7bbb2a27
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialProof.java
@@ -0,0 +1,31 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import io.mosip.certify.core.constants.ErrorConstants;
+import lombok.Data;
+
+import jakarta.validation.constraints.NotBlank;
+
+@Data
+public class CredentialProof {
+
+ /**
+ * The proof object MUST contain a proof_type claim of type JSON string denoting the concrete proof type.
+ */
+ @NotBlank(message = ErrorConstants.UNSUPPORTED_PROOF_TYPE)
+ private String proof_type;
+
+ /**
+ * When proof_type is jwt, a proof object MUST include a jwt claim
+ */
+ private String jwt;
+
+ /**
+ * When proof_type is cwt, a proof object MUST include a cwt claim
+ */
+ private String cwt;
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialRequest.java b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialRequest.java
new file mode 100644
index 00000000..73986e97
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialRequest.java
@@ -0,0 +1,45 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import io.mosip.certify.core.constants.ErrorConstants;
+import jakarta.validation.Valid;
+import lombok.Data;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+
+@Data
+public class CredentialRequest {
+
+ /**
+ * REQUIRED. Format of the Credential to be issued.
+ */
+ @NotBlank(message = ErrorConstants.INVALID_VC_FORMAT)
+ private String format;
+
+ /**
+ * OPTIONAL.
+ * JSON object containing proof of possession of the key material the issued Credential shall be bound to.
+ */
+ @Valid
+ @NotNull(message = ErrorConstants.INVALID_PROOF)
+ private CredentialProof proof;
+
+ /**
+ * "format": jwt_vc_json | jwt_vc_json-ld | ldp_vc
+ * REQUIRED
+ * JSON object containing (and isolating) the detailed description of the credential type.
+ * This object MUST be processed using full JSON-LD processing.
+ * It consists of the following sub claims:
+ * @context: REQUIRED. JSON array
+ * types: REQUIRED. JSON array. This claim contains the type values the Wallet shall request
+ * in the subsequent Credential Request.
+ */
+ @Valid
+ @NotNull(message = ErrorConstants.INVALID_REQUEST)
+ private CredentialDefinition credential_definition;
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialResponse.java b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialResponse.java
new file mode 100644
index 00000000..da7015ec
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/CredentialResponse.java
@@ -0,0 +1,44 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+@Data
+public class CredentialResponse {
+
+ /**
+ * JSON string denoting the format of the issued Credential.
+ */
+ private String format;
+
+ /**
+ * Contains issued Credential. MUST be present when acceptance_token is not returned.
+ * MAY be a JSON string or a JSON object, depending on the Credential format.
+ */
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private T credential;
+
+ /**
+ * A JSON string containing a security token subsequently used to obtain a Credential.
+ * MUST be present when credential is not returned
+ */
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private String acceptance_token;
+
+ /**
+ * JSON string containing a nonce to be used to create a proof of possession of key material
+ */
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private String c_nonce;
+
+ /**
+ * JSON integer denoting the lifetime in seconds of the c_nonce
+ */
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private Integer c_nonce_expires_in;
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/Error.java b/certify-core/src/main/java/io/mosip/certify/core/dto/Error.java
new file mode 100644
index 00000000..c1e62da6
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/Error.java
@@ -0,0 +1,20 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Error {
+
+ private String errorCode;
+ private String errorMessage;
+
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/ParsedAccessToken.java b/certify-core/src/main/java/io/mosip/certify/core/dto/ParsedAccessToken.java
new file mode 100644
index 00000000..4e2fe764
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/ParsedAccessToken.java
@@ -0,0 +1,20 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import lombok.Data;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Data
+@Component
+public class ParsedAccessToken {
+
+ private Map claims;
+ private String accessTokenHash;
+ private boolean isActive;
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/ResponseWrapper.java b/certify-core/src/main/java/io/mosip/certify/core/dto/ResponseWrapper.java
new file mode 100644
index 00000000..c7d00739
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/ResponseWrapper.java
@@ -0,0 +1,19 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class ResponseWrapper {
+
+ private String responseTime;
+ private T response;
+ private List errors = new ArrayList<>();
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/VCError.java b/certify-core/src/main/java/io/mosip/certify/core/dto/VCError.java
new file mode 100644
index 00000000..b67e7a36
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/VCError.java
@@ -0,0 +1,28 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+@Data
+public class VCError {
+
+ private String error;
+ private String error_description;
+
+ /**
+ * JSON string containing a nonce to be used to create a proof of possession of key material when requesting a Credential
+ */
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private String c_nonce;
+
+ /**
+ * JSON integer denoting the lifetime in seconds of the c_nonce.
+ */
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private Integer c_nonce_expires_in;
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/dto/VCIssuanceTransaction.java b/certify-core/src/main/java/io/mosip/certify/core/dto/VCIssuanceTransaction.java
new file mode 100644
index 00000000..b1ae7830
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/dto/VCIssuanceTransaction.java
@@ -0,0 +1,21 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.dto;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class VCIssuanceTransaction implements Serializable {
+
+ private String cNonce;
+ private long cNonceIssuedEpoch;
+ private int cNonceExpireSeconds;
+
+
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/exception/CertifyException.java b/certify-core/src/main/java/io/mosip/certify/core/exception/CertifyException.java
new file mode 100644
index 00000000..642a7159
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/exception/CertifyException.java
@@ -0,0 +1,27 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.exception;
+
+import io.mosip.certify.core.constants.ErrorConstants;
+
+public class CertifyException extends RuntimeException {
+
+ private String errorCode;
+
+ public CertifyException() {
+ super(ErrorConstants.UNKNOWN_ERROR);
+ this.errorCode = ErrorConstants.UNKNOWN_ERROR;
+ }
+
+ public CertifyException(String errorCode) {
+ super(errorCode);
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/exception/InvalidRequestException.java b/certify-core/src/main/java/io/mosip/certify/core/exception/InvalidRequestException.java
new file mode 100644
index 00000000..287bbfca
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/exception/InvalidRequestException.java
@@ -0,0 +1,21 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.exception;
+
+public class InvalidRequestException extends CertifyException {
+
+ private String errorCode;
+
+ public InvalidRequestException(String errorCode) {
+ super(errorCode);
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/exception/NotAuthenticatedException.java b/certify-core/src/main/java/io/mosip/certify/core/exception/NotAuthenticatedException.java
new file mode 100644
index 00000000..1735bc03
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/exception/NotAuthenticatedException.java
@@ -0,0 +1,19 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.exception;
+
+import io.mosip.certify.core.constants.ErrorConstants;
+
+public class NotAuthenticatedException extends CertifyException {
+
+ public NotAuthenticatedException() {
+ super(ErrorConstants.INVALID_AUTH_TOKEN);
+ }
+
+ public NotAuthenticatedException(String errorCode) {
+ super(errorCode);
+ }
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/spi/VCIssuanceService.java b/certify-core/src/main/java/io/mosip/certify/core/spi/VCIssuanceService.java
new file mode 100644
index 00000000..63aedaeb
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/spi/VCIssuanceService.java
@@ -0,0 +1,23 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.spi;
+
+import io.mosip.certify.core.dto.CredentialRequest;
+import io.mosip.certify.core.dto.CredentialResponse;
+
+import java.util.Map;
+
+public interface VCIssuanceService {
+
+ /**
+ *
+ * @param credentialRequest
+ * @return
+ */
+ CredentialResponse getCredential(CredentialRequest credentialRequest);
+
+ Map getCredentialIssuerMetadata(String version);
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/util/AuditHelper.java b/certify-core/src/main/java/io/mosip/certify/core/util/AuditHelper.java
new file mode 100644
index 00000000..97b25160
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/util/AuditHelper.java
@@ -0,0 +1,18 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.util;
+
+import io.mosip.certify.api.dto.AuditDTO;
+
+public class AuditHelper {
+
+ public static AuditDTO buildAuditDto(String transactionId, String idType) {
+ AuditDTO auditDTO = new AuditDTO();
+ auditDTO.setTransactionId(transactionId);
+ auditDTO.setIdType(idType);
+ return auditDTO;
+ }
+}
diff --git a/certify-core/src/main/java/io/mosip/certify/core/util/CommonUtil.java b/certify-core/src/main/java/io/mosip/certify/core/util/CommonUtil.java
new file mode 100644
index 00000000..5d663fdd
--- /dev/null
+++ b/certify-core/src/main/java/io/mosip/certify/core/util/CommonUtil.java
@@ -0,0 +1,85 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.core.util;
+
+import com.nimbusds.jose.util.ByteUtils;
+import io.mosip.certify.core.constants.Constants;
+import io.mosip.certify.core.constants.ErrorConstants;
+import io.mosip.certify.core.exception.CertifyException;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.validator.routines.UrlValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.AntPathMatcher;
+import org.springframework.util.PathMatcher;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.concurrent.ThreadLocalRandom;
+
+import static org.apache.commons.validator.routines.UrlValidator.ALLOW_ALL_SCHEMES;
+import static org.apache.commons.validator.routines.UrlValidator.ALLOW_LOCAL_URLS;
+
+@Slf4j
+public class CommonUtil {
+
+ private static final Logger logger = LoggerFactory.getLogger(CommonUtil.class);
+ public static final String ALGO_SHA_256 = "SHA-256";
+ public static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+ private static Base64.Encoder urlSafeEncoder;
+ private static PathMatcher pathMatcher;
+ private static UrlValidator urlValidator;
+
+ static {
+ urlSafeEncoder = Base64.getUrlEncoder().withoutPadding();
+ pathMatcher = new AntPathMatcher();
+ urlValidator = new UrlValidator(ALLOW_ALL_SCHEMES+ALLOW_LOCAL_URLS);
+ }
+
+ /**
+ * Output format : 2022-12-01T03:22:46.720Z
+ * @return Formatted datetime
+ */
+ public static String getUTCDateTime() {
+ return ZonedDateTime
+ .now(ZoneOffset.UTC)
+ .format(DateTimeFormatter.ofPattern(Constants.UTC_DATETIME_PATTERN));
+ }
+
+ /**
+ * if the alg is RS256, hash the access_token value with SHA-256, then take the left-most 128 bits and base64url
+ * encode them. The at_hash value is a case-sensitive string.
+ * @param accessToken
+ * @return
+ * @throws CertifyException
+ */
+ public static String generateOIDCAtHash(String accessToken) throws CertifyException {
+ try {
+ MessageDigest digest = MessageDigest.getInstance(ALGO_SHA_256);
+ byte[] hash = digest.digest(accessToken.getBytes(StandardCharsets.UTF_8));
+ //taking only 16 bytes (=128 bits)
+ byte[] leftMost128Bits = ByteUtils.subArray(hash, 0, 16);
+ return urlSafeEncoder.encodeToString(leftMost128Bits);
+ } catch (NoSuchAlgorithmException ex) {
+ log.error("Access token hashing failed with alg:{}", ALGO_SHA_256, ex);
+ throw new CertifyException(ErrorConstants.INVALID_ALGORITHM);
+ }
+ }
+
+ public static String generateRandomAlphaNumeric(int length) {
+ StringBuilder builder = new StringBuilder();
+ for(int i=0; i
+
+ 4.0.0
+
+ io.mosip.certify
+ certify-parent
+ 0.0.1-SNAPSHOT
+
+
+ io.mosip.certify
+ certify-integration-api
+ ${project.parent.version}
+ certify-integration-api
+ Certify Integration Library
+
+
+
+ decentralized-identity
+ jsonld-common-java
+ ${jsonld.common.java.version}
+
+
+
+
+
\ No newline at end of file
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/dto/AuditDTO.java b/certify-integration-api/src/main/java/io/mosip/certify/api/dto/AuditDTO.java
new file mode 100644
index 00000000..a1209835
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/dto/AuditDTO.java
@@ -0,0 +1,17 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class AuditDTO {
+
+ String transactionId;
+ String idType;
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/dto/VCRequestDto.java b/certify-integration-api/src/main/java/io/mosip/certify/api/dto/VCRequestDto.java
new file mode 100644
index 00000000..ae9b11b5
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/dto/VCRequestDto.java
@@ -0,0 +1,20 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.dto;
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class VCRequestDto {
+
+ private List context; //holds @context values
+ private List type;
+ private String format;
+ private Map credentialSubject;
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/dto/VCResult.java b/certify-integration-api/src/main/java/io/mosip/certify/api/dto/VCResult.java
new file mode 100644
index 00000000..d9e435b8
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/dto/VCResult.java
@@ -0,0 +1,23 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.dto;
+
+import lombok.Data;
+
+@Data
+public class VCResult {
+
+ /**
+ * Format of credential
+ * Eg: ldp_vc
+ */
+ private String format;
+
+ /**
+ *
+ */
+ private T credential;
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/exception/VCIExchangeException.java b/certify-integration-api/src/main/java/io/mosip/certify/api/exception/VCIExchangeException.java
new file mode 100644
index 00000000..8088efb2
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/exception/VCIExchangeException.java
@@ -0,0 +1,31 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.exception;
+
+import io.mosip.certify.api.util.ErrorConstants;
+
+public class VCIExchangeException extends Exception {
+ private String errorCode;
+
+ public VCIExchangeException() {
+ super(ErrorConstants.VCI_EXCHANGE_FAILED);
+ this.errorCode = ErrorConstants.VCI_EXCHANGE_FAILED;
+ }
+
+ public VCIExchangeException(String errorCode) {
+ super(errorCode);
+ this.errorCode = errorCode;
+ }
+
+ public VCIExchangeException(String errorCode, String errorMessage) {
+ super(errorCode + " -> " + errorMessage);
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/spi/AuditPlugin.java b/certify-integration-api/src/main/java/io/mosip/certify/api/spi/AuditPlugin.java
new file mode 100644
index 00000000..bce2a276
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/spi/AuditPlugin.java
@@ -0,0 +1,34 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.spi;
+
+import io.mosip.certify.api.dto.AuditDTO;
+import io.mosip.certify.api.util.Action;
+import io.mosip.certify.api.util.ActionStatus;
+
+public interface AuditPlugin {
+
+ /**
+ + Plugin method to audit all the actions in certify service.
+ +
+ + @param action Action to audit @{@link Action}
+ + @param actionStatus Action status to audit @{@link ActionStatus}
+ + @param audit @{@link AuditDTO} during this action
+ + @param t Any error / exception occurred during this action, null if no errors / exception found.
+ */
+ void logAudit(Action action, ActionStatus status, AuditDTO audit, Throwable t);
+
+ /**
+ + Plugin method to audit all the actions in certify service.
+ +
+ + @param username Session username for audit
+ + @param action Action to audit @{@link Action}
+ + @param actionStatus Action status to audit @{@link ActionStatus}
+ + @param audit @{@link AuditDTO} during this action
+ + @param t Any error / exception occurred during this action, null if no errors / exception found.
+ */
+ void logAudit(String username, Action action, ActionStatus status, AuditDTO audit, Throwable t);
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/spi/VCIssuancePlugin.java b/certify-integration-api/src/main/java/io/mosip/certify/api/spi/VCIssuancePlugin.java
new file mode 100644
index 00000000..49360a03
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/spi/VCIssuancePlugin.java
@@ -0,0 +1,36 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.spi;
+
+import foundation.identity.jsonld.JsonLDObject;
+import io.mosip.certify.api.dto.VCRequestDto;
+import io.mosip.certify.api.dto.VCResult;
+import io.mosip.certify.api.exception.VCIExchangeException;
+
+import java.util.Map;
+
+public interface VCIssuancePlugin {
+
+ /**
+ * Applicable for formats : ldp_vc
+ * @param vcRequestDto
+ * @param holderId Holders key material as either DID / KID. This should be used for cryptographic binding of the VC
+ * @param identityDetails Parsed access-token or introspect endpoint response if token is opaque.
+ * @return
+ */
+ VCResult getVerifiableCredentialWithLinkedDataProof(VCRequestDto vcRequestDto, String holderId,
+ Map identityDetails) throws VCIExchangeException;
+
+ /**
+ * Applicable for formats : jwt_vc_json, jwt_vc_json-ld, mso_doc
+ * @param vcRequestDto
+ * @param holderId
+ * @param identityDetails
+ * @return
+ */
+ VCResult getVerifiableCredential(VCRequestDto vcRequestDto, String holderId,
+ Map identityDetails) throws VCIExchangeException;
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/util/Action.java b/certify-integration-api/src/main/java/io/mosip/certify/api/util/Action.java
new file mode 100644
index 00000000..e431186f
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/util/Action.java
@@ -0,0 +1,20 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.util;
+
+public enum Action {
+ VC_ISSUANCE("vci-service");
+
+ String module;
+
+ Action(String module) {
+ this.module = module;
+ }
+
+ public String getModule() {
+ return this.module;
+ }
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/util/ActionStatus.java b/certify-integration-api/src/main/java/io/mosip/certify/api/util/ActionStatus.java
new file mode 100644
index 00000000..1f884fee
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/util/ActionStatus.java
@@ -0,0 +1,12 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.util;
+
+public enum ActionStatus {
+
+ SUCCESS,
+ ERROR
+}
diff --git a/certify-integration-api/src/main/java/io/mosip/certify/api/util/ErrorConstants.java b/certify-integration-api/src/main/java/io/mosip/certify/api/util/ErrorConstants.java
new file mode 100644
index 00000000..9e1538db
--- /dev/null
+++ b/certify-integration-api/src/main/java/io/mosip/certify/api/util/ErrorConstants.java
@@ -0,0 +1,12 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.api.util;
+
+public class ErrorConstants {
+
+ public static final String NOT_IMPLEMENTED = "not_implemented";
+ public static final String VCI_EXCHANGE_FAILED = "vci_exchange_failed";
+}
diff --git a/certify-service/pom.xml b/certify-service/pom.xml
new file mode 100644
index 00000000..727f0a90
--- /dev/null
+++ b/certify-service/pom.xml
@@ -0,0 +1,63 @@
+
+
+
+ 4.0.0
+
+ io.mosip.certify
+ certify-parent
+ 0.0.1-SNAPSHOT
+
+
+ io.mosip.certify
+ certify-service
+ 0.0.1-SNAPSHOT
+ certify-service
+ certify vci service
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ io.mosip.certify
+ certify-core
+ ${project.version}
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring.boot.version}
+
+ true
+ ZIP
+
+
+
+
+ build-info
+ repackage
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java b/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java
new file mode 100644
index 00000000..da5a74b6
--- /dev/null
+++ b/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java
@@ -0,0 +1,22 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+package io.mosip.certify;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+@EnableAsync
+@EnableCaching
+@SpringBootApplication(scanBasePackages = "io.mosip.certify,"+
+ "${mosip.certify.integration.scan-base-package}")
+public class CertifyServiceApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(CertifyServiceApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/certify-service/src/main/java/io/mosip/certify/advice/ExceptionHandlerAdvice.java b/certify-service/src/main/java/io/mosip/certify/advice/ExceptionHandlerAdvice.java
new file mode 100644
index 00000000..6a460e2f
--- /dev/null
+++ b/certify-service/src/main/java/io/mosip/certify/advice/ExceptionHandlerAdvice.java
@@ -0,0 +1,202 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+package io.mosip.certify.advice;
+
+import io.mosip.certify.core.dto.Error;
+import io.mosip.certify.core.dto.ResponseWrapper;
+import io.mosip.certify.core.dto.VCError;
+import io.mosip.certify.core.exception.CertifyException;
+import io.mosip.certify.core.exception.InvalidRequestException;
+import io.mosip.certify.core.exception.NotAuthenticatedException;
+import io.mosip.certify.core.util.CommonUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.TypeMismatchException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.MessageSource;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
+import org.springframework.security.web.access.AccessDeniedHandler;
+import org.springframework.validation.FieldError;
+import org.springframework.web.HttpMediaTypeNotAcceptableException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingRequestHeaderException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.context.request.ServletWebRequest;
+import org.springframework.web.context.request.WebRequest;
+import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import java.io.IOException;
+import java.util.*;
+
+import static io.mosip.certify.core.constants.ErrorConstants.*;
+
+@Slf4j
+@ControllerAdvice
+public class ExceptionHandlerAdvice extends ResponseEntityExceptionHandler implements AccessDeniedHandler {
+
+ @Autowired
+ MessageSource messageSource;
+
+ @Override
+ protected ResponseEntity