Skip to content

Commit 726d60c

Browse files
Merge pull request #297 from WeBankFinTech/release/1.8.1
Release/1.8.1
2 parents 57fe3c4 + df205cf commit 726d60c

File tree

12 files changed

+469
-12
lines changed

12 files changed

+469
-12
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.0
1+
1.8.1

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ dependencies {
153153
localDeps 'org.projectlombok:lombok:1.18.10'
154154
if (!gradle.startParameter.isOffline()) {
155155
compile logger, lombok, apache_commons, json, mysql_driver, redisson, zxing, rpc, pdfbox, protobuf, caffeine, oval
156-
compile("com.webank:weid-contract-java:1.2.29") {
156+
compile("com.webank:weid-contract-java:1.2.30") {
157157
exclude group: "org.slf4j", module: "slf4j-log4j12"
158158
}
159159
compile fileTree(dir: 'lib', include: '*.jar')

docs/zh_CN/docs/weidentity-java-sdk-doc.rst

Lines changed: 100 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ WeIdentity Java SDK提供了一整套对WeIdentity进行管理操作的Java库
3535
#. 查询授权机构:调用AuthorityIssuerService的queryAuthorityIssuerInfo()查阅生成的授权机构数据;
3636
#. 注册CPT:通过CptService的registerCpt(),通过之前生成的WeIdentity DID身份创建一个你喜欢的CPT模板;
3737
#. 查询CPT:调用CptService的queryCpt()查阅生成的CPT模板;
38-
#. 生成凭证:通过CredentialPojoService的CreateCredential(),根据CPT模板,生成一份Credential;
39-
#. 查询凭证:调用CredentialPojoService的Verify(),验证此Credential是否合法;
40-
#. 凭证存证上链:调用EvidenceService的CreateEvidence(),将之前生成的Credential生成一份Hash存证上链;
41-
#. 验证链上凭证存证:调用EvidenceService的VerifyEvidence(),和链上对比,验证Credential是否被篡改。
38+
#. 生成凭证:通过CredentialPojoService的createCredential(),根据CPT模板,生成一份Credential;
39+
#. 查询凭证:调用CredentialPojoService的verify(),验证此Credential是否合法;
40+
#. 凭证存证上链:调用EvidenceService的createEvidence(),将之前生成的Credential生成一份Hash存证上链;
41+
#. 验证链上凭证存证:调用EvidenceService的verifySigner(),和链上对比,验证Credential是否被篡改。
4242

4343
代码结构说明
4444
------------
@@ -9356,11 +9356,57 @@ com.webank.weid.protocol.base.EvidenceSignInfo
93569356
.. code-block:: text
93579357
93589358
接口名称:com.webank.weid.rpc.EvidenceService.verifySigner
9359-
接口定义:ResponseData<Boolean> verify(EvidenceInfo evidenceInfo, String weId)
9360-
接口描述: 根据传入的存证信息和WeID,从链上根据WeID的公钥,判断此存证是否合法。
9359+
接口定义:ResponseData<Boolean> verify(CredentialPojo credentialPojo, EvidenceInfo evidenceInfo, String weId)
9360+
接口描述: 根据传入的凭证和存证信息和WeID,从链上根据WeID的公钥,判断此存证是否合法。
93619361
93629362
**接口入参**\ :
93639363

9364+
com.webank.weid.protocol.base.CredentialPojo
9365+
9366+
.. list-table::
9367+
:header-rows: 1
9368+
9369+
* - 名称
9370+
- 类型
9371+
- 说明
9372+
- 备注
9373+
* - context
9374+
- String
9375+
-
9376+
-
9377+
* - type
9378+
- List<String>
9379+
-
9380+
-
9381+
* - id
9382+
- String
9383+
- 证书ID
9384+
-
9385+
* - cptId
9386+
- Integer
9387+
- cptId
9388+
-
9389+
* - issuer
9390+
- String
9391+
- issuer 的 WeIdentity DID
9392+
-
9393+
* - issuanceDate
9394+
- Long
9395+
- 创建日期
9396+
-
9397+
* - expirationDate
9398+
- Long
9399+
- 到期日期
9400+
-
9401+
* - claim
9402+
- Map<String, Object>
9403+
- Claim数据
9404+
-
9405+
* - proof
9406+
- Map<String, Object>
9407+
- 签名数据结构体
9408+
-
9409+
93649410
com.webank.weid.protocol.base.EvidenceInfo
93659411

93669412
.. list-table::
@@ -9486,11 +9532,57 @@ java.lang.String
94869532
.. code-block:: text
94879533
94889534
接口名称:com.webank.weid.rpc.EvidenceService.verifySigner
9489-
接口定义:ResponseData<Boolean> verify(EvidenceInfo evidenceInfo, String weId, String publicKey)
9490-
接口描述: 根据传入的存证信息和WeID,及传入的公钥,判断此WeID是否为存证的合法创建者。不需要链上交互。
9535+
接口定义:ResponseData<Boolean> verify(CredentialPojo credentialPojo, EvidenceInfo evidenceInfo, String weId, String publicKey)
9536+
接口描述: 根据传入的凭证和存证信息和WeID,及传入的公钥,判断此WeID是否为存证的合法创建者。不需要链上交互。
94919537
94929538
**接口入参**\ :
94939539

9540+
com.webank.weid.protocol.base.CredentialPojo
9541+
9542+
.. list-table::
9543+
:header-rows: 1
9544+
9545+
* - 名称
9546+
- 类型
9547+
- 说明
9548+
- 备注
9549+
* - context
9550+
- String
9551+
-
9552+
-
9553+
* - type
9554+
- List<String>
9555+
-
9556+
-
9557+
* - id
9558+
- String
9559+
- 证书ID
9560+
-
9561+
* - cptId
9562+
- Integer
9563+
- cptId
9564+
-
9565+
* - issuer
9566+
- String
9567+
- issuer 的 WeIdentity DID
9568+
-
9569+
* - issuanceDate
9570+
- Long
9571+
- 创建日期
9572+
-
9573+
* - expirationDate
9574+
- Long
9575+
- 到期日期
9576+
-
9577+
* - claim
9578+
- Map<String, Object>
9579+
- Claim数据
9580+
-
9581+
* - proof
9582+
- Map<String, Object>
9583+
- 签名数据结构体
9584+
-
9585+
94949586
com.webank.weid.protocol.base.EvidenceInfo
94959587

94969588
.. list-table::

src/main/java/com/webank/weid/constant/ErrorCode.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,22 @@ public enum ErrorCode {
686686
"the specific issuer type or address does not exist."
687687
),
688688

689+
/**
690+
* The capacity has reached the upper limit.
691+
*/
692+
SPECIFIC_ISSUER_CONTRACT_ERROR_EXCEED_MAX(
693+
500503,
694+
"the capacity has reached the upper limit."
695+
),
696+
697+
/**
698+
* Has issuer in the specific issuer type.
699+
*/
700+
SPECIFIC_ISSUER_CONTRACT_ERROR_EXIST_ISSUER(
701+
500504,
702+
"has issuer in the specific issuer type."
703+
),
704+
689705
/**
690706
* The weid invalid.
691707
*/
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright© (2018-2021) WeBank Co., Ltd.
3+
*
4+
* This file is part of weid-java-sdk.
5+
*
6+
* weid-java-sdk 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-java-sdk 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-java-sdk. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
20+
package com.webank.weid.protocol.base;
21+
22+
import lombok.Data;
23+
24+
@Data
25+
public class IssuerType {
26+
/**
27+
* Required: The Issuer Type Name.
28+
*/
29+
private String typeName;
30+
31+
/**
32+
* Required: The The Issuer Type Owner..
33+
*/
34+
private String owner;
35+
36+
/**
37+
* Required: The create date of the Authority Issuer, in timestamp (Long) format.
38+
*/
39+
private Long created;
40+
}

src/main/java/com/webank/weid/rpc/AuthorityIssuerService.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.List;
2323

2424
import com.webank.weid.protocol.base.AuthorityIssuer;
25+
import com.webank.weid.protocol.base.IssuerType;
2526
import com.webank.weid.protocol.base.WeIdAuthentication;
2627
import com.webank.weid.protocol.base.WeIdPrivateKey;
2728
import com.webank.weid.protocol.request.RegisterAuthorityIssuerArgs;
@@ -175,4 +176,39 @@ ResponseData<List<String>> getAllSpecificTypeIssuerList(
175176
* @return the all issuer
176177
*/
177178
ResponseData<Integer> getIssuerCount();
179+
180+
/**
181+
* get the issuer count with Recognized.
182+
* @return the all issuer with Recognized
183+
*/
184+
ResponseData<Integer> getRecognizedIssuerCount();
185+
186+
/**
187+
* get the issuer size in issuerType.
188+
* @param issuerType the issuerType
189+
* @return the all issuer in issuerType
190+
*/
191+
ResponseData<Integer> getSpecificTypeIssuerSize(String issuerType);
192+
193+
/**
194+
* get the issuer type count.
195+
* @return the all issuer type
196+
*/
197+
ResponseData<Integer> getIssuerTypeCount();
198+
199+
/**
200+
* remove the issuerType.
201+
* @param callerAuth the caller
202+
* @param issuerType the issuerType name
203+
* @return true is success, false is fail
204+
*/
205+
ResponseData<Boolean> removeIssuerType(WeIdAuthentication callerAuth, String issuerType);
206+
207+
/**
208+
* get the issuerType list.
209+
* @param index the start index
210+
* @param num the page size
211+
* @return the issuerType list
212+
*/
213+
ResponseData<List<IssuerType>> getIssuerTypeList(Integer index, Integer num);
178214
}

src/main/java/com/webank/weid/service/impl/AuthorityIssuerServiceImpl.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.webank.weid.constant.ErrorCode;
3333
import com.webank.weid.constant.WeIdConstant;
3434
import com.webank.weid.protocol.base.AuthorityIssuer;
35+
import com.webank.weid.protocol.base.IssuerType;
3536
import com.webank.weid.protocol.base.WeIdAuthentication;
3637
import com.webank.weid.protocol.base.WeIdPrivateKey;
3738
import com.webank.weid.protocol.request.RegisterAuthorityIssuerArgs;
@@ -540,4 +541,41 @@ public ResponseData<String> getWeIdByOrgId(String orgId) {
540541
public ResponseData<Integer> getIssuerCount() {
541542
return authEngine.getIssuerCount();
542543
}
544+
545+
@Override
546+
public ResponseData<Integer> getRecognizedIssuerCount() {
547+
return authEngine.getRecognizedIssuerCount();
548+
}
549+
550+
@Override
551+
public ResponseData<Integer> getSpecificTypeIssuerSize(String issuerType) {
552+
return authEngine.getSpecificTypeIssuerSize(issuerType);
553+
}
554+
555+
@Override
556+
public ResponseData<Integer> getIssuerTypeCount() {
557+
return authEngine.getIssuerTypeCount();
558+
}
559+
560+
@Override
561+
public ResponseData<Boolean> removeIssuerType(
562+
WeIdAuthentication callerAuth,
563+
String issuerType
564+
) {
565+
ErrorCode innerCode = isIssuerTypeValid(issuerType);
566+
if (innerCode != ErrorCode.SUCCESS) {
567+
return new ResponseData<>(false, innerCode);
568+
}
569+
innerCode = isCallerAuthValid(callerAuth);
570+
if (innerCode != ErrorCode.SUCCESS) {
571+
return new ResponseData<>(false, innerCode);
572+
}
573+
return authEngine.removeIssuerType(
574+
issuerType, callerAuth.getWeIdPrivateKey().getPrivateKey());
575+
}
576+
577+
@Override
578+
public ResponseData<List<IssuerType>> getIssuerTypeList(Integer index, Integer num) {
579+
return authEngine.getIssuerTypeList(index, num);
580+
}
543581
}

src/main/java/com/webank/weid/service/impl/engine/AuthorityIssuerServiceEngine.java

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.List;
2323

2424
import com.webank.weid.protocol.base.AuthorityIssuer;
25+
import com.webank.weid.protocol.base.IssuerType;
2526
import com.webank.weid.protocol.request.RegisterAuthorityIssuerArgs;
2627
import com.webank.weid.protocol.request.RemoveAuthorityIssuerArgs;
2728
import com.webank.weid.protocol.response.ResponseData;
@@ -138,10 +139,45 @@ public ResponseData<Boolean> addIssuer(
138139
public ResponseData<String> getWeIdFromOrgId(String orgId);
139140

140141
public ResponseData<Boolean> recognizeWeId(Boolean isRecognize, String addr, String privateKey);
141-
142+
142143
/**
143144
* get the issuer count.
144145
* @return the all issuer
145146
*/
146147
public ResponseData<Integer> getIssuerCount();
148+
149+
/**
150+
* get the issuer count with Recognized.
151+
* @return the all issuer with Recognized
152+
*/
153+
public ResponseData<Integer> getRecognizedIssuerCount();
154+
155+
/**
156+
* get the issuer size in issuerType.
157+
* @param issuerType the issuerType
158+
* @return the all issuer in issuerType
159+
*/
160+
public ResponseData<Integer> getSpecificTypeIssuerSize(String issuerType);
161+
162+
/**
163+
* get the issuer type count.
164+
* @return the all issuer type
165+
*/
166+
public ResponseData<Integer> getIssuerTypeCount();
167+
168+
/**
169+
* remove the issuerType.
170+
* @param issuerType the issuerType name
171+
* @param privateKey the privateKey
172+
* @return true is success, false is fail
173+
*/
174+
public ResponseData<Boolean> removeIssuerType(String issuerType, String privateKey);
175+
176+
/**
177+
* get the issuerType list.
178+
* @param index the start index
179+
* @param num the page size
180+
* @return the issuerType list
181+
*/
182+
public ResponseData<List<IssuerType>> getIssuerTypeList(Integer index, Integer num);
147183
}

0 commit comments

Comments
 (0)