Skip to content

Commit

Permalink
fix: resolving by kid on upper level did documents (#44)
Browse files Browse the repository at this point in the history
* commit: DDCCGW - resolving by kid on upper level did documents

* Replace StringBuffer with StringBuilder

Signed-off-by: Kothari <[email protected]>

---------

Signed-off-by: Kothari <[email protected]>
Co-authored-by: Kothari <[email protected]>
  • Loading branch information
dattatrayamote and kotharikaushal authored Sep 2, 2024
1 parent e640777 commit a7a478b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,23 @@ private String getListPathElement(boolean ref) {
return "";
}
}

public String generateTrustListVerificationId(SignerInformationEntity signerInformationEntity) {

String defaultPath = signerInformationEntity.getDomain()
+ SEPARATOR_DID_PATH + getParticipantCode(signerInformationEntity.getCountry())
+ SEPARATOR_DID_PATH + getMappedGroupName(signerInformationEntity.getGroup())
+ SEPARATOR_DID_PATH + encodeKid(signerInformationEntity.getKid());

StringBuilder stringBuilder = new StringBuilder();
String[] pathArray = defaultPath.split(SEPARATOR_DID_PATH);

for (int i = path.size(); i <= pathArray.length - 1; i++) {
stringBuilder.append(SEPARATOR_DID_PATH + pathArray[i]);
}

return getDocumentId(false) + stringBuilder;
}
}

/**
Expand Down Expand Up @@ -555,7 +572,7 @@ private void addTrustListEntry(DidTrustList trustList,

DidTrustListEntry trustListEntry = new DidTrustListEntry();
trustListEntry.setType("JsonWebKey2020");
trustListEntry.setId(specification.getEntryId(encodeKid(signerInformationEntity.getKid())));
trustListEntry.setId(specification.generateTrustListVerificationId(signerInformationEntity));
trustListEntry.setController(specification.getDocumentId(false));
publicKeyJwk.setKid(encodeKid(signerInformationEntity.getKid()));
trustListEntry.setPublicKeyJwk(publicKeyJwk);
Expand Down
Loading

0 comments on commit a7a478b

Please sign in to comment.