Skip to content

Commit

Permalink
feat: adapt request and wallet service
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandra-bel committed Mar 21, 2024
1 parent fe0357f commit c911d33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ public class CreateWalletRequest {
@NotBlank(message = "Please provide name")
@Size(min = 1, max = 255, message = "Please provide valid name")
private String name;

private String didUrl;
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

import static org.eclipse.tractusx.managedidentitywallets.constant.StringPool.ED_25519;
Expand Down Expand Up @@ -239,7 +240,7 @@ private Wallet createWallet(CreateWalletRequest request, boolean authority, Stri
KeyPair keyPair = keyGenerator.generateKey();

//create did json
Did did = DidWebFactory.fromHostnameAndPath(miwSettings.host(), request.getBpn());
Did did = createDidJson(request);

String keyId = UUID.randomUUID().toString();

Expand Down Expand Up @@ -274,12 +275,18 @@ private Wallet createWallet(CreateWalletRequest request, boolean authority, Stri

Wallet issuerWallet = walletRepository.getByBpn(miwSettings.authorityWalletBpn());

//issue BPN credentials
issuersCredentialService.issueBpnCredential(issuerWallet, wallet, authority);
//TODO: issue BPN credentials omitted, will be implemented in a separate step

return wallet;
}

private Did createDidJson(CreateWalletRequest request) {
String didUrl = request.getDidUrl();
String bpn = request.getBpn();
didUrl = Objects.isNull(didUrl) ? miwSettings.host() : didUrl;
return DidWebFactory.fromHostnameAndPath(didUrl, bpn);
}

/**
* Create authority wallet on application start up, skip if already created.
*/
Expand Down

0 comments on commit c911d33

Please sign in to comment.