Skip to content

Commit

Permalink
[INJICERT-657] remove & rename files
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Vardhan <[email protected]>
  • Loading branch information
vharsh committed Dec 17, 2024
1 parent 23e8387 commit a428451
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ public class Constants {
public static final String ED25519_REF_ID = "ED25519_SIGN";
public static final String TEMPLATE_NAME = "templateName";
public static final String ISSUER_URI = "issuerURI";
public static final String RENDERING_TEMPLATE = "svgTemplate";
public static final String RENDERING_TEMPLATE = "renderingTemplateId";
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
package io.mosip.certify.core.exception;

import io.mosip.certify.core.constants.ErrorConstants;

public class RenderingTemplateException extends RuntimeException {
private String errorCode;

public RenderingTemplateException() {
super(ErrorConstants.UNKNOWN_ERROR);
this.errorCode = ErrorConstants.UNKNOWN_ERROR;
}

public RenderingTemplateException(String errorCode) {
super(errorCode);
this.errorCode = errorCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
@EnableAsync
@EnableCaching
@SpringBootApplication(scanBasePackages = "io.mosip.certify,"+
"io.mosip.certify.repository," +
"io.mosip.certify.entity," +
"io.mosip.kernel.crypto," +
"io.mosip.kernel.keymanager.hsm," +
"io.mosip.kernel.cryptomanager," +
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import io.mosip.certify.core.util.SecurityHelperService;
import io.mosip.certify.api.spi.DataProviderPlugin;
import io.mosip.certify.services.vcformatters.VCFormatter;
import io.mosip.certify.services.vcsigners.VCSigner;
import io.mosip.certify.validators.CredentialRequestValidator;
import io.mosip.certify.exception.InvalidNonceException;
import io.mosip.certify.proof.ProofValidator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* 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.services.vcsigners;
package io.mosip.certify.services;

import foundation.identity.jsonld.JsonLDException;
import foundation.identity.jsonld.JsonLDObject;
Expand Down Expand Up @@ -31,7 +31,7 @@
import java.util.Map;

/**
* KeymanagerLibSigner is a VCSigner which uses the Certify embedded
* JsonLDVCSigner is a VCSigner which uses the Certify embedded
* keymanager to perform VC signing tasks for JSON LD VCs.
* These are the known external requirements:
* - the public key must be pre-hosted for the VC & should be available
Expand All @@ -41,15 +41,15 @@
*/
@Slf4j
@Service
public class KeymanagerLibSigner implements VCSigner {
public class JsonLDVCSigner implements VCSigner {

@Autowired
ProofGenerator proofGenerator;
@Value("${mosip.certify.data-provider-plugin.issuer-public-key-uri}")
private String issuerPublicKeyURI;

@Override
public VCResult<JsonLDObject> attachSignature(String unSignedVC, Map<String, String> defaultSettings) {
public VCResult<JsonLDObject> attachSignature(String unSignedVC, Map<String, String> keyReferenceDetails) {
// Can the below lines be done at Templating side itself ?
VCResult<JsonLDObject> VC = new VCResult<>();
JsonLDObject jsonLDObject = JsonLDObject.fromJson(unSignedVC);
Expand Down Expand Up @@ -85,7 +85,7 @@ public VCResult<JsonLDObject> attachSignature(String unSignedVC, Map<String, Str
throw new CertifyException("Error during canonicalization");
}
String vcEncodedHash = Base64.getUrlEncoder().encodeToString(vcHashBytes);
LdProof ldProofWithJWS = proofGenerator.generateProof(vcLdProof, vcEncodedHash, defaultSettings);
LdProof ldProofWithJWS = proofGenerator.generateProof(vcLdProof, vcEncodedHash, keyReferenceDetails);
ldProofWithJWS.addToJsonLDObject(jsonLDObject);
VC.setCredential(jsonLDObject);
return VC;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.certify.services.vcsigners;
package io.mosip.certify.services;

import io.mosip.certify.api.dto.VCResult;

Expand All @@ -9,5 +9,5 @@
* return a signed VCResult.
*/
public interface VCSigner {
VCResult<?> attachSignature(String unSignedVC, Map<String, String> defaultSettings);
VCResult<?> attachSignature(String unSignedVC, Map<String, String> keyReferenceDetails);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mosip.certify.security.ignore-csrf-urls=**/actuator/**,/favicon.ico,**/error,\
**/issuance/**,**/system-info/**

mosip.certify.security.ignore-auth-urls=/actuator/**,**/error,**/swagger-ui/**,\
**/v3/api-docs/**, **/issuance/**,/system-info/**,/rendering-templateKey/**
**/v3/api-docs/**, **/issuance/**,/system-info/**,/rendering-template/**


## ------------------------------------------ Discovery openid-configuration -------------------------------------------
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.mosip.certify.api.spi.AuditPlugin;
import io.mosip.certify.api.spi.DataProviderPlugin;
import io.mosip.certify.services.vcformatters.VCFormatter;
import io.mosip.certify.services.vcsigners.VCSigner;
import io.mosip.certify.core.constants.ErrorConstants;
import io.mosip.certify.core.constants.VCFormats;
import io.mosip.certify.core.dto.CredentialDefinition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.certify.services.vcsigners;
package io.mosip.certify.services;

import foundation.identity.jsonld.JsonLDObject;
import info.weboftrust.ldsignatures.LdProof;
Expand All @@ -23,13 +23,13 @@
import java.util.Map;

@RunWith(MockitoJUnitRunner.class)
public class KeymanagerLibSignerTest {
public class JsonLDVCSignerTest {
@Mock
SignatureService signatureService;
@Mock
ProofGenerator signProps;
@InjectMocks
private KeymanagerLibSigner signer;
private JsonLDVCSigner jsonLDVCSigner;
private static final String VC_1 = """
{
"@context": [
Expand Down Expand Up @@ -64,7 +64,7 @@ public class KeymanagerLibSignerTest {

@Before
public void setup() {
ReflectionTestUtils.setField(signer, "issuerPublicKeyURI", "https://example.com/sample.pub.key.json/");
ReflectionTestUtils.setField(jsonLDVCSigner, "issuerPublicKeyURI", "https://example.com/sample.pub.key.json/");
}

@Test
Expand All @@ -84,7 +84,7 @@ public void testAttachSignatureSuccess_VC2() {
defaultSettings.put(Constants.APPLICATION_ID, "fake-application-id");
defaultSettings.put(Constants.REFERENCE_ID, "fake-reference-id");
// invoke
VCResult<JsonLDObject> vcResult = signer.attachSignature(templatedVC, defaultSettings);
VCResult<JsonLDObject> vcResult = jsonLDVCSigner.attachSignature(templatedVC, defaultSettings);

// test
assert vcResult != null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_VC_SIGN_RSA', 1095, 60, 'NA', true, 'mosipadmin', now());
INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_VC_SIGN_ED25519', 1095, 60, 'NA', true, 'mosipadmin', now());
INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('BASE', 1095, 60, 'NA', true, 'mosipadmin', now());

Expand Down
Loading

0 comments on commit a428451

Please sign in to comment.