diff --git a/pom.xml b/pom.xml index e83f36d..8f34f83 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.recheck-io hammerJ - 1.0.13 + 1.0.15 diff --git a/src/main/java/io/recheck/client/crypto/E2EEncryption.java b/src/main/java/io/recheck/client/crypto/E2EEncryption.java index b67f813..5783d96 100644 --- a/src/main/java/io/recheck/client/crypto/E2EEncryption.java +++ b/src/main/java/io/recheck/client/crypto/E2EEncryption.java @@ -1157,29 +1157,34 @@ public JSONObject checkHash(String dataChainId, String userId) throws ServerExce * @throws ServerException */ public JSONObject checkHashWithExternalId(String dataChainId, String userId, String requestId) throws ServerException, ValidationException { - if (userId.contains("re_")) { - userId = userId.substring(3); - } + if (validateEthAddress(userId) || validateAEAddress(userId)) { + if (userId.contains("re_")) { + userId = userId.substring(3); + } - try{ - JSONObject result = convertExternalId(dataChainId, userId); - dataChainId = result.get("dataId").toString(); - }catch (Exception e){ - throw new ValidationException(e.getMessage()); - } + try{ + JSONObject result = convertExternalId(dataChainId, userId); + dataChainId = result.get("dataId").toString(); + }catch (Exception e){ + throw new ValidationException(e.getMessage()); + } - String query = "&userId=" + userId + "&dataId=" + dataChainId + "&requestId=" + requestId; + String query = "&userId=" + userId + "&dataId=" + dataChainId + "&requestId=" + requestId; - String getUrl = getEndpointUrl("tx/info", query); - LOGGER.severe("query URL " + getUrl); + String getUrl = getEndpointUrl("tx/info", query); + LOGGER.severe("query URL " + getUrl); - String serverResponse = getRequest(getUrl); - JSONObject serverRes = new JSONObject(serverResponse); + String serverResponse = getRequest(getUrl); + JSONObject serverRes = new JSONObject(serverResponse); - LOGGER.severe("Server responds to checkHash GET " + serverRes.get("data")); + LOGGER.severe("Server responds to checkHash GET " + serverRes.get("data")); + + return serverRes; + }else { + throw new ValidationException("The userId is invalid."); + } - return serverRes; } /**