Skip to content

Commit

Permalink
chore: add https scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibogus committed Apr 30, 2024
1 parent a0dc676 commit ae15bef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ private StringPool() {
public static final String PUBLIC_KEY = "PUBLIC KEY";
public static final String VERIFICATION_METHOD_TYPE = "JsonWebKey2020";
public static final String ASSERTION_METHOD = "assertionMethod";
public static final String HTTPS_SCHEME = "https://";
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import java.util.UUID;
import java.util.stream.Collectors;

import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.ASSERTION_METHOD;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COLON_SEPARATOR;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.PRIVATE_KEY;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.PUBLIC_KEY;
Expand Down Expand Up @@ -172,10 +173,10 @@ private Did getDidFromDidString(String didString) {
}

public DidDocument updateDidDocument(DidDocument didDocument, VerificationMethod jwkVerificationMethod) {
List<URI> assertionMethod = (List<URI>)didDocument.get("assertionMethod");
List<URI> assertionMethod = (List<URI>)didDocument.get(ASSERTION_METHOD);
List<URI> updatedAssertionMethod = new ArrayList<>(assertionMethod);
updatedAssertionMethod.add(jwkVerificationMethod.getId());
didDocument.put("assertionMethod", updatedAssertionMethod);
didDocument.put(ASSERTION_METHOD, updatedAssertionMethod);

List<VerificationMethod> methods = didDocument.getVerificationMethods();
List<VerificationMethod> updatedMethods = new ArrayList<>(methods);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@
import java.util.Map;
import java.util.UUID;

import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.ASSERTION_METHOD;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.COLON_SEPARATOR;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.ED_25519;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.HTTPS_SCHEME;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.REFERENCE_KEY;
import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.VAULT_ACCESS_TOKEN;
import static org.eclipse.tractusx.managedidentitywallets.utils.CommonUtils.getJwkVerificationMethod;
Expand Down Expand Up @@ -315,10 +317,9 @@ private DidDocument buildDidDocument(String bpn, Did did, VerificationMethod jwk
didDocument.put("@context", mutableContext);
didDocument = DidDocument.fromJson(didDocument.toJson());

didDocument.put("assertionMethod", List.of(jwkVerificationMethod.getId()));

didDocument.put(ASSERTION_METHOD, List.of(jwkVerificationMethod.getId()));
Map<String, Object> serviceData = Map.of("id", did.toUri(), "type", "CredentialService",
"serviceEndpoint", miwSettings.host() + "/api/token");
"serviceEndpoint", HTTPS_SCHEME + miwSettings.host() + "/api/token");
org.eclipse.tractusx.ssi.lib.model.did.Service service = new org.eclipse.tractusx.ssi.lib.model.did.Service(serviceData);
didDocument.put("service", List.of(service));

Expand Down

0 comments on commit ae15bef

Please sign in to comment.