Skip to content

Commit

Permalink
<add>(account): support list accounts with HSM model (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasLi1024 authored Apr 6, 2023
1 parent db2fd8b commit ebd7230
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/console/client/ConsoleClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,11 @@ public void listAccount(String[] params) {
return;
}
String currentAccount = client.getCryptoSuite().getCryptoKeyPair().getAddress();
System.out.println(currentAccount + "(current account) <=");
String currentAccountSuffix =
client.getCryptoSuite().getCryptoTypeConfig() == CryptoType.HSM_TYPE
? "(current HSM account) <="
: "(current account) <=";
System.out.println(currentAccount + currentAccountSuffix);
for (String s : accountList) {
if (!s.equals(currentAccount)) {
System.out.println(s);
Expand All @@ -377,7 +381,8 @@ public void listAccount(String[] params) {
public static String getAccountDir(Client client) {
ConfigOption configOption = client.getCryptoSuite().getConfig();
String subDir = CryptoKeyPair.ECDSA_ACCOUNT_SUBDIR;
if (client.getCryptoSuite().getCryptoTypeConfig() == CryptoType.SM_TYPE) {
if (client.getCryptoSuite().getCryptoTypeConfig() == CryptoType.SM_TYPE
|| client.getCryptoSuite().getCryptoTypeConfig() == CryptoType.HSM_TYPE) {
subDir = CryptoKeyPair.GM_ACCOUNT_SUBDIR;
}
return configOption.getAccountConfig().getKeyStoreDir() + File.separator + subDir;
Expand Down

0 comments on commit ebd7230

Please sign in to comment.