From ef961a54a24b30b4db18203532c4db8a3916c480 Mon Sep 17 00:00:00 2001 From: Mustafa Alsalfiti Date: Tue, 5 Mar 2024 14:24:52 +0100 Subject: [PATCH] fix: add asJwt as query param and fix exceptions --- .../IssuersCredentialControllerApiDocs.java | 16 +++++++++++ .../constant/StringPool.java | 1 + .../HoldersCredentialController.java | 5 ++-- .../IssuersCredentialController.java | 27 ++++++++++++------- .../dto/IssueDismantlerCredentialRequest.java | 4 --- .../dto/IssueFrameworkCredentialRequest.java | 2 -- .../dto/IssueMembershipCredentialRequest.java | 5 +--- .../service/HoldersCredentialService.java | 3 ++- .../service/IssuersCredentialService.java | 14 +++++----- .../service/PresentationService.java | 2 +- .../service/WalletKeyService.java | 1 + .../utils/CommonUtils.java | 8 +++--- ...eCredentialIssuerEqualProofSignerTest.java | 4 +-- .../vp/PresentationTest.java | 2 -- 14 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java index 37b43f503..8b5cc4a0e 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/apidocs/IssuersCredentialControllerApiDocs.java @@ -6,6 +6,7 @@ import java.lang.annotation.Target; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.parameters.RequestBody; @@ -1176,4 +1177,19 @@ public class IssuersCredentialControllerApiDocs { }) public @interface IssueVerifiableCredentialUsingBaseWalletApiDocs { } + + + @Parameter(description = "Specifies whether the VC (Verifiable Credential) should be created as a JWT (JSON Web Token). " + + + "If set to true, the VC will be generated in JWT format" + + + "Setting this parameter to false will result in the VC being created as JSON-LD " + + "Defaults to false if not specified.", examples = { + @ExampleObject(name = "Create VC as JWT", value = "true"), + @ExampleObject(name = "Do not create VC as JWT", value = "false") + }) + @Target(ElementType.PARAMETER) + @Retention(RetentionPolicy.RUNTIME) + public @interface AsJwtParam { + } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java index af0baf346..045c9e15b 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/constant/StringPool.java @@ -104,4 +104,5 @@ private StringPool() { public static final String PUBLIC_KEY = "PUBLIC KEY"; public static final String VC_JWT_KEY = "jwt"; + public static final String AS_JWT = "asJwt"; } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java index ae614c96d..3d6621702 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/HoldersCredentialController.java @@ -28,6 +28,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.managedidentitywallets.apidocs.HoldersCredentialControllerApiDocs.GetCredentialsApiDocs; import org.eclipse.tractusx.managedidentitywallets.apidocs.HoldersCredentialControllerApiDocs.IssueCredentialApiDoc; +import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.AsJwtParam; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialsResponse; import org.eclipse.tractusx.managedidentitywallets.service.HoldersCredentialService; @@ -103,9 +104,9 @@ public ResponseEntity> getCredentials(@Parameter( @IssueCredentialApiDoc @PostMapping(path = RestURI.CREDENTIALS, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity issueCredential(@RequestBody Map data, Principal principal, - @RequestParam(name = "asJwt", defaultValue = "false") boolean asJwt + @AsJwtParam @RequestParam(name = "asJwt", defaultValue = "false") boolean asJwt ) { log.debug("Received request to issue credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(holdersCredentialService.issueCredential(data, getBPNFromToken(principal) , asJwt)); + return ResponseEntity.status(HttpStatus.CREATED).body(holdersCredentialService.issueCredential(data, asJwt, getBPNFromToken(principal))); } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java index 6cdf43730..275147b7f 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/controller/IssuersCredentialController.java @@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.AsJwtParam; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.GetCredentialsApiDocs; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.IssueDismantlerCredentialApiDoc; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.IssueMembershipCredentialApiDoc; @@ -36,6 +37,7 @@ import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.IssueVerifiableCredentialUsingBaseWalletApiDocs; import org.eclipse.tractusx.managedidentitywallets.apidocs.IssuersCredentialControllerApiDocs.ValidateVerifiableCredentialApiDocs; import org.eclipse.tractusx.managedidentitywallets.constant.RestURI; +import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialVerificationRequest; import org.eclipse.tractusx.managedidentitywallets.dto.CredentialsResponse; import org.eclipse.tractusx.managedidentitywallets.dto.IssueDismantlerCredentialRequest; @@ -115,9 +117,11 @@ public ResponseEntity> getCredentials(@Parameter( */ @IssueMembershipCredentialApiDoc @PostMapping(path = RestURI.CREDENTIALS_ISSUER_MEMBERSHIP, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity issueMembershipCredential(@Valid @RequestBody IssueMembershipCredentialRequest issueMembershipCredentialRequest, Principal principal) { + public ResponseEntity issueMembershipCredential(@Valid @RequestBody IssueMembershipCredentialRequest issueMembershipCredentialRequest, + @AsJwtParam @RequestParam(name = StringPool.AS_JWT, defaultValue = "false") boolean asJwt, + Principal principal) { log.debug("Received request to issue membership credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest, getBPNFromToken(principal))); + return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueMembershipCredential(issueMembershipCredentialRequest, asJwt, getBPNFromToken(principal))); } /** @@ -129,9 +133,11 @@ public ResponseEntity issueMembershipCredential(@Valid @Req */ @IssueDismantlerCredentialApiDoc @PostMapping(path = RestURI.CREDENTIALS_ISSUER_DISMANTLER, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity issueDismantlerCredential(@Valid @RequestBody IssueDismantlerCredentialRequest request, Principal principal) { + public ResponseEntity issueDismantlerCredential(@Valid @RequestBody IssueDismantlerCredentialRequest request, + @AsJwtParam @RequestParam(name = StringPool.AS_JWT, defaultValue = "false") boolean asJwt, + Principal principal) { log.debug("Received request to issue dismantler credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueDismantlerCredential(request, getBPNFromToken(principal))); + return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueDismantlerCredential(request, asJwt, getBPNFromToken(principal))); } /** @@ -143,9 +149,11 @@ public ResponseEntity issueDismantlerCredential(@Valid @Req */ @IssueFrameworkCredentialApiDocs @PostMapping(path = RestURI.API_CREDENTIALS_ISSUER_FRAMEWORK, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity issueFrameworkCredential(@Valid @RequestBody IssueFrameworkCredentialRequest request, Principal principal) { + public ResponseEntity issueFrameworkCredential(@Valid @RequestBody IssueFrameworkCredentialRequest request, + @AsJwtParam @RequestParam(name = StringPool.AS_JWT, defaultValue = "false") boolean asJwt, + Principal principal) { log.debug("Received request to issue framework credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueFrameworkCredential(request, getBPNFromToken(principal))); + return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueFrameworkCredential(request, asJwt, getBPNFromToken(principal))); } /** @@ -173,10 +181,9 @@ public ResponseEntity> credentialsValidation(@RequestBody Cr */ @PostMapping(path = RestURI.ISSUERS_CREDENTIALS, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @IssueVerifiableCredentialUsingBaseWalletApiDocs - public ResponseEntity issueCredentialUsingBaseWallet(@Parameter(description = "Holder DID", examples = {@ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000000")}) @RequestParam(name = "holderDid") String holderDid, - @RequestBody Map data, Principal principal, - @RequestParam(name = "asJwt", defaultValue = "false") boolean asJwt) { + public ResponseEntity issueCredentialUsingBaseWallet(@Parameter(description = "Holder DID", examples = {@ExampleObject(description = "did", name = "did", value = "did:web:localhost:BPNL000000000000")}) @RequestParam(name = "holderDid") String holderDid, @RequestBody Map data, Principal principal, + @AsJwtParam @RequestParam(name = StringPool.AS_JWT, defaultValue = "false") boolean asJwt) { log.debug("Received request to issue verifiable credential. BPN: {}", getBPNFromToken(principal)); - return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueCredentialUsingBaseWallet(holderDid, data, getBPNFromToken(principal) , asJwt)); + return ResponseEntity.status(HttpStatus.CREATED).body(issuersCredentialService.issueCredentialUsingBaseWallet(holderDid, data, asJwt, getBPNFromToken(principal))); } } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java index 677f18cf3..c09538bfb 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueDismantlerCredentialRequest.java @@ -27,8 +27,6 @@ import lombok.*; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; -import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Set; /** @@ -52,6 +50,4 @@ public class IssueDismantlerCredentialRequest { @Builder.Default private Set<@NotBlank String> allowedVehicleBrands = Set.of(); - @JsonProperty("asJwt") - private boolean asJwt; } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java index bf14df523..5c8e24d69 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueFrameworkCredentialRequest.java @@ -52,8 +52,6 @@ public class IssueFrameworkCredentialRequest { @JsonProperty("contract-version") private String contractVersion; - @JsonProperty("asJwt") - private boolean asJwt; } \ No newline at end of file diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java index ac9c04f0f..deb8870a9 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/IssueMembershipCredentialRequest.java @@ -26,7 +26,6 @@ import lombok.*; import org.eclipse.tractusx.managedidentitywallets.constant.StringPool; -import com.fasterxml.jackson.annotation.JsonProperty; /** * The type Issue membership credential request. @@ -41,9 +40,7 @@ public class IssueMembershipCredentialRequest { @NotBlank(message = "Please provide BPN") @Pattern(regexp = StringPool.BPN_NUMBER_REGEX, message = "Please provide valid BPN") private String bpn; - - @JsonProperty("asJwt") - private boolean asJwt; + } \ No newline at end of file diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java index 4fc2935bf..825318b04 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/HoldersCredentialService.java @@ -144,7 +144,7 @@ public PageImpl getCredentials(String credentialId, String * @param callerBpn the caller bpn * @return the verifiable credential */ - public CredentialsResponse issueCredential(Map data, String callerBpn , boolean asJwt) { + public CredentialsResponse issueCredential(Map data, boolean asJwt, String callerBpn) { VerifiableCredential verifiableCredential = new VerifiableCredential(data); Wallet issuerWallet = commonService.getWalletByIdentifier(verifiableCredential.getIssuer().toString()); @@ -159,6 +159,7 @@ public CredentialsResponse issueCredential(Map data, String call if (verifiableCredential.getExpirationDate() != null) { expiryDate = Date.from(verifiableCredential.getExpirationDate()); } + // Create Credential HoldersCredential credential = CommonUtils.getHoldersCredential(verifiableCredential.getCredentialSubject().get(0), verifiableCredential.getTypes(), issuerWallet.getDidDocument(), diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java index 5c28bc8af..fe5ff61e3 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/IssuersCredentialService.java @@ -221,7 +221,7 @@ public VerifiableCredential issueBpnCredential(Wallet baseWallet, Wallet holderW * @return the verifiable credential */ @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public CredentialsResponse issueFrameworkCredential(IssueFrameworkCredentialRequest request, String callerBPN) { + public CredentialsResponse issueFrameworkCredential(IssueFrameworkCredentialRequest request, boolean asJwt, String callerBPN) { //validate type Validate.isFalse(miwSettings.supportedFrameworkVCTypes().contains(request.getType())).launch(new BadDataException("Framework credential of type " + request.getType() + " is not supported, supported values are " + miwSettings.supportedFrameworkVCTypes())); @@ -261,7 +261,7 @@ public CredentialsResponse issueFrameworkCredential(IssueFrameworkCredentialRequ final CredentialsResponse cr = new CredentialsResponse(); // Return VC - if (request.isAsJwt()) { + if (asJwt) { cr.setJwt(CommonUtils.vcAsJwt(baseWallet, holderWallet, issuersCredential.getData() , walletKeyService)); } else { cr.setVc(issuersCredential.getData()); @@ -280,7 +280,7 @@ public CredentialsResponse issueFrameworkCredential(IssueFrameworkCredentialRequ * @return the verifiable credential */ @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public CredentialsResponse issueDismantlerCredential(IssueDismantlerCredentialRequest request, String callerBPN) { + public CredentialsResponse issueDismantlerCredential(IssueDismantlerCredentialRequest request, boolean asJwt, String callerBPN) { //Fetch Holder Wallet Wallet holderWallet = commonService.getWalletByIdentifier(request.getBpn()); @@ -320,7 +320,7 @@ public CredentialsResponse issueDismantlerCredential(IssueDismantlerCredentialRe final CredentialsResponse cr = new CredentialsResponse(); // Return VC - if (request.isAsJwt()) { + if (asJwt) { cr.setJwt(CommonUtils.vcAsJwt(issuerWallet, holderWallet, issuersCredential.getData() , walletKeyService)); } else { cr.setVc(issuersCredential.getData()); @@ -339,7 +339,7 @@ public CredentialsResponse issueDismantlerCredential(IssueDismantlerCredentialRe * @return the verifiable credential */ @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public CredentialsResponse issueMembershipCredential(IssueMembershipCredentialRequest issueMembershipCredentialRequest, String callerBPN) { + public CredentialsResponse issueMembershipCredential(IssueMembershipCredentialRequest issueMembershipCredentialRequest, boolean asJwt, String callerBPN) { //Fetch Holder Wallet Wallet holderWallet = commonService.getWalletByIdentifier(issueMembershipCredentialRequest.getBpn()); @@ -382,7 +382,7 @@ public CredentialsResponse issueMembershipCredential(IssueMembershipCredentialRe final CredentialsResponse cr = new CredentialsResponse(); // Return VC - if (issueMembershipCredentialRequest.isAsJwt()) { + if (asJwt) { cr.setJwt(CommonUtils.vcAsJwt(issuerWallet, holderWallet, issuersCredential.getData() , walletKeyService)); } else { cr.setVc(issuersCredential.getData()); @@ -403,7 +403,7 @@ public CredentialsResponse issueMembershipCredential(IssueMembershipCredentialRe * @return the verifiable credential */ @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED) - public CredentialsResponse issueCredentialUsingBaseWallet(String holderDid, Map data, String callerBpn , boolean asJwt) { + public CredentialsResponse issueCredentialUsingBaseWallet(String holderDid, Map data, boolean asJwt, String callerBpn) { //Fetch Holder Wallet Wallet holderWallet = commonService.getWalletByIdentifier(holderDid); diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java index 1e2e3e4b8..70b57fac8 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/PresentationService.java @@ -1,6 +1,6 @@ /* * ******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * Copyright (c) 2021,2024 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletKeyService.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletKeyService.java index 847538ad4..6883fb2de 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletKeyService.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/service/WalletKeyService.java @@ -102,4 +102,5 @@ public Object getPrivateKeyByWalletIdentifierAndAlgorithm(long walletId, Support throw new UnsupportedAlgorithmException("Unsupported algorithm: " + algorithm); } } + } diff --git a/src/main/java/org/eclipse/tractusx/managedidentitywallets/utils/CommonUtils.java b/src/main/java/org/eclipse/tractusx/managedidentitywallets/utils/CommonUtils.java index b2c8fbed3..0f3b88236 100644 --- a/src/main/java/org/eclipse/tractusx/managedidentitywallets/utils/CommonUtils.java +++ b/src/main/java/org/eclipse/tractusx/managedidentitywallets/utils/CommonUtils.java @@ -186,19 +186,19 @@ public static String vcAsJwt(Wallet issuerWallet, Wallet holderWallet, Verifiabl Did issuerDid = DidParser.parse(issuerWallet.getDid()); Did holderDid = DidParser.parse(holderWallet.getDid()); - WalletKey walletKey = walletKeyService.get(issuerWallet.getId()); - // JWT Factory SerializedJwtVCFactoryImpl vcFactory = new SerializedJwtVCFactoryImpl( new SignedJwtFactory(new OctetKeyPairFactory())); - x25519PrivateKey privateKey = walletKeyService.getPrivateKeyByWalletIdentifier(walletKey.getId()); + x25519PrivateKey privateKey = walletKeyService.getPrivateKeyByWalletId(issuerWallet.getId()); // JWT Factory SignedJWT vcJWT = vcFactory.createVCJwt(issuerDid, holderDid, Date.from(vc.getExpirationDate()), vc, privateKey, - walletKey.getKeyId()); + walletKeyService.getWalletKeyIdByWalletId(issuerWallet.getId())); return vcJWT.serialize(); } + + } diff --git a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/VerifiableCredentialIssuerEqualProofSignerTest.java b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/VerifiableCredentialIssuerEqualProofSignerTest.java index 08a8ad5f5..8a5807daf 100644 --- a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/VerifiableCredentialIssuerEqualProofSignerTest.java +++ b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vc/VerifiableCredentialIssuerEqualProofSignerTest.java @@ -11,7 +11,7 @@ import org.eclipse.tractusx.managedidentitywallets.service.PresentationService; import org.eclipse.tractusx.managedidentitywallets.service.WalletKeyService; import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; -import org.eclipse.tractusx.ssi.lib.crypt.x21559.x21559PrivateKey; +import org.eclipse.tractusx.ssi.lib.crypt.x25519.x25519PrivateKey; import org.eclipse.tractusx.ssi.lib.model.proof.jws.JWSSignature2020; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialBuilder; @@ -114,7 +114,7 @@ private VerifiableCredential issueVC(String issuerDid, Wallet signerWallet) thro byte[] privateKeyBytes = walletKeyService.getPrivateKeyByWalletIdentifierAsBytes(signerWallet.getId(), signerWallet.getAlgorithm()); JWSSignature2020 proof = - (JWSSignature2020) generator.createProof(builder.build(), verificationMethod, new x21559PrivateKey(privateKeyBytes)); + (JWSSignature2020) generator.createProof(builder.build(), verificationMethod, new x25519PrivateKey(privateKeyBytes)); //Adding Proof to VC builder.proof(proof); diff --git a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java index 2d3c7ed36..a7768e89a 100644 --- a/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java +++ b/src/test/java/org/eclipse/tractusx/managedidentitywallets/vp/PresentationTest.java @@ -41,8 +41,6 @@ import org.eclipse.tractusx.managedidentitywallets.utils.TestUtils; import org.eclipse.tractusx.ssi.lib.did.resolver.DidResolver; import org.eclipse.tractusx.ssi.lib.did.web.DidWebFactory; -import org.eclipse.tractusx.ssi.lib.exception.DidDocumentResolverNotRegisteredException; -import org.eclipse.tractusx.ssi.lib.exception.JwtException; import org.eclipse.tractusx.ssi.lib.jwt.SignedJwtVerifier; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential; import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredentialBuilder;