Skip to content

Commit

Permalink
feat: change in create VP API, type and name removed from summary VC
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-vavdiya committed Jun 13, 2023
1 parent d7f9096 commit a6a05e1
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
import org.springframework.util.StringUtils;

import java.net.URI;
import java.net.URLDecoder;
import java.net.http.HttpClient;
import java.nio.charset.Charset;
import java.util.*;

/**
Expand Down Expand Up @@ -101,13 +99,18 @@ protected SpecificationUtil<HoldersCredential> getSpecificationUtil() {
* @return the map
*/
public Map<String, Object> createPresentation(Map<String, Object> data, boolean asJwt, String audience, String callerBpn) {


Map<String, Object> response = new HashMap<>();

String holderIdentifier = data.get(StringPool.HOLDER_IDENTIFIER).toString();

//check if holder wallet is in the system
Wallet holderWallet = commonService.getWalletByIdentifier(holderIdentifier);

//validate BPN access - Issuer(Creator) of VP must be caller Issuer of VP must be holder of VC
Validate.isFalse(holderWallet.getBpn().equalsIgnoreCase(callerBpn)).launch(new ForbiddenException("Holder identifier is not matching with request BPN(from the token)"));


List<Map<String, Object>> verifiableCredentialList = (List<Map<String, Object>>) data.get(StringPool.VERIFIABLE_CREDENTIALS);

Expand All @@ -120,12 +123,6 @@ public Map<String, Object> createPresentation(Map<String, Object> data, boolean
verifiableCredentials.add(verifiableCredential);
});

String issuerDidString = URLDecoder.decode(verifiableCredentials.get(0).getIssuer().toString(), Charset.defaultCharset());
Did issuerDid = DidParser.parse(verifiableCredentials.get(0).getIssuer());
commonService.getWalletByIdentifier(issuerDidString);

//validate BPN access - Issuer(Creator) of VP must be caller Issuer of VP must be holder of VC
Validate.isFalse(holderWallet.getBpn().equalsIgnoreCase(callerBpn)).launch(new ForbiddenException("Issuer wallet BPN is not matching with request BPN(from the token)"));

if (asJwt) {

Expand Down

0 comments on commit a6a05e1

Please sign in to comment.