1212import dev .sunbirdrc .registry .exception .SignatureException ;
1313import dev .sunbirdrc .registry .middleware .util .JSONUtil ;
1414import dev .sunbirdrc .registry .service .CredentialSchemaService ;
15+ import dev .sunbirdrc .registry .service .DIDService ;
1516import dev .sunbirdrc .registry .service .ICertificateService ;
1617import dev .sunbirdrc .registry .service .SignatureService ;
1718import org .apache .commons .lang3 .exception .ExceptionUtils ;
@@ -56,8 +57,10 @@ public class SignatureV2ServiceImpl implements SignatureService, ICertificateSer
5657 @ Value ("${signature.v2.getRevocationListURL}" )
5758 private String getRevocationListURL ;
5859
59- private static final String credentialMethod = "rcw" ;
60- private static final String credentialIssuerMethod = "abc" ;
60+ @ Value ("${signature.v2.credentialDidMethod}" )
61+ private String credentialMethod ;
62+ @ Value ("${signature.v2.issuerDidMethod}" )
63+ private String credentialIssuerMethod ;
6164
6265 @ Autowired
6366 protected RetryRestTemplate retryRestTemplate ;
@@ -66,7 +69,7 @@ public class SignatureV2ServiceImpl implements SignatureService, ICertificateSer
6669 @ Autowired
6770 private CredentialSchemaService credentialSchemaService ;
6871 @ Autowired
69- private dev . sunbirdrc . registry . service . DIDService DIDService ;
72+ private DIDService didService ;
7073
7174 @ Override
7275 public Object sign (Map <String , Object > propertyValue ) throws SignatureException .UnreachableException , SignatureException .CreationException {
@@ -99,7 +102,7 @@ public boolean verify(Object propertyValue) throws SignatureException.Unreachabl
99102
100103 @ Override
101104 public String getKey (String keyId ) throws SignatureException .UnreachableException , SignatureException .KeyNotFoundException {
102- ObjectNode didDocument = (ObjectNode ) DIDService .resolveDid (keyId );
105+ ObjectNode didDocument = (ObjectNode ) didService .resolveDid (keyId );
103106 ArrayNode verificationMethods = (ArrayNode ) didDocument .get ("verificationMethod" );
104107 AtomicReference <JsonNode > verificationMethod = new AtomicReference <>();
105108 verificationMethods .elements ().forEachRemaining (vm -> {
@@ -131,7 +134,7 @@ public Object getCertificate(JsonNode credentialId, String entityName, String en
131134 return getCredentialById (credentialId .asText (), mediaType , templateId , template );
132135 }
133136
134- private JsonNode issueCredential (String title , Object credentialTemplate , JsonNode input ) throws Exception {
137+ public JsonNode issueCredential (String title , Object credentialTemplate , JsonNode input ) throws Exception {
135138 // Render the credential using credential template
136139 Handlebars hb = new Handlebars ();
137140 String templateJsonString = null ;
@@ -152,7 +155,7 @@ private JsonNode issueCredential(String title, Object credentialTemplate, JsonNo
152155
153156
154157 // ensure issuer did
155- String issuerDid = DIDService .ensureDidForName (credential .get ("issuer" ).asText (), credentialIssuerMethod );
158+ String issuerDid = didService .ensureDidForName (credential .get ("issuer" ).asText (), credentialIssuerMethod );
156159 credential .set ("issuer" , JsonNodeFactory .instance .textNode (issuerDid ));
157160
158161 // Wire the create credential request payload
0 commit comments