Skip to content

Commit 2765cc1

Browse files
Piyush7034SradhaMohanty5899Nandeesh778PrafulrakhadeRakshithb1
committed
[INJICERT-981] rebase with develop (inji#398)
* MOSIP-35628: Check and report CAPTCHA status only once during test execution. (inji#370) * MOSIP-40258 Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * MOSIP-28246 Removed unused variables from injicertify module Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * MOSIP-28246 Removed commented unused variables Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * MOSIP-35628 API - Capture info in the report whether Captcha is enabled on the target env or not Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * MOSIP-35628 Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * MOSIP-35628 Changed SNAPSHOT version Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * DSD-8335 Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * Removed previously added dependancy Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * Removed danubtech repository from Pom Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * Check and report CAPTCHA status only once during test execution. Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> * Removed getValueFromEsignetActuator() method Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> --------- Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1116] Add the Ledger search api. (inji#368) * Adding the Ledger search api. Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> * updated the PR with validation changes. Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> * Changed the key names in the CredentialLedgerSearchRequest as per specs. Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> * Resolved the comments by modified the service code and adding the testcases. Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> * Removed unused dependency and print statements. Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> * Resolved the comments by modifying the LedgerIssuanceTableCustomRepositoryImpl file. Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> * fix: resolve ApplicationContext failure in RenderingCredentialTemplateRepositoryTest by providing ObjectMapper bean Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> --------- Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Mosip 41674 migration changes (inji#366) * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> --------- Signed-off-by: techno-467 <prafulrakhade02@gmail.com> Co-authored-by: Prafulrakhade <prafulrakhade@users.noreply.github.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [MOSIP-42546] updated readme Signed-off-by: Rakshithb1 <rakshit.b@technoforte.co.in> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [MOSIP-42546] updated readme Signed-off-by: Rakshithb1 <rakshit.b@technoforte.co.in> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [MOSIP-42546] updated readme Signed-off-by: Rakshithb1 <rakshit.b@technoforte.co.in> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] rebasing develop with latest release changes (inji#395) * Fix status list db scripts (inji#367) Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1120] Remove vc sign config dependency and fix vc request (inji#372) * [INJICERT-1120] Move vcSignCryptoSuite from config to vc type table Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Change sdJwtVct to vct in credentialRequest Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Rename vcSignCryptoSuite to signatureCryptoSuite Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Update did.json with all verification methods Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJCIERT-988] Update credential-provider doc link in the docker-compose readme Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1135] Add credetial status to vc type and set credentialStatus from code (inji#376) * [INJICERT-1035] Add credetial status to vc type and set credentialStatus from code Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Add enum for credential status purpose Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> * [INJICERT-1135] Add list type for credential status Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1138] Add missing scripts for docker-compose setup (inji#374) * Update docker compose init scripts Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Remove multiple vc types for farmer vc Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Add new usec case setup md file for docker-compose (inji#364) Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Fix script in new-usecase md file Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Update Postgres-plugin-usecase.md file Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1144] [MOSIP-41674] Update plugin version and migration changes (inji#381) * Mosip 41674 migration changes (inji#366) * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> * [MOSIP-41674] central sonatype migration changes Signed-off-by: techno-467 <prafulrakhade02@gmail.com> --------- Signed-off-by: techno-467 <prafulrakhade02@gmail.com> Co-authored-by: Prafulrakhade <prafulrakhade@users.noreply.github.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1144] Update plugin version to 0.5.0-SNAPSHOT Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: techno-467 <prafulrakhade02@gmail.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Co-authored-by: Praful Rakhade <prafulrakhade02@gmail.com> Co-authored-by: Prafulrakhade <prafulrakhade@users.noreply.github.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1140][INJICERT-1141][INJICERT-1142] Credential Configuration API contract changes (inji#380) * Renaming credentials/configurations to credential-configuration Signed-off-by: jackjain <jackjain1995@gmail.com> * Rename fields in CredentialConfigurationDTO, context to contextURLs, credentialType to credentialTypes and order to credentialFieldsDisplayOrder Signed-off-by: jackjain <jackjain1995@gmail.com> * Update postman collection as per the renaming in credential configuration endpoint and request DTO Signed-off-by: jackjain <jackjain1995@gmail.com> * Adding .DS_Store file in gitignore Signed-off-by: jackjain <jackjain1995@gmail.com> * Add structured object instead of generic Map for display field in credential configuration DTO Signed-off-by: jackjain <jackjain1995@gmail.com> * [INJICERT-1141] Autoassign binding, signing and proof values for config apis (#1) * Add configurations for proof, binding methods and credential sign algos Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Auto assign proor, binding methods and signing alg values for config api Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Signed-off-by: jackjain <jackjain1995@gmail.com> * Adding structured object for credentialSubject field in credential configuration DTO, renaming the field to credentialSubjectDefinition Signed-off-by: jackjain <jackjain1995@gmail.com> * Renaming display field to metaDataDisplay, order to displayOrder in credential configuration Signed-off-by: jackjain <jackjain1995@gmail.com> * Adding a structured object for claims field in credential configuration Signed-off-by: jackjain <jackjain1995@gmail.com> * [INJICERT-1142] Fix mapping issues for entity and dto (#2) Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Signed-off-by: jackjain <jackjain1995@gmail.com> * Updating postman collection as per renaming done in credential configuration DTO fields Signed-off-by: jackjain <jackjain1995@gmail.com> * Fix review comments Signed-off-by: jackjain <jackjain1995@gmail.com> --------- Signed-off-by: jackjain <jackjain1995@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Co-authored-by: Piyush7034 <piyushshukla2100@gmail.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Add custom serializable CertificateResponseDTO class Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Add code review changes (inji#383) * [INJICERT-1145] Add code review changes Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Remove unwanted code Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Removed jsonld vc signer Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Add review comment changes Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Remove exisiting transaction from update credential status Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Fixed services review comments Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Critical Code Review fixes (inji#386) * Adding WellKnownController, deprecating well-known endpoints in issuance and removing well-known endpoint from credential-config controller Signed-off-by: jackjain <jackjain1995@gmail.com> * Adding validation for signatureCryptoSuite for ldp_vc and mso_mdoc formats, adding validation for signatureAlgo for sd-jwt format Signed-off-by: jackjain <jackjain1995@gmail.com> * removing the missed condition for signatureCryptoSuite field Signed-off-by: jackjain <jackjain1995@gmail.com> * Add separate fields for sdJWT and mso_mdoc claims in credential config request/response, storing the same in separate columns in DB Signed-off-by: jackjain <jackjain1995@gmail.com> * Using credentialConfigKeyId instead of ID in update, fetch and delete credential-configurations endpoints Signed-off-by: jackjain <jackjain1995@gmail.com> * Make signature crypto suite mandatory in credential-configuration request Signed-off-by: jackjain <jackjain1995@gmail.com> * Move CredentialConfigMapper to util package Signed-off-by: jackjain <jackjain1995@gmail.com> * Refactor parameter name for validateCredentialConfiguration method Signed-off-by: jackjain <jackjain1995@gmail.com> * Remove suspension status purpose from properties file Signed-off-by: jackjain <jackjain1995@gmail.com> * Removed cryptographic_binding_methods_supported, credential_signing_alg_values_supported and proof_types_supported from credential configuration request/response Signed-off-by: jackjain <jackjain1995@gmail.com> * Add handling for sdJWT VC format in the CacheKeyGenerator Signed-off-by: jackjain <jackjain1995@gmail.com> * Remove unused code related to issuer metadata fetch in VCIssuance and Certify services Signed-off-by: jackjain <jackjain1995@gmail.com> --------- Signed-off-by: jackjain <jackjain1995@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Add credential-ledger service and controller (inji#387) Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Changes to singatureCryptoSuite validation and well-know derivation of credential_signing_alg_values_supported field (inji#389) * make singatureCryptoSuite non-mandatory for sdJwt format and fix derivation of credential_signing_alg_values_supported when singatureCryptoSuite field is missing incase of sdJWT Signed-off-by: jackjain <jackjain1995@gmail.com> * fix unit test failure and add handling for missing signature algo for Data integrity proof scenario Signed-off-by: jackjain <jackjain1995@gmail.com> --------- Signed-off-by: jackjain <jackjain1995@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Remaining changes on inji#379 criticial PR (inji#390) * [INJICERT-1145] Removed stuff related to c4gt Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Host did keys for credential config entries only Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Move status list code from certify-service to status-list service Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * CHeck for all certificates Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] DID fix for data-integrity crypto suites (inji#391) Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Removed year from verification method name (inji#392) Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Update docker-compose after LSH (inji#393) Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Revert c4gt template files Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Update DMP_2024.yml Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Update c4gt_community.yml Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Update DMP_2024.yml Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Update c4gt_community.yml Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * Change release to develop for certify-service-with-plugins for dockerfile Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [INJICERT-1145] Adding cachePrefix via RedisCacheConfig setup (inji#396) * [INJICERT-1145] Adding cachePrefix via RedisCacheConfig setup Signed-off-by: jackjain <jackjain1995@gmail.com> * [INJICERT-1145] Rename the config for redis key prefix and refactor RedisCacheConfig code Signed-off-by: jackjain <jackjain1995@gmail.com> --------- Signed-off-by: jackjain <jackjain1995@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: techno-467 <prafulrakhade02@gmail.com> Signed-off-by: jackjain <jackjain1995@gmail.com> Co-authored-by: Praful Rakhade <prafulrakhade02@gmail.com> Co-authored-by: Prafulrakhade <prafulrakhade@users.noreply.github.com> Co-authored-by: Jack <jackjain1995@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [MOSIP-42546] updated readme Signed-off-by: Rakshithb1 <rakshit.b@technoforte.co.in> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> * [MOSIP-42546] updated readme Signed-off-by: Rakshithb1 <rakshit.b@technoforte.co.in> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> --------- Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com> Signed-off-by: Piyush7034 <piyushshukla2100@gmail.com> Signed-off-by: Nandeesh <nandeeshv0001@gmail.com> Signed-off-by: Vishwa <visu.vs1@gmail.com> Signed-off-by: techno-467 <prafulrakhade02@gmail.com> Signed-off-by: Rakshithb1 <rakshit.b@technoforte.co.in> Signed-off-by: jackjain <jackjain1995@gmail.com> Co-authored-by: Sradha Mohanty <mohantysradha10@gmail.com> Co-authored-by: Nandeesh778 <144665029+Nandeesh778@users.noreply.github.com> Co-authored-by: Praful Rakhade <prafulrakhade02@gmail.com> Co-authored-by: Prafulrakhade <prafulrakhade@users.noreply.github.com> Co-authored-by: Rakshithb1 <rakshit.b@technoforte.co.in> Co-authored-by: Jack <jackjain1995@gmail.com> # Conflicts: # README.md # api-test/pom.xml # certify-core/src/main/java/io/mosip/certify/core/dto/CredentialConfigurationDTO.java # certify-core/src/main/java/io/mosip/certify/core/spi/CredentialLedgerService.java # certify-core/src/main/java/io/mosip/certify/core/spi/CredentialStatusService.java # certify-service/src/main/java/io/mosip/certify/controller/CredentialLedgerController.java # certify-service/src/main/java/io/mosip/certify/controller/CredentialStatusController.java # certify-service/src/main/java/io/mosip/certify/credential/SDJWT.java # certify-service/src/main/java/io/mosip/certify/credential/W3CJsonLD.java # certify-service/src/main/java/io/mosip/certify/proof/JwtProofValidator.java # certify-service/src/main/java/io/mosip/certify/repository/LedgerIssuanceTableCustomRepositoryImpl.java # certify-service/src/main/java/io/mosip/certify/services/CertifyIssuanceServiceImpl.java # certify-service/src/main/java/io/mosip/certify/services/CredentialConfigurationServiceImpl.java # certify-service/src/main/java/io/mosip/certify/services/CredentialLedgerServiceImpl.java # certify-service/src/main/java/io/mosip/certify/services/CredentialStatusServiceImpl.java # certify-service/src/main/java/io/mosip/certify/services/StatusListCredentialService.java # certify-service/src/main/java/io/mosip/certify/services/StatusListUpdateBatchJob.java # certify-service/src/main/java/io/mosip/certify/utils/CredentialConfigMapper.java # certify-service/src/main/java/io/mosip/certify/utils/CredentialUtils.java # certify-service/src/main/java/io/mosip/certify/utils/DIDDocumentUtil.java # certify-service/src/main/java/io/mosip/certify/utils/VCIssuanceUtil.java # certify-service/src/main/java/io/mosip/certify/validators/credentialconfigvalidators/LdpVcCredentialConfigValidator.java # certify-service/src/main/java/io/mosip/certify/validators/credentialconfigvalidators/MsoMdocCredentialConfigValidator.java # certify-service/src/main/java/io/mosip/certify/validators/credentialconfigvalidators/SdJwtCredentialConfigValidator.java # certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java # certify-service/src/main/resources/application-local.properties # certify-service/src/test/java/io/mosip/certify/credential/SDJWTTest.java # certify-service/src/test/java/io/mosip/certify/credential/W3CJsonLDTest.java # certify-service/src/test/java/io/mosip/certify/services/CertifyIssuanceServiceImplTest.java # certify-service/src/test/java/io/mosip/certify/services/CredentialConfigurationServiceImplTest.java # certify-service/src/test/java/io/mosip/certify/services/CredentialStatusServiceImplTest.java # certify-service/src/test/java/io/mosip/certify/utils/DIDDocumentUtilTest.java # certify-service/src/test/java/io/mosip/certify/validators/credentialconfigvalidators/LdpVcCredentialConfigValidatorTest.java # certify-service/src/test/java/io/mosip/certify/validators/credentialconfigvalidators/MsoMdocCredentialConfigValidatorTest.java # certify-service/src/test/java/io/mosip/certify/validators/credentialconfigvalidators/SdJwtCredentialConfigValidatorTest.java # certify-service/src/test/resources/application-test.properties # db_scripts/inji_certify/ddl/certify-credential_status_transaction.sql # db_upgrade_script/mosip_certify/sql/0.11.0_to_0.12.0_rollback.sql # db_upgrade_script/mosip_certify/sql/0.11.0_to_0.12.0_upgrade.sql # deploy/redis/install.sh # docker-compose/docker-compose-injistack/Add-New-Usecase-Using-PostgresPlugin.md # docker-compose/docker-compose-injistack/README.md # docker-compose/docker-compose-injistack/certify_init.sql # docker-compose/docker-compose-injistack/config/certify-csvdp-farmer.properties # docker-compose/docker-compose-injistack/config/certify-default.properties # docs/postman-collections/inji-certify-with-mock-identity.postman_collection.json # docs/postman-collections/inji-certify-with-mock-mdoc-vci.postman_collection.json # docs/postman-collections/inji-certify-with-sunbird-insurance.postman_collection.json
1 parent c65beeb commit 2765cc1

11 files changed

Lines changed: 143 additions & 18 deletions

certify-service/src/main/java/io/mosip/certify/credential/W3CJsonLD.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.springframework.beans.factory.annotation.Value;
3535
import org.springframework.stereotype.Component;
3636

37+
import foundation.identity.jsonld.JsonLDException;
3738
import foundation.identity.jsonld.JsonLDObject;
3839
import info.weboftrust.ldsignatures.LdProof;
3940
import io.mosip.certify.api.dto.VCResult;

certify-service/src/main/java/io/mosip/certify/services/CertifyIssuanceServiceImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,14 @@ private VCResult<?> getVerifiableCredential(CredentialRequest credentialRequest,
220220

221221
// Common logic for all formats
222222
templateParams.put(Constants.TEMPLATE_NAME, templateName);
223-
templateParams.put(Constants.DID_URL, didUrl);
223+
templateParams.put(Constants.ISSUER_URI, issuerURI);
224+
if (statusListEnabled) {
225+
addCredentialStatus(jsonObject);
226+
}
224227
if (!StringUtils.isEmpty(renderTemplateId)) {
225228
templateParams.put(Constants.RENDERING_TEMPLATE_ID, renderTemplateId);
226229
}
227-
jsonObject.put("_holderId", holderId);
230+
jsonObject.put("_holderId", holderId);
228231
templateParams.putAll(jsonObject.toMap());
229232
if(!StringUtils.isEmpty(idPrefix)) {
230233
templateParams.put(VCDMConstants.CREDENTIAL_ID, idPrefix + UUID.randomUUID());

certify-service/src/main/java/io/mosip/certify/services/CredentialConfigurationServiceImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.danubetech.dataintegrity.suites.DataIntegrityProofDataIntegritySuite;
99
import com.danubetech.dataintegrity.suites.DataIntegritySuites;
1010
import io.mosip.certify.core.constants.Constants;
11-
import io.mosip.certify.core.constants.ErrorConstants;
1211
import io.mosip.certify.core.constants.VCFormats;
1312
import io.mosip.certify.core.dto.*;
1413
import io.mosip.certify.core.exception.CertifyException;
@@ -179,8 +178,8 @@ private void validateKeyAliasMapperConfiguration(CredentialConfigurationDTO cred
179178
}
180179

181180
@Override
182-
public CredentialConfigurationDTO getCredentialConfigurationById(String credentialConfigKeyId) {
183-
Optional<CredentialConfig> optional = credentialConfigRepository.findByCredentialConfigKeyId(credentialConfigKeyId);
181+
public CredentialConfigurationDTO getCredentialConfigurationById(String id) throws JsonProcessingException {
182+
Optional<CredentialConfig> optional = credentialConfigRepository.findById(id);
184183

185184
if(optional.isEmpty()) {
186185
throw new CredentialConfigException(ErrorConstants.CONFIG_NOT_FOUND_BY_ID, "Configuration not found for the provided ID: " + credentialConfigKeyId);

certify-service/src/main/java/io/mosip/certify/services/StatusListCredentialService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.mosip.certify.credential.Credential;
1010
import io.mosip.certify.credential.CredentialFactory;
1111
import io.mosip.certify.entity.StatusListCredential;
12+
import io.mosip.certify.repository.StatusListAvailableIndicesRepository;
1213
import io.mosip.certify.repository.StatusListCredentialRepository;
1314
import io.mosip.certify.utils.BitStringStatusListUtils;
1415
import io.mosip.certify.vcformatters.VCFormatter;

certify-service/src/main/java/io/mosip/certify/utils/DIDDocumentUtil.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.springframework.stereotype.Component;
4141

4242
@Slf4j
43-
@Component
4443
public class DIDDocumentUtil {
4544
@Autowired
4645
KeymanagerService keymanagerService;
@@ -130,11 +129,11 @@ private static Map<String, Object> generateVerificationMethod(String signatureAl
130129
throw new CertifyException(ErrorConstants.VERIFICATION_METHOD_GENERATION_FAILED, "Exception occurred while generating verification method for given signature algorithm: " + signatureAlgo);
131130
}
132131

133-
verificationMethod.put("id", didUrl + "#" + kid);
134-
return verificationMethod;
132+
didDocument.put("verificationMethod", Collections.singletonList(verificationMethod));
133+
return didDocument;
135134
}
136135

137-
private static Map<String, Object> generateECR1VerificationMethod(PublicKey publicKey, String didUrl) {
136+
private static Map<String, Object> generateECR1VerificationMethod(PublicKey publicKey, String issuerURI, String issuerPublicKeyURI) {
138137
ECPublicKey ecPublicKey = (ECPublicKey) publicKey;
139138
BigInteger yBI = ecPublicKey.getW().getAffineY();
140139
byte prefixByte = yBI.testBit(0) ? (byte) 0x03 : (byte) 0x02;

certify-service/src/test/java/io/mosip/certify/services/CertifyIssuanceServiceImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import io.mosip.certify.utils.LedgerUtils;
3434
import io.mosip.certify.vcformatters.VCFormatter;
3535
import io.mosip.kernel.keymanagerservice.service.KeymanagerService;
36+
3637
import org.json.JSONObject;
3738
import org.junit.Before;
3839
import org.junit.Test;
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package io.mosip.certify.services;
2+
3+
import io.mosip.certify.core.dto.CredentialLedgerSearchRequest;
4+
import io.mosip.certify.core.dto.CredentialStatusResponse;
5+
import io.mosip.certify.core.exception.CertifyException;
6+
import io.mosip.certify.entity.Ledger;
7+
import io.mosip.certify.repository.LedgerRepository;
8+
import org.junit.Assert;
9+
import org.junit.Before;
10+
import org.junit.Test;
11+
import org.junit.runner.RunWith;
12+
import org.mockito.InjectMocks;
13+
import org.mockito.Mock;
14+
import org.mockito.MockitoAnnotations;
15+
import org.mockito.junit.MockitoJUnitRunner;
16+
17+
import java.time.OffsetDateTime;
18+
import java.util.ArrayList;
19+
import java.util.Collections;
20+
import java.util.List;
21+
import java.util.Map;
22+
23+
import static org.junit.Assert.assertThrows;
24+
import static org.junit.Assert.assertTrue;
25+
import static org.mockito.Mockito.when;
26+
27+
@RunWith(MockitoJUnitRunner.class)
28+
public class CredentialLedgerServiceTestImpl {
29+
@Mock
30+
private LedgerRepository ledgerRepository;
31+
32+
@InjectMocks
33+
private CredentialLedgerServiceImpl ledgerService;
34+
35+
@Before
36+
public void setUp() {
37+
MockitoAnnotations.openMocks(this);
38+
}
39+
40+
@Test
41+
public void searchCredentials_ValidRequestWithAllFields_ReturnsResult() {
42+
CredentialLedgerSearchRequest request = new CredentialLedgerSearchRequest();
43+
request.setIssuerId("did:web:test");
44+
request.setCredentialType("VerifiableCredential");
45+
request.setCredentialId("67823e96-fda0-4eba-9828-a32a8d22cc42");
46+
request.setIndexedAttributesEquals(Map.of("recipientEmail", "abc@example.com"));
47+
48+
Ledger ledger = createLedger("67823e96-fda0-4eba-9828-a32a8d22cc42");
49+
when(ledgerRepository.findBySearchRequest(request)).thenReturn(List.of(ledger));
50+
51+
List<CredentialStatusResponse> results = ledgerService.searchCredentialLedger(request);
52+
53+
Assert.assertEquals(1, results.size());
54+
Assert.assertEquals("67823e96-fda0-4eba-9828-a32a8d22cc42", results.get(0).getCredentialId());
55+
}
56+
57+
@Test
58+
public void searchCredentials_ValidRequestNoResults_ReturnsEmptyList() {
59+
CredentialLedgerSearchRequest request = new CredentialLedgerSearchRequest();
60+
request.setIssuerId("did:web:test");
61+
request.setCredentialType("VerifiableCredential");
62+
request.setIndexedAttributesEquals(Map.of("recipientName", "Unknown"));
63+
64+
when(ledgerRepository.findBySearchRequest(request)).thenReturn(Collections.emptyList());
65+
66+
List<CredentialStatusResponse> results = ledgerService.searchCredentialLedger(request);
67+
68+
assertTrue(results.isEmpty());
69+
}
70+
71+
@Test
72+
public void searchCredentials_NullIndexedAttrs_ThrowsCertifyException() {
73+
CredentialLedgerSearchRequest request = new CredentialLedgerSearchRequest();
74+
request.setIssuerId("did:web:test");
75+
request.setCredentialType("VerifiableCredential");
76+
request.setIndexedAttributesEquals(null);
77+
78+
CertifyException ex = assertThrows(CertifyException.class, () -> ledgerService.searchCredentialLedger(request));
79+
Assert.assertEquals("INVALID_SEARCH_CRITERIA", ex.getErrorCode());
80+
}
81+
82+
@Test
83+
public void searchCredentials_EmptyIndexedAttrs_ThrowsCertifyException() {
84+
CredentialLedgerSearchRequest request = new CredentialLedgerSearchRequest();
85+
request.setIssuerId("did:web:test");
86+
request.setCredentialType("VerifiableCredential");
87+
request.setIndexedAttributesEquals(Collections.emptyMap());
88+
89+
CertifyException ex = assertThrows(CertifyException.class, () -> ledgerService.searchCredentialLedger(request));
90+
Assert.assertEquals("INVALID_SEARCH_CRITERIA", ex.getErrorCode());
91+
}
92+
93+
@Test
94+
public void searchCredentials_RepositoryThrowsException_ThrowsCertifyException() {
95+
CredentialLedgerSearchRequest request = new CredentialLedgerSearchRequest();
96+
request.setIssuerId("did:web:test");
97+
request.setCredentialType("VerifiableCredential");
98+
request.setIndexedAttributesEquals(Map.of("recipientEmail", "abc@example.com"));
99+
100+
when(ledgerRepository.findBySearchRequest(request)).thenThrow(new RuntimeException("DB error"));
101+
102+
CertifyException ex = assertThrows(CertifyException.class, () -> ledgerService.searchCredentialLedger(request));
103+
Assert.assertEquals("SEARCH_CREDENTIALS_FAILED", ex.getErrorCode());
104+
}
105+
106+
private Ledger createLedger(String credentialId) {
107+
Ledger ledger = new Ledger();
108+
ledger.setId(1L);
109+
ledger.setCredentialId(credentialId);
110+
ledger.setIssuerId("did:web:Nandeesh778.github.io:local-test:certify_did");
111+
ledger.setIssueDate(OffsetDateTime.parse("2025-06-10T10:23:24Z"));
112+
ledger.setExpirationDate(null);
113+
ledger.setCredentialType("VerifiableCredential");
114+
ledger.setCredentialStatusDetails(new ArrayList<>());
115+
return ledger;
116+
}
117+
118+
}

certify-service/src/test/java/io/mosip/certify/utils/DIDDocumentUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void testGenerateVerificationMethodUnsupportedAlgorithmViaReflection() {
135135
ReflectionTestUtils.invokeMethod(didDocumentUtil, "generateVerificationMethod", signatureCryptoSuite, certificateString, didUrl, kid);
136136
});
137137

138-
assertEquals(ErrorConstants.UNSUPPORTED_ALGORITHM, exception.getErrorCode());
138+
assertEquals("unsupported_algorithm", exception.getErrorCode());
139139
}
140140

141141
@Test

docs/postman-collections/inji-certify-with-mock-identity.postman_collection.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,12 +2492,13 @@
24922492
}
24932493
},
24942494
"url": {
2495-
"raw": "{{certifyurl}}/credential-configurations",
2495+
"raw": "{{certifyurl}}/credentials/configurations",
24962496
"host": [
24972497
"{{certifyurl}}"
24982498
],
24992499
"path": [
2500-
"credential-configurations"
2500+
"credentials",
2501+
"configurations"
25012502
]
25022503
}
25032504
},
@@ -2536,7 +2537,7 @@
25362537
}
25372538
},
25382539
"url": {
2539-
"raw": "{{certifyurl}}/credential-configurations/{{configId}}",
2540+
"raw": "{{certifyurl}}/credentials/configurations/{{configId}}",
25402541
"host": [
25412542
"{{certifyurl}}"
25422543
],

docs/postman-collections/inji-certify-with-mock-mdoc-vci.postman_collection.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,13 @@
586586
}
587587
},
588588
"url": {
589-
"raw": "{{certifyurl}}/credential-configurations/{{configId}}",
589+
"raw": "{{certifyurl}}/credentials/configurations/{{configId}}",
590590
"host": [
591591
"{{certifyurl}}"
592592
],
593593
"path": [
594-
"credential-configurations",
594+
"credentials",
595+
"configurations",
595596
"{{configId}}"
596597
]
597598
}

0 commit comments

Comments
 (0)