Skip to content

Commit

Permalink
Merge pull request #361 from WeBankBlockchain/feature/reconstruction
Browse files Browse the repository at this point in the history
release 3.1.0-rc.1
  • Loading branch information
youwenbusi authored Apr 28, 2023
2 parents 586cea6 + 5a5feae commit a318ab1
Show file tree
Hide file tree
Showing 121 changed files with 5,101 additions and 573 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### V3.1.0 (2023-4-28)
- Features:
1. Add a way for local databases to deploy WeIdentity without deploying blockchain
- Bugfixes:
1. Upgrade components with known vulnerabilities

### V3.0.0 (2022-12-15)
- Features:
1. The project was restructured to strip the blockchain-related functions and interfaces from the project, as well as the file transfer and format conversion functions from the project
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-rc.1
3.1.0-rc.1
24 changes: 14 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ List lombok = [
"org.projectlombok:lombok:1.18.10"
]

def log4j_version="2.18.0"
def log4j_version="2.20.0"
List logger = [
"org.slf4j:jul-to-slf4j:1.7.30",
"org.apache.logging.log4j:log4j-api:$log4j_version",
Expand All @@ -106,7 +106,7 @@ List jmockit = [
"org.jmockit:jmockit:1.47"
]

def jackson_version="2.13.3"
def jackson_version="2.14.2"
List json = [
"com.fasterxml.jackson.core:jackson-databind:$jackson_version",
"com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jackson_version",
Expand All @@ -116,7 +116,7 @@ List json = [
"com.networknt:json-schema-validator:1.0.71",
]

def gson_version = "2.8.9"
def gson_version = "2.10.1"
List gson = [
"com.google.code.gson:gson:$gson_version"
]
Expand All @@ -127,7 +127,7 @@ List mysql_driver = [
]

List redisson = [
"org.redisson:redisson:3.13.1"
"org.redisson:redisson:3.20.0"
]

List zxing = [
Expand All @@ -145,7 +145,7 @@ List pdfbox = [
]

List protobuf = [
"com.google.protobuf:protobuf-java:3.19.2"
"com.google.protobuf:protobuf-java:3.22.2"
]

List caffeine = [
Expand All @@ -156,8 +156,13 @@ List oval = [
"net.sf.oval:oval:3.2.1"
]

List xstream = [
"com.thoughtworks.xstream:xstream:1.4.20"
]

List spring = [
"org.springframework:spring-core:5.3.21"
"org.springframework:spring-core:5.3.21",
"org.springframework:spring-context:5.3.25"
]

configurations {
Expand All @@ -172,10 +177,9 @@ configurations.all {
dependencies {
localDeps 'org.projectlombok:lombok:1.18.10'
if (!gradle.startParameter.isOffline()) {
compile logger, lombok, apache_commons, json, mysql_driver, redisson, zxing, rpc, pdfbox, protobuf, caffeine, oval, gson
compile logger, lombok, apache_commons, json, mysql_driver, redisson, zxing, rpc, pdfbox, protobuf, caffeine, oval, gson, spring, xstream
//compile("com.webank:weid-contract-java:1.3.1-rc.2-SNAPSHOT")
//compile("com.webank:weid-contract-java:1.3.1-rc1")
compile("com.webank:weid-blockchain:3.0.0-rc.1")
compile("com.webank:weid-blockchain:3.1.0-rc.1")

compile fileTree(dir: 'lib', include: '*.jar')
implementation 'com.google.guava:guava:31.1-jre'
Expand All @@ -184,7 +188,7 @@ dependencies {
implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.15'
annotationProcessor lombok

testCompile logger, lombok, apache_commons, json, junit, jmockit, rpc, pdfbox, protobuf, caffeine, oval, spring, gson
testCompile logger, lombok, apache_commons, json, junit, jmockit, rpc, pdfbox, protobuf, caffeine, oval, spring, gson, xstream
testAnnotationProcessor lombok
}
if (gradleVer.startsWith("4")) {
Expand Down
6 changes: 3 additions & 3 deletions dist/conf/fisco.properties.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ group.id=1
sdk.sm-crypto=${SDK_SM_CRYPTO}
# fisco-bcos sdk cert path contains[ca.crt,sdk.crt,sdk.key]
# if sdk.sm-crypto is true, contains [gm] directory, and gm dir contains [gmca.crt,gmsdk.crt,gmsdk.key,gmensdk.crt,gmensdk.key]
sdk.cert-path=conf
sdk.cert-path=resources/conf

# amop public key of pem and private key of p12 configuration
amop.pub-path=conf/amop/consumer_public_key.pem
amop.pri-path=conf/amop/consumer_private_key.p12
amop.pub-path=resources/conf/amop/consumer_public_key.pem
amop.pri-path=resources/conf/amop/consumer_private_key.p12
amop.p12-password=123456
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
jdkTlsNamedGroups=secp256r1,secp256k1
repoType=cn
signing.keyId=
signing.password=
signing.secretKeyRingFile=
sonatypeUsername=
sonatypePassword=
repoType=zn
signing.keyId=62A32F80
signing.password=weidentity@123
signing.secretKeyRingFile=./secring.gpg
sonatypeUsername=tonychen
sonatypePassword=Abcd1234!@#$
2 changes: 1 addition & 1 deletion src/main/java/com/webank/weid/app/AppCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.exception.InitWeb3jException;
import com.webank.weid.protocol.response.ResponseData;
import com.webank.weid.blockchain.protocol.response.ResponseData;
import com.webank.weid.service.rpc.WeIdService;
import com.webank.weid.service.impl.WeIdServiceImpl;
import org.apache.commons.lang3.StringUtils;
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/webank/weid/constant/DataDriverConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,25 @@ public final class DataDriverConstant {
public static final String DOMAIN_RESOURCE_INFO = "domain.resourceInfo";

public static final String DOMAIN_WEID_AUTH = "domain.weIdAuth";

/**
* 本地运行所需表.
*/

public static final String LOCAL_WEID_DOCUMENT = "local.weIdDocument";

public static final String LOCAL_CPT = "local.cpt";

public static final String LOCAL_POLICY = "local.policy";

public static final String LOCAL_PRESENTATION = "local.presentation";

public static final String LOCAL_ROLE = "local.role";

public static final String LOCAL_AUTHORITY_ISSUER = "local.authorityIssuer";

public static final String LOCAL_SPECIFIC_ISSUER = "local.specificIssuer";

public static final String LOCAL_EVIDENCE = "local.evidence";

}
5 changes: 5 additions & 0 deletions src/main/java/com/webank/weid/constant/WeIdConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ public final class WeIdConstant {

public static final Long RECOGNIZED_AUTHORITY_ISSUER_FLAG = 1L;

/*
* State file path for run local
*/
public static final String STATE_FILE_PATH = "output/local_state";

public static enum PublicKeyType {
SM2("SM2"),
//RSA("RSA"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.exception;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;

/**
* WeIdBase Exception. Base Exception for WeIdentity Project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.exception;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;

/**
* Database Exception. Base Exception for WeIdentity Project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.exception;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;

/**
* InitWeb3sdk Exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.exception;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;

/**
* Load Contract Exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.exception;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;

/**
* Private Key IllegalException.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.exception;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;

/**
* WeIdBase Exception. Base Exception for WeIdentity Project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.protocol.base;

import com.webank.weid.blockchain.util.DataToolUtils;
import com.webank.weid.util.DataToolUtils;
import com.webank.weid.util.Multibase.Multibase;
import com.webank.weid.util.Multicodec.DecodedData;
import com.webank.weid.util.Multicodec.MulticodecEncoder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;
import com.webank.weid.constant.ParamKeyConstant;
import com.webank.weid.protocol.inf.Hashable;
import com.webank.weid.util.CredentialUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import com.webank.weid.constant.CredentialConstant;
import com.webank.weid.constant.CredentialType;
import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;
import com.webank.weid.constant.ParamKeyConstant;
import com.webank.weid.exception.DataTypeCastException;
import com.webank.weid.protocol.inf.Hashable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;
import com.webank.weid.protocol.inf.Hashable;
import com.webank.weid.util.CredentialUtils;

Expand Down
71 changes: 71 additions & 0 deletions src/main/java/com/webank/weid/protocol/base/GlobalStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.webank.weid.protocol.base;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.webank.weid.blockchain.protocol.inf.JsonSerializer;
import com.webank.weid.contract.deploy.AddressProcess;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;


/**
* The class of global status for running locally with database.
*
* @author afeexian
*/
@Data
public class GlobalStatus implements JsonSerializer {

private static final Logger logger = LoggerFactory.getLogger(GlobalStatus.class);

private int authority_issuer_current_cpt_id = 1000;

private int none_authority_issuer_current_cpt_id = 2000000;

private int authority_issuer_current_policy_id = 1000;

private int none_authority_issuer_current_policy_id = 2000000;

private int presentationId = 1;

//TODO:给文件加锁
public static void storeStatusToFile(GlobalStatus globalStatus, String fileName) {
try {
ObjectMapper mapper = new ObjectMapper();
File file = new File(fileName);
// if file does not exists, then create it
if (!file.exists()) {
file.createNewFile();
}
mapper.writeValue(file, globalStatus);
} catch (IOException e) {
logger.error("writer file exception", e);
}
}

public static GlobalStatus readStatusFromFile(String fileName) {
try {
ObjectMapper mapper = new ObjectMapper();
File file = new File(fileName);
// if file does not exists, then create it
if (file.exists()) {
return mapper.readValue(file, GlobalStatus.class);
}
file.createNewFile();
return new GlobalStatus();
} catch (IOException e) {
logger.error("writer file exception", e);
}
logger.error("readStatusFromFile() the {} does not exists.", fileName);
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package com.webank.weid.protocol.base;

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.blockchain.constant.ErrorCode;
import com.webank.weid.constant.ParamKeyConstant;
import com.webank.weid.exception.DataTypeCastException;
import com.webank.weid.protocol.inf.IProof;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* The base data structure to handle WeIdentity DID authority info.
*
* @author darwindu
* @author afeexian
*/
@Data
public class WeIdAuthentication {
Expand Down
Loading

0 comments on commit a318ab1

Please sign in to comment.