Skip to content

Commit ba1e5d0

Browse files
qyan-devHaoXuan40404
authored andcommitted
v1.1 refine part1
1 parent 0c0135a commit ba1e5d0

File tree

6 files changed

+33
-31
lines changed

6 files changed

+33
-31
lines changed

demo/src/main/java/com/webank/wedpr/demo/KtbDemo.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
import com.webank.wedpr.ktb.hdk.HdkClient;
66
import com.webank.wedpr.ktb.hdk.HdkResult;
77

8-
/** Minimalist demo of WeDPR Crypto Tools. */
8+
/** Minimalist demo of key tool box (KTB). */
99
public class KtbDemo {
1010
public static void run(HdkClient hdkClient) throws Exception {
11-
System.out.println("\n*******\nHDK DEMO RUN\n*******");
11+
System.out.println("\n*******\nKTB DEMO RUN\n*******");
1212

1313
HdkResult hdkResult = hdkClient.createMnemonicEn(24);
1414
String mnemonic = hdkResult.mnemonic;
1515
System.out.println("mnemonic = " + mnemonic);
1616

17-
String password = "123456";
17+
String password = "Do not use real password";
1818
hdkResult = hdkClient.createMasterKeyEn(password, mnemonic);
1919
String masterKey = hdkResult.masterKey;
2020
System.out.println("masterKey = " + masterKey);
@@ -24,7 +24,6 @@ public static void run(HdkClient hdkClient) throws Exception {
2424
int account = 1;
2525
int change = 0;
2626
int addressIndex = 1000;
27-
2827
hdkResult =
2928
hdkClient.deriveExtendedKey(
3029
masterKey, purposeType, assetType, account, change, addressIndex);

solution/ktb/src/main/java/com/webank/wedpr/ktb/hdk/HdkClient.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
11
// Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2+
23
package com.webank.wedpr.ktb.hdk;
34

45
import com.webank.wedpr.common.WedprException;
56

67
/**
7-
* Client class used by ktb tools. This is the main interface class for Java apps using crypto
8+
* Client class used by KTB-HDK. This is the main interface class for Java apps using HDK
89
* functions.
910
*/
1011
public class HdkClient {
1112

1213
/**
13-
* Create English Mnemonic
14+
* Creates an English mnemonic for later generating the master key.
1415
*
15-
* @param wordCount
16-
* @return
17-
* @throws WedprException
16+
* @param wordCount the word count of the mnemonic.
17+
* @return HdkResult containing data for mnemonic.
18+
* @throws WedprException if any error occurred.
1819
*/
1920
public HdkResult createMnemonicEn(int wordCount) throws WedprException {
2021
return NativeInterface.createMnemonicEn(wordCount).expectNoError();
2122
}
2223

2324
/**
24-
* Create Master key
25+
* Creates a master key from a English mnemonic and a password.
2526
*
26-
* @param password
27-
* @param mnemonic
28-
* @return
29-
* @throws WedprException
27+
* @param password the password used together with the mnemonic.
28+
* @param mnemonic the mnemonic for master key recovery.
29+
* @return HdkResult containing data for masterKey.
30+
* @throws WedprException if any error occurred.
3031
*/
3132
public HdkResult createMasterKeyEn(String password, String mnemonic) throws WedprException {
3233
return NativeInterface.createMasterKeyEn(password, mnemonic).expectNoError();
3334
}
3435

3536
/**
36-
* Derive Extended Key
37+
* Derives an extended key pair based on a key derivation path.
3738
*
38-
* @param masterKey
39-
* @param purposeType
40-
* @param assetType
41-
* @param account
42-
* @param change
43-
* @param addressIndex
44-
* @return
45-
* @throws WedprException
39+
* @param masterKey the master key for key derivation.
40+
* @param purposeType the purpose type of the derived key.
41+
* @param assetType the asset subtype of the derived key.
42+
* @param account the account subtype of the derived key.
43+
* @param change the change subtype of the derived key.
44+
* @param addressIndex the address index of the derived key.
45+
* @return HdkResult containing data for extendedPublicKey, extendedPrivateKey.
46+
* @throws WedprException if any error occurred.
4647
*/
4748
public HdkResult deriveExtendedKey(
4849
String masterKey, int purposeType, int assetType, int account, int change, int addressIndex)

solution/ktb/src/main/java/com/webank/wedpr/ktb/hdk/HdkResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import com.webank.wedpr.common.WedprResult;
77

88
/**
9-
* Result class used by Crypto client.
9+
* Result class used by HDK client.
1010
*
1111
* <p>This is an easy way to return multiple data from a single JNI interface.
1212
*/

solution/ktb/src/main/java/com/webank/wedpr/ktb/hdk/NativeInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import com.webank.wedpr.common.NativeUtils;
66
import java.io.IOException;
77

8-
/** Native interface for Crypto client. */
8+
/** Native interface for HDK client. */
99
public class NativeInterface {
1010

1111
static {
1212
try {
13-
// Load the dynamic library of Crypto on different operating systems.
13+
// Load the dynamic library of HDK on different operating systems.
1414
String osName = System.getProperty("os.name").toLowerCase();
1515
String libPathInJar;
1616
if (osName.contains("windows")) {

solution/scd/src/main/java/com/webank/wedpr/scd/PredicateType.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
/** Predicate types supported by SCD. */
66
public enum PredicateType {
7-
GE, // >
8-
LE, // <
9-
GT, // >=
10-
LT, // <=
11-
EQ // ==
7+
GE, // >
8+
LE, // <
9+
GT, // >=
10+
LT, // <=
11+
EQ // ==
1212
}

solution/vcl/src/main/java/com/webank/wedpr/vcl/VclClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2+
13
package com.webank.wedpr.vcl;
24

35
import com.webank.wedpr.common.WedprException;

0 commit comments

Comments
 (0)