From c48c8d125f7eaa4778683e72cd49af14e6a8ba06 Mon Sep 17 00:00:00 2001 From: Omer Akram Date: Sat, 27 Jun 2020 01:24:39 +0500 Subject: [PATCH] bump dependencies versions (#490) --- autobahn/build.gradle | 26 +- .../autobahn/wamp/interfaces/ISerializer.java | 2 +- .../src/main/java/xbr/network/KeySeries.java | 1 - autobahn/src/main/java/xbr/network/Util.java | 5 +- .../src/main/java/xbr/network/web3/Pair.java | 32 -- .../java/xbr/network/web3/StructuredData.java | 128 ------ .../network/web3/StructuredDataEncoder.java | 435 ------------------ build.gradle | 2 +- 8 files changed, 17 insertions(+), 614 deletions(-) delete mode 100644 autobahn/src/main/java/xbr/network/web3/Pair.java delete mode 100644 autobahn/src/main/java/xbr/network/web3/StructuredData.java delete mode 100644 autobahn/src/main/java/xbr/network/web3/StructuredDataEncoder.java diff --git a/autobahn/build.gradle b/autobahn/build.gradle index 9a87f2b2..cef6788a 100644 --- a/autobahn/build.gradle +++ b/autobahn/build.gradle @@ -16,26 +16,26 @@ def relVersion = System.getenv().containsKey('AUTOBAHN_BUILD_VERSION') ? System. def siteUrl = 'https://github.com/crossbario/autobahn-java' dependencies { - api 'com.fasterxml.jackson.core:jackson-core:2.9.8' + api 'com.fasterxml.jackson.core:jackson-core:2.11.1' //api 'net.sourceforge.streamsupport:streamsupport-cfuture:1.6.2' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8' - implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.9.8' - implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.16' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.11.1' + implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.20' if (project.IS_ANDROID) { implementation 'com.github.joshjdevl.libsodiumjni:libsodium-jni-aar:2.0.2' - implementation 'org.web3j:core:4.2.0-android' - implementation 'org.web3j:abi:4.2.0-android' - implementation 'org.web3j:utils:4.2.0-android' + implementation 'org.web3j:core:4.6.0-android' + implementation 'org.web3j:abi:4.6.0-android' + implementation 'org.web3j:utils:4.6.0-android' } else { implementation 'com.github.joshjdevl.libsodiumjni:libsodium-jni:2.0.2' - implementation 'org.web3j:core:4.2.0' - implementation 'org.web3j:abi:4.2.0' - implementation 'org.web3j:utils:4.2.0' - implementation 'org.json:json:20190722' + implementation 'org.web3j:core:4.6.0' + implementation 'org.web3j:abi:4.6.0' + implementation 'org.web3j:utils:4.6.0' + implementation 'org.json:json:20200518' } if (project.IS_NETTY) { - implementation 'io.netty:netty-codec-http:4.1.34.Final' - implementation 'io.netty:netty-handler:4.1.34.Final' + implementation 'io.netty:netty-codec-http:4.1.50.Final' + implementation 'io.netty:netty-handler:4.1.50.Final' } } diff --git a/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java b/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java index 0f721091..dee3db2c 100644 --- a/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java +++ b/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java @@ -51,7 +51,7 @@ public List unserialize(byte[] payload, boolean isBinary) { } } - public T convertValue(Object fromValue, TypeReference toValueTypeRef) { + public T convertValue(Object fromValue, TypeReference toValueTypeRef) { // https://github.com/FasterXML/jackson-databind#tutorial-fancier-stuff-conversions // ResultType result = mapper.convertValue(sourceObject, ResultType.class); return mapper.convertValue(fromValue, toValueTypeRef); diff --git a/autobahn/src/main/java/xbr/network/KeySeries.java b/autobahn/src/main/java/xbr/network/KeySeries.java index bf1be92a..d48d0cc1 100644 --- a/autobahn/src/main/java/xbr/network/KeySeries.java +++ b/autobahn/src/main/java/xbr/network/KeySeries.java @@ -20,7 +20,6 @@ import org.web3j.utils.Numeric; import java.math.BigInteger; -import java.security.SecureRandom; import java.util.HashMap; import java.util.Map; import java.util.Timer; diff --git a/autobahn/src/main/java/xbr/network/Util.java b/autobahn/src/main/java/xbr/network/Util.java index b7311182..ed8ac195 100644 --- a/autobahn/src/main/java/xbr/network/Util.java +++ b/autobahn/src/main/java/xbr/network/Util.java @@ -18,14 +18,13 @@ import org.web3j.crypto.ECKeyPair; import org.web3j.crypto.Keys; import org.web3j.crypto.Sign; +import org.web3j.crypto.StructuredDataEncoder; import org.web3j.utils.Numeric; import java.io.IOException; import java.math.BigInteger; import java.util.Arrays; -import xbr.network.web3.StructuredDataEncoder; - public class Util { private static final String VERIFYING_ADDR = "0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B"; @@ -102,7 +101,7 @@ static byte[] signEIP712Data(ECKeyPair keyPair, byte[] channelAddr, int channelS byte[] result = new byte[65]; System.arraycopy(r, 0, result, 0, r.length); System.arraycopy(s, 0, result, r.length, s.length); - result[64] = signed.getV(); + result[64] = signed.getV()[0]; return result; } diff --git a/autobahn/src/main/java/xbr/network/web3/Pair.java b/autobahn/src/main/java/xbr/network/web3/Pair.java deleted file mode 100644 index 2e893408..00000000 --- a/autobahn/src/main/java/xbr/network/web3/Pair.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2019 Web3 Labs LTD. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package xbr.network.web3; - -public class Pair { - private final Object first; - private final Object second; - - public Object getFirst() { - return first; - } - - public Object getSecond() { - return second; - } - - public Pair(Object first, Object second) { - this.first = first; - this.second = second; - } -} diff --git a/autobahn/src/main/java/xbr/network/web3/StructuredData.java b/autobahn/src/main/java/xbr/network/web3/StructuredData.java deleted file mode 100644 index 3d64ef9c..00000000 --- a/autobahn/src/main/java/xbr/network/web3/StructuredData.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2019 Web3 Labs LTD. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package xbr.network.web3; - -import java.util.HashMap; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.web3j.abi.datatypes.Address; -import org.web3j.abi.datatypes.generated.Uint256; - -public class StructuredData { - static class Entry { - private final String name; - private final String type; - - @JsonCreator - public Entry( - @JsonProperty(value = "name") String name, - @JsonProperty(value = "type") String type) { - this.name = name; - this.type = type; - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - } - - static class EIP712Domain { - private final String name; - private final String version; - private final Uint256 chainId; - private final Address verifyingContract; - - @JsonCreator - public EIP712Domain( - @JsonProperty(value = "name") String name, - @JsonProperty(value = "version") String version, - @JsonProperty(value = "chainId") Uint256 chainId, - @JsonProperty(value = "verifyingContract") Address verifyingContract) { - this.name = name; - this.version = version; - this.chainId = chainId; - this.verifyingContract = verifyingContract; - } - - public String getName() { - return name; - } - - public String getVersion() { - return version; - } - - public Uint256 getChainId() { - return chainId; - } - - public Address getVerifyingContract() { - return verifyingContract; - } - } - - static class EIP712Message { - private final HashMap> types; - private final String primaryType; - private final Object message; - private final EIP712Domain domain; - - @JsonCreator - public EIP712Message( - @JsonProperty(value = "types") HashMap> types, - @JsonProperty(value = "primaryType") String primaryType, - @JsonProperty(value = "message") Object message, - @JsonProperty(value = "domain") EIP712Domain domain) { - this.types = types; - this.primaryType = primaryType; - this.message = message; - this.domain = domain; - } - - public HashMap> getTypes() { - return types; - } - - public String getPrimaryType() { - return primaryType; - } - - public Object getMessage() { - return message; - } - - public EIP712Domain getDomain() { - return domain; - } - - @Override - public String toString() { - return "EIP712Message{" - + "primaryType='" - + this.primaryType - + '\'' - + ", message='" - + this.message - + '\'' - + '}'; - } - } -} diff --git a/autobahn/src/main/java/xbr/network/web3/StructuredDataEncoder.java b/autobahn/src/main/java/xbr/network/web3/StructuredDataEncoder.java deleted file mode 100644 index e6240f9d..00000000 --- a/autobahn/src/main/java/xbr/network/web3/StructuredDataEncoder.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright 2019 Web3 Labs LTD. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package xbr.network.web3; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.web3j.abi.TypeEncoder; -import org.web3j.abi.datatypes.Type; -import org.web3j.abi.datatypes.generated.AbiTypes; -import org.web3j.utils.Numeric; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static org.web3j.crypto.Hash.sha3; -import static org.web3j.crypto.Hash.sha3String; - -public class StructuredDataEncoder { - public final StructuredData.EIP712Message jsonMessageObject; - - // Matches array declarations like arr[5][10], arr[][], arr[][34][], etc. - // Doesn't match array declarations where there is a 0 in any dimension. - // Eg- arr[0][5] is not matched. - final String arrayTypeRegex = "^([a-zA-Z_$][a-zA-Z_$0-9]*)((\\[([1-9]\\d*)?\\])+)$"; - final Pattern arrayTypePattern = Pattern.compile(arrayTypeRegex); - - // This regex tries to extract the dimensions from the - // square brackets of an array declaration using the ``Regex Groups``. - // Eg- It extracts ``5, 6, 7`` from ``[5][6][7]`` - final String arrayDimensionRegex = "\\[([1-9]\\d*)?\\]"; - final Pattern arrayDimensionPattern = Pattern.compile(arrayDimensionRegex); - - // Fields of Entry Objects need to follow a regex pattern - // Type Regex matches to a valid name or an array declaration. - final String typeRegex = "^[a-zA-Z_$][a-zA-Z_$0-9]*(\\[([1-9]\\d*)*\\])*$"; - final Pattern typePattern = Pattern.compile(typeRegex); - // Identifier Regex matches to a valid name, but can't be an array declaration. - final String identifierRegex = "^[a-zA-Z_$][a-zA-Z_$0-9]*$"; - final Pattern identifierPattern = Pattern.compile(identifierRegex); - - public StructuredDataEncoder(String jsonMessageInString) throws IOException, RuntimeException { - // Parse String Message into object and validate - this.jsonMessageObject = parseJSONMessage(jsonMessageInString); - } - - public Set getDependencies(String primaryType) { - // Find all the dependencies of a type - HashMap> types = jsonMessageObject.getTypes(); - Set deps = new HashSet<>(); - - if (!types.containsKey(primaryType)) { - return deps; - } - - List remainingTypes = new ArrayList<>(); - remainingTypes.add(primaryType); - - while (remainingTypes.size() > 0) { - String structName = remainingTypes.get(remainingTypes.size() - 1); - remainingTypes.remove(remainingTypes.size() - 1); - deps.add(structName); - - Iterator itr = types.get(primaryType).iterator(); - while (itr.hasNext()) { - StructuredData.Entry entry = (StructuredData.Entry) itr.next(); - if (entry == null) { - continue; - } - if (!types.containsKey(entry.getType())) { - // Don't expand on non-user defined types - continue; - } else if (deps.contains(entry.getType())) { - // Skip types which are already expanded - continue; - } else { - // Encountered a user defined type - remainingTypes.add(entry.getType()); - } - } - } - - return deps; - } - - public String encodeStruct(String structName) { - HashMap> types = jsonMessageObject.getTypes(); - - String structRepresentation = structName + "("; - for (StructuredData.Entry entry: types.get(structName)) { - if (entry == null) { - continue; - } - structRepresentation += String.format("%s %s,", entry.getType(), entry.getName()); - } - structRepresentation = structRepresentation.substring(0, structRepresentation.length() - 1); - structRepresentation += ")"; - - return structRepresentation; - } - - public String encodeType(String primaryType) { - Set deps = getDependencies(primaryType); - deps.remove(primaryType); - - // Sort the other dependencies based on Alphabetical Order and finally add the primaryType - List depsAsList = new ArrayList<>(deps); - Collections.sort(depsAsList); - depsAsList.add(0, primaryType); - - String result = ""; - for (String structName : depsAsList) { - result += encodeStruct(structName); - } - - return result; - } - - public byte[] typeHash(String primaryType) { - return Numeric.hexStringToByteArray(sha3String(encodeType(primaryType))); - } - - public List getArrayDimensionsFromDeclaration(String declaration) { - // Get the dimensions which were declared in Schema. - // If any dimension is empty, then it's value is set to -1. - Matcher arrayTypeMatcher = arrayTypePattern.matcher(declaration); - arrayTypeMatcher.find(); - String dimensionsString = arrayTypeMatcher.group(1); - Matcher dimensionTypeMatcher = arrayDimensionPattern.matcher(dimensionsString); - List dimensions = new ArrayList<>(); - while (dimensionTypeMatcher.find()) { - String currentDimension = dimensionTypeMatcher.group(1); - if (currentDimension == null) { - dimensions.add(Integer.parseInt("-1")); - } else { - dimensions.add(Integer.parseInt(currentDimension)); - } - } - - return dimensions; - } - - public List getDepthsAndDimensions(Object data, int depth) { - if (!List.class.isInstance(data)) { - // Nothing more to recurse, since the data is no more an array - return new ArrayList<>(); - } - - List list = new ArrayList<>(); - List dataAsArray = (List) data; - list.add(new Pair(depth, dataAsArray.size())); - for (Object subdimensionalData : dataAsArray) { - list.addAll(getDepthsAndDimensions(subdimensionalData, depth + 1)); - } - - return list; - } - - public List getArrayDimensionsFromData(Object data) throws RuntimeException { - List depthsAndDimensions = getDepthsAndDimensions(data, 0); - // groupedByDepth has key as depth and value as List(pair(Depth, Dimension)) - Map> groupedByDepth = - depthsAndDimensions.stream() - .collect( - Collectors.groupingBy( - depthDimensionPair -> depthDimensionPair.getFirst())); - - // depthDimensionsMap is aimed to have key as depth and value as List(Dimension) - Map> depthDimensionsMap = new HashMap<>(); - for (Map.Entry> entry : groupedByDepth.entrySet()) { - List pureDimensions = new ArrayList<>(); - for (Pair depthDimensionPair : entry.getValue()) { - pureDimensions.add((Integer) depthDimensionPair.getSecond()); - } - depthDimensionsMap.put((Integer) entry.getKey(), pureDimensions); - } - - List dimensions = new ArrayList<>(); - for (Map.Entry> entry : depthDimensionsMap.entrySet()) { - Set setOfDimensionsInParticularDepth = new TreeSet<>(entry.getValue()); - if (setOfDimensionsInParticularDepth.size() != 1) { - throw new RuntimeException( - String.format( - "Depth %d of array data has more than one dimensions", - entry.getKey())); - } - dimensions.add(setOfDimensionsInParticularDepth.stream().findFirst().get()); - } - - return dimensions; - } - - public List flattenMultidimensionalArray(Object data) { - if (!List.class.isInstance(data)) { - return new ArrayList() { - { - add(data); - } - }; - } - - List flattenedArray = new ArrayList<>(); - for (Object arrayItem : (List) data) { - for (Object otherArrayItem : flattenMultidimensionalArray(arrayItem)) { - flattenedArray.add(otherArrayItem); - } - } - - return flattenedArray; - } - - public byte[] encodeData(String primaryType, HashMap data) - throws RuntimeException { - HashMap> types = jsonMessageObject.getTypes(); - - List encTypes = new ArrayList<>(); - List encValues = new ArrayList<>(); - - // Add typehash - encTypes.add("bytes32"); - encValues.add(typeHash(primaryType)); - - // Add field contents - for (StructuredData.Entry field : types.get(primaryType)) { - if (field == null) { - continue; - } - Object value = data.get(field.getName()); - - if (field.getType().equals("string")) { - encTypes.add("bytes32"); - byte[] hashedValue = Numeric.hexStringToByteArray(sha3String((String) value)); - encValues.add(hashedValue); - } else if (field.getType().equals("bytes")) { - encTypes.add("bytes32"); - byte[] hashedValue = sha3((byte[]) value); - encValues.add(hashedValue); - } else if (types.containsKey(field.getType())) { - // User Defined Type - byte[] hashedValue = - sha3(encodeData(field.getType(), (HashMap) value)); - encTypes.add("bytes32"); - encValues.add(hashedValue); - } else if (arrayTypePattern.matcher(field.getType()).find()) { - String baseTypeName = field.getType().substring(0, field.getType().indexOf('[')); - List expectedDimensions = - getArrayDimensionsFromDeclaration(field.getType()); - // This function will itself give out errors in case - // that the data is not a proper array - List dataDimensions = getArrayDimensionsFromData(value); - - if (expectedDimensions.size() != dataDimensions.size()) { - // Ex: Expected a 3d array, but got only a 2d array - throw new RuntimeException( - String.format( - "Array Data %s has dimensions %s, " - + "but expected dimensions are %s", - value.toString(), - dataDimensions.toString(), - expectedDimensions.toString())); - } - for (int i = 0; i < expectedDimensions.size(); i++) { - if (expectedDimensions.get(i) == -1) { - // Skip empty or dynamically declared dimensions - continue; - } - if (expectedDimensions.get(i) != dataDimensions.get(i)) { - throw new RuntimeException( - String.format( - "Array Data %s has dimensions %s, " - + "but expected dimensions are %s", - value.toString(), - dataDimensions.toString(), - expectedDimensions.toString())); - } - } - - List arrayItems = flattenMultidimensionalArray(value); - ByteArrayOutputStream concatenatedArrayEncodingBuffer = new ByteArrayOutputStream(); - for (Object arrayItem : arrayItems) { - byte[] arrayItemEncoding = - encodeData(baseTypeName, (HashMap) arrayItem); - concatenatedArrayEncodingBuffer.write( - arrayItemEncoding, 0, arrayItemEncoding.length); - } - byte[] concatenatedArrayEncodings = concatenatedArrayEncodingBuffer.toByteArray(); - byte[] hashedValue = sha3(concatenatedArrayEncodings); - encTypes.add("bytes32"); - encValues.add(hashedValue); - } else { - encTypes.add(field.getType()); - encValues.add(value); - } - } - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - for (int i = 0; i < encTypes.size(); i++) { - Class typeClazz = (Class) AbiTypes.getType(encTypes.get(i)); - - boolean atleastOneConstructorExistsForGivenParametersType = false; - // Using the Reflection API to get the types of the parameters - Constructor[] constructors = typeClazz.getConstructors(); - for (Constructor constructor : constructors) { - // Check which constructor matches - try { - Class[] parameterTypes = constructor.getParameterTypes(); - byte[] temp = - Numeric.hexStringToByteArray( - TypeEncoder.encode( - typeClazz - .getDeclaredConstructor(parameterTypes) - .newInstance(encValues.get(i)))); - baos.write(temp, 0, temp.length); - atleastOneConstructorExistsForGivenParametersType = true; - break; - } catch (IllegalArgumentException - | NoSuchMethodException - | InstantiationException - | IllegalAccessException - | InvocationTargetException e) { - continue; - } - } - - if (!atleastOneConstructorExistsForGivenParametersType) { - throw new RuntimeException( - String.format( - "Received an invalid argument for which no constructor" - + " exists for the ABI Class %s", - typeClazz.getSimpleName())); - } - } - return baos.toByteArray(); - } - - public byte[] hashMessage(String primaryType, HashMap data) - throws RuntimeException { - return sha3(encodeData(primaryType, data)); - } - - public byte[] hashDomain() throws RuntimeException { - ObjectMapper oMapper = new ObjectMapper(); - HashMap data = - oMapper.convertValue(jsonMessageObject.getDomain(), HashMap.class); - - data.put("chainId", ((HashMap) data.get("chainId")).get("value")); - data.put( - "verifyingContract", - ((HashMap) data.get("verifyingContract")).get("value")); - return sha3(encodeData("EIP712Domain", data)); - } - - public void validateStructuredData(StructuredData.EIP712Message jsonMessageObject) - throws RuntimeException { - Iterator typesIterator = jsonMessageObject.getTypes().keySet().iterator(); - while (typesIterator.hasNext()) { - String structName = (String) typesIterator.next(); - List fields = jsonMessageObject.getTypes().get(structName); - Iterator fieldsIterator = fields.iterator(); - while (fieldsIterator.hasNext()) { - StructuredData.Entry entry = fieldsIterator.next(); - if (entry == null) { - continue; - } - if (!identifierPattern.matcher(entry.getName()).find()) { - // raise Error - throw new RuntimeException( - String.format( - "Invalid Identifier %s in %s", entry.getName(), structName)); - } - if (!typePattern.matcher(entry.getType()).find()) { - // raise Error - throw new RuntimeException( - String.format("Invalid Type %s in %s", entry.getType(), structName)); - } - } - } - } - - public StructuredData.EIP712Message parseJSONMessage(String jsonMessageInString) - throws IOException, RuntimeException { - ObjectMapper mapper = new ObjectMapper(); - - // convert JSON string to EIP712Message object - StructuredData.EIP712Message tempJSONMessageObject = - mapper.readValue(jsonMessageInString, StructuredData.EIP712Message.class); - validateStructuredData(tempJSONMessageObject); - - return tempJSONMessageObject; - } - - public byte[] hashStructuredData() throws RuntimeException { - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - final String messagePrefix = "\u0019\u0001"; - byte[] prefix = messagePrefix.getBytes(); - baos.write(prefix, 0, prefix.length); - - byte[] domainHash = hashDomain(); - baos.write(domainHash, 0, domainHash.length); - - byte[] dataHash = - hashMessage( - jsonMessageObject.getPrimaryType(), - (HashMap) jsonMessageObject.getMessage()); - baos.write(dataHash, 0, dataHash.length); - - byte[] result = baos.toByteArray(); - return sha3(result); - } -} diff --git a/build.gradle b/build.gradle index 06774b2e..3e843a8a 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5' } // Android specific dependencies. if (project.properties.get('buildPlatform', 'android') == 'android') {