Skip to content

Commit

Permalink
fix: exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafasalfiti authored and nitin-vavdiya committed May 21, 2024
1 parent 050358e commit fc6c077
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.tractusx.managedidentitywallets.constant.StringPool;
import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet;
import org.eclipse.tractusx.managedidentitywallets.dao.repository.WalletRepository;
import org.eclipse.tractusx.managedidentitywallets.exception.WalletNotFoundProblem;
import org.eclipse.tractusx.managedidentitywallets.utils.CommonUtils;
import org.eclipse.tractusx.managedidentitywallets.utils.Validate;
import org.eclipse.tractusx.ssi.lib.exception.did.DidParseException;
import org.eclipse.tractusx.ssi.lib.model.verifiable.credential.VerifiableCredential;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ private Wallet createWallet(CreateWalletRequest request, boolean authority, Stri

//create private key pair
IKeyGenerator keyGenerator = new X25519Generator();

KeyPair keyPair = keyGenerator.generateKey();

//create did json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.eclipse.tractusx.managedidentitywallets.constant.SupportedAlgorithms;
import org.eclipse.tractusx.managedidentitywallets.dao.entity.HoldersCredential;
import org.eclipse.tractusx.managedidentitywallets.dao.entity.Wallet;
import org.eclipse.tractusx.managedidentitywallets.dao.entity.WalletKey;
import org.eclipse.tractusx.managedidentitywallets.dto.SecureTokenRequest;
import org.eclipse.tractusx.managedidentitywallets.exception.BadDataException;
import org.eclipse.tractusx.managedidentitywallets.service.WalletKeyService;
Expand Down Expand Up @@ -187,16 +186,13 @@ 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 = (X25519PrivateKey) walletKeyService.getPrivateKeyByWalletIdAndAlgorithm(issuerWallet.getId(), SupportedAlgorithms.ED25519);
// JWT Factory

SignedJWT vcJWT = vcFactory.createVCJwt(issuerDid, holderDid, vc,
privateKey,
walletKeyService.getWalletKeyIdByWalletId(issuerWallet.getId())
Expand Down

0 comments on commit fc6c077

Please sign in to comment.