Skip to content

Commit a3abf4f

Browse files
authored
Merge pull request #60 from WeBankFinTech/release/1.5.5
Release/1.5.5
2 parents 4f8c174 + 0b602cd commit a3abf4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2722
-265
lines changed

build.gradle

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apply plugin: 'java'
1616
apply plugin: 'eclipse'
1717
apply plugin: 'idea'
1818

19-
version = "1.5.4"
19+
version = "1.5.5"
2020

2121
// Specify JDK version - may vary in different scenarios
2222
sourceCompatibility = 1.8
@@ -39,12 +39,7 @@ List lombok = [
3939
'org.projectlombok:lombok:1.18.12'
4040
]
4141

42-
List logger = [
43-
"org.slf4j:jcl-over-slf4j:1.7.30",
44-
"com.lmax:disruptor:3.3.7"
45-
]
46-
47-
def spring_version = "4.3.27.RELEASE"
42+
def spring_version = "5.3.2"
4843
List spring = [
4944
"org.springframework:spring-core:$spring_version",
5045
"org.springframework:spring-beans:$spring_version",
@@ -57,7 +52,7 @@ List spring = [
5752
"org.springframework:spring-webmvc:$spring_version"
5853
]
5954

60-
def spring_boot_version = "1.5.12.RELEASE"
55+
def spring_boot_version = "2.4.1"
6156
List spring_boot = [
6257
"org.springframework.boot:spring-boot-starter-web:$spring_boot_version",
6358
"org.springframework.boot:spring-boot-autoconfigure:$spring_boot_version",
@@ -76,43 +71,20 @@ List junit = [
7671
"org.springframework:spring-test:$spring_version"
7772
]
7873

79-
List apache_commons = [
80-
"org.apache.commons:commons-collections4:4.1",
81-
"org.apache.commons:commons-lang3:3.5",
82-
"commons-cli:commons-cli:1.3.1"
83-
]
84-
8574
// In this section you declare the dependencies for your production and test code
86-
List jackson = [
87-
"com.fasterxml.jackson.core:jackson-databind:2.11.0",
88-
'io.netty:netty-all:4.1.15.Final',
89-
'io.netty:netty-tcnative:2.0.0.Final',
90-
'com.github.fge:json-schema-validator:2.2.6',
91-
'org.apache.httpcomponents:httpclient:4.5.2',
92-
"com.github.reinert:jjschema:1.16",
93-
"com.google.zxing:core:3.3.0",
94-
"net.sf.oval:oval:1.90",
95-
"com.github.ben-manes.caffeine:caffeine:2.8.0",
96-
"com.google.protobuf:protobuf-java:3.9.1"
75+
List json = [
76+
"javax.validation:validation-api:1.1.0.Final",
77+
"com.google.code.gson:gson:2.6"
9778
]
9879

9980
List weid_java_sdk = [
100-
'com.webank:weid-java-sdk:1.7.0'
101-
]
102-
103-
List pdfbox = [
104-
'org.apache.pdfbox:pdfbox:2.0.16'
105-
]
106-
107-
List rpc = [
108-
'org.smartboot.socket:aio-core:1.4.2',
109-
'org.smartboot.socket:aio-pro:1.4.2'
81+
'com.webank:weid-java-sdk:1.7.1'
11082
]
11183

11284
// In this section you declare the dependencies for your production and test code
11385
dependencies {
114-
compile logger, spring, apache_commons, jackson, spring_boot, rpc, pdfbox
115-
testCompile logger, spring, junit, spring_boot, spring_boot_test, rpc, pdfbox
86+
compile spring, json, spring_boot
87+
testCompile spring, json, junit, spring_boot, spring_boot_test
11688
// Check SDK pipeline dependency
11789
if (file("./dependencies/weid-java-sdk-pipeline.jar").exists()) {
11890
println "Pipeline jar for WeIdentity Java SDK found."
@@ -135,6 +107,7 @@ dependencies {
135107
testAnnotationProcessor lombok
136108
testCompileOnly lombok
137109
}
110+
compile files('./dependencies/wallet-agent-0.1.0.jar')
138111
}
139112

140113
configurations {
@@ -185,6 +158,10 @@ jar {
185158
from configurations.runtime
186159
into 'dist/lib'
187160
}
161+
copy {
162+
from file('keys/priv')
163+
into 'dist/keys/priv'
164+
}
188165
copy {
189166
from file('.').listFiles().findAll { File f -> (f.name.endsWith('.bat') || f.name.endsWith('.sh') || f.name.endsWith('.env')) }
190167
into 'dist'
685 KB
Binary file not shown.

script/deploy_payment.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
JAVA_HOME="$JAVA_HOME"
4+
5+
if [ -f conf/payment.properties ];then
6+
echo "Err: the conf/payment.properties is exists"
7+
exit 1
8+
fi
9+
10+
key=$(cat keys/priv/ecdsa_key)
11+
12+
${JAVA_HOME}/bin/java -classpath "./conf:./lib/*" com.webank.payment.contract.deploy.DeployService ${key}
13+
if [[ $? -ne 0 ]];then
14+
echo "deploy contract failed."
15+
exit 1
16+
fi
17+
18+
if [ -f payment.properties ];then
19+
cp payment.properties ./conf/
20+
rm payment.properties
21+
rm ecdsa_key
22+
fi

src/main/java/com/webank/weid/http/config/HttpsConfig.java

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
import org.apache.catalina.connector.Connector;
2323
import org.springframework.beans.factory.annotation.Value;
2424
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
25-
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
26-
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
27-
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
25+
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
26+
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
2827
import org.springframework.context.annotation.Bean;
2928
import org.springframework.context.annotation.Configuration;
3029

@@ -40,23 +39,17 @@ public class HttpsConfig {
4039
@Value("${server.http.port}")
4140
private Integer serverPort;
4241

43-
/**
44-
* support HTTP request processing.
45-
*/
42+
4643
@Bean
47-
public EmbeddedServletContainerCustomizer containerCustomizer() {
48-
return new EmbeddedServletContainerCustomizer() {
49-
@Override
50-
public void customize(ConfigurableEmbeddedServletContainer container) {
51-
if (container instanceof TomcatEmbeddedServletContainerFactory) {
52-
TomcatEmbeddedServletContainerFactory containerFactory =
53-
(TomcatEmbeddedServletContainerFactory) container;
54-
Connector connector =
55-
new Connector(TomcatEmbeddedServletContainerFactory.DEFAULT_PROTOCOL);
56-
connector.setPort(serverPort);
57-
containerFactory.addAdditionalTomcatConnectors(connector);
58-
}
59-
}
60-
};
44+
public ServletWebServerFactory servletContainer() {
45+
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
46+
tomcat.addAdditionalTomcatConnectors(createStandardConnector());
47+
return tomcat;
48+
}
49+
50+
private Connector createStandardConnector() {
51+
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
52+
connector.setPort(serverPort);
53+
return connector;
6154
}
6255
}

src/main/java/com/webank/weid/http/constant/HttpReturnCode.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,27 @@ public enum HttpReturnCode {
111111
* contract error.
112112
*/
113113
CONTRACT_ERROR(201016, "Failed to load contract (maybe from un-deployed site, DB not storing CNS, or CNS hash illegal)"),
114+
115+
/**
116+
* BlockLimit value illegal.
117+
*/
118+
BLOCK_LIMIT_ILLEGAL(201017, "BlockLimit value illegal. "),
114119

120+
/**
121+
* Convert a public key to a WeIdentity DID error
122+
*/
123+
CONVERT_PUBKEY_TO_WEID_ERROR(201018, "Convert public key to weId error. "),
124+
125+
/**
126+
* SignType value illegal.
127+
*/
128+
SIGN_TYPE_ILLEGAL(201019, "SignType value illegal. "),
129+
130+
/**
131+
* getWeIdListByPubKeyList interface error
132+
*/
133+
GET_WEID_LIST_BY_PUBKEY_LIST_ERROR(500100, "Get weId list by pubKeyList error. "),
134+
115135
/**
116136
* RPC related error codes.
117137
*/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.webank.weid.http.constant;
2+
3+
public enum SignType {
4+
5+
RSV(1), VSR(2);
6+
7+
private int code;
8+
9+
SignType(int code) {
10+
this.code = code;
11+
}
12+
13+
public int getCode() {
14+
return code;
15+
}
16+
17+
public static SignType getSignTypeByCode(int code) {
18+
for (SignType signType : SignType.values()) {
19+
if (code == signType.getCode()) {
20+
return signType;
21+
}
22+
}
23+
return null;
24+
}
25+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright© (2019-2020) WeBank Co., Ltd.
3+
*
4+
* This file is part of weid-http-service.
5+
*
6+
* weid-http-service is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* weid-http-service is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with weid-http-service. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
20+
package com.webank.weid.http.constant;
21+
22+
/**
23+
* Define function names to be picked for calls to WeIdentity Java SDK
24+
*
25+
* @author chaoxinhu
26+
**/
27+
28+
public final class WalletAgentFunctionNames {
29+
30+
/**
31+
* Function names to be compared against the passed in encode/send transaction parameters. Case
32+
* insensitive.
33+
*/
34+
public static final String FUNCNAME_WALLETAGENT_CONSTRUCT = "construct";
35+
public static final String FUNCNAME_WALLETAGENT_ISSUE = "issue";
36+
public static final String FUNCNAME_WALLETAGENT_CONSTRUCTANDISSUE = "constructAndIssue";
37+
public static final String FUNCNAME_WALLETAGENT_GETBALANCE = "getBalance";
38+
public static final String FUNCNAME_WALLETAGENT_GETBATCHBALANCE = "getBatchBalance";
39+
public static final String FUNCNAME_WALLETAGENT_GETBALANCEBYWEID = "getBalanceByWeId";
40+
public static final String FUNCNAME_WALLETAGENT_SEND = "send";
41+
public static final String FUNCNAME_WALLETAGENT_BATCHSEND = "batchSend";
42+
public static final String FUNCNAME_WALLETAGENT_GETBASEINFO = "getBaseInfo";
43+
public static final String FUNCNAME_WALLETAGENT_GETBASEINFOBYWEID = "getBaseInfoByWeId";
44+
45+
public static final String FUNCNAME_WALLETAGENT_BATCHISSUE = "batchIssue";
46+
public static final String FUNCNAME_WALLETAGENT_CONSTRUCTANDBATCHISSUE = "constructAndBatchIssue";
47+
public static final String FUNCNAME_WALLETAGENT_QUERYASSETOWNER = "queryAssetOwner";
48+
public static final String FUNCNAME_WALLETAGENT_QUERYASSETNUM = "queryAssetNum";
49+
public static final String FUNCNAME_WALLETAGENT_QUERYASSETLIST = "queryAssetList";
50+
public static final String FUNCNAME_WALLETAGENT_QUERYOWNEDASSETNUM = "queryOwnedAssetNum";
51+
public static final String FUNCNAME_WALLETAGENT_QUERYOWNEDASSETLIST = "queryOwnedAssetList";
52+
53+
}

src/main/java/com/webank/weid/http/constant/WeIdentityFunctionNames.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public final class WeIdentityFunctionNames {
3535
* insensitive.
3636
*/
3737
public static final String FUNCNAME_CREATE_WEID = "createWeId";
38+
public static final String FUNCNAME_CREATE_WEID_AND_RETURN_DOC = "createWeId2";
3839
public static final String FUNCNAME_REGISTER_AUTHORITY_ISSUER = "registerAuthorityIssuer";
3940
public static final String FUNCNAME_REGISTER_CPT = "registerCpt";
4041
public static final String FUNCNAME_CREATE_CREDENTIAL = "createCredential";
@@ -47,6 +48,7 @@ public final class WeIdentityFunctionNames {
4748
public static final String FUNCNAME_VERIFY_CREDENTIALPOJO = "verifyCredentialPojo";
4849

4950
public static final String FUNCNAME_CREATE_WEID_WITH_PUBKEY = "createWeIdWithPubKey";
51+
public static final String FUNCNAME_CREATE_WEID_WITH_PUBKEY_AND_RETURN_DOC = "createWeIdWithPubKey2";
5052
public static final String FUNCNAME_GET_WEID_DOCUMENT_BY_ORG = "getWeIdDocumentByOrgId";
5153
public static final String FUNCNAME_VERIFY_LITE_CREDENTIAL = "verifyLiteCredential";
5254
public static final String FUNCNAME_CREATE_EVIDENCE_FOR_LITE_CREDENTIAL = "createEvidence";
@@ -60,7 +62,7 @@ public final class WeIdentityFunctionNames {
6062
public static final String FUNCNAME_IS_WEID_IN_WHITELIST = "isWeIdInWhitelist";
6163
public static final String FUNCNAME_RECOGNIZE_AUTHORITY_ISSUER = "recognizeAuthorityIssuer";
6264
public static final String FUNCNAME_DERECOGNIZE_AUTHORITY_ISSUER = "deRecognizeAuthorityIssuer";
63-
65+
public static final String FUNCNAME_GETWEIDLIST_BYPUBKEYLIST = "getWeIdListByPubKeyList";
6466
/**
6567
* Function names to be assembled in SDK Function call. Case sensitive. FISCO-BCOS v1.
6668
*/

src/main/java/com/webank/weid/http/constant/WeIdentityParamKeyConstant.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ public final class WeIdentityParamKeyConstant {
3131
*/
3232
public static final String FUNCTION_NAME = "functionName";
3333
public static final String TRANSACTION_DATA = "data";
34+
public static final String BLOCK_LIMIT = "blockLimit";
35+
public static final String SIGN_TYPE = "signType";
3436
public static final String SIGNED_MESSAGE = "signedMessage";
3537
public static final String API_VERSION = "v";
3638
public static final String NONCE = "nonce";
3739
public static final String FUNCTION_ARG = "functionArg";
3840
public static final String TRANSACTION_ARG = "transactionArg";
3941
public static final String CLAIM_HASH = "claimHash";
4042
public static final String KEY_INDEX = "invokerWeId";
43+
public static final String LOOP_BACK = "loopback";
4144
public static final String BODY = "body";
4245
public static final String LIST = "list";
4346

@@ -54,6 +57,7 @@ public final class WeIdentityParamKeyConstant {
5457
public static final String SIGN = "sign";
5558
public static final String LOG = "log";
5659
public static final String PUBKEY_SECP = "publicKeySecp256k1";
60+
public static final String PUBKEY_LIST = "publicKeyList";
5761
public static final String PUBKEY_RSA = "publicKeyRSA";
5862

5963
public static final String WHITELIST_NAME = "whitelistName";

src/main/java/com/webank/weid/http/constant/WeIdentityServiceEndpoint.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,17 @@ public final class WeIdentityServiceEndpoint {
3131
* API endpoint.
3232
*/
3333
public static final String API_ROOT = "weid/api";
34+
public static final String PAYMENT_ROOT = "payment";
3435
public static final String ENCODE_TRANSACTION = "encode";
3536
public static final String SEND_TRANSACTION = "transact";
3637
public static final String INVOKE_FUNCTION = "invoke";
37-
38+
public static final String WALLET_AGENT_BAC004_FUNCTION = "bac004/api/invoke";
39+
public static final String WALLET_AGENT_BAC005_FUNCTION = "bac005/api/invoke";
40+
public static final String WALLET_AGENT_BAC004_FUNCTION_ENCODE = "bac004/api/encode";
41+
public static final String WALLET_AGENT_BAC004_FUNCTION_TRANSACT = "bac004/api/transact";
42+
public static final String WALLET_AGENT_BAC005_FUNCTION_ENCODE = "bac005/api/encode";
43+
public static final String WALLET_AGENT_BAC005_FUNCTION_TRANSACT = "bac005/api/transact";
44+
3845
/**
3946
* EP Service endpoint.
4047
*/

0 commit comments

Comments
 (0)