From 785b475c36855899d41e60f77ffda602f81b0c76 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 8 Jul 2024 16:01:30 +0530 Subject: [PATCH 1/3] feat: update fnd java version and unit-tests Signed-off-by: Gaurav Goel --- build.gradle | 2 +- .../org/torusresearch/torusutilstest/AquaTest.java | 2 +- .../torusresearch/torusutilstest/CelesteTest.java | 14 +++++++------- .../org/torusresearch/torusutilstest/CyanTest.java | 2 +- .../torusresearch/torusutilstest/MainnetTest.java | 2 +- .../torusresearch/torusutilstest/OneKeyTest.java | 2 +- .../torusutilstest/TorusUtilsTest.java | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 9891c65..db93e7b 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ repositories { } dependencies { - implementation 'org.torusresearch:fetch-node-details-java:3.1.0' + implementation 'com.github.torusresearch:fetch-node-details-java:4.1.1' implementation 'org.web3j:core:4.8.8-android' implementation 'com.google.code.gson:gson:2.9.0' implementation 'com.squareup.okhttp3:okhttp:4.9.3' diff --git a/src/test/java/org/torusresearch/torusutilstest/AquaTest.java b/src/test/java/org/torusresearch/torusutilstest/AquaTest.java index 4239a89..ba52a59 100644 --- a/src/test/java/org/torusresearch/torusutilstest/AquaTest.java +++ b/src/test/java/org/torusresearch/torusutilstest/AquaTest.java @@ -49,7 +49,7 @@ public class AquaTest { @BeforeAll static void setup() throws ExecutionException, InterruptedException, IOException, NoSuchAlgorithmException, InvalidKeySpecException { System.out.println("Setup Starting"); - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.AQUA, FetchNodeDetails.PROXY_ADDRESS_AQUA); + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.AQUA); TorusCtorOptions opts = new TorusCtorOptions("Custom", "YOUR_CLIENT_ID"); opts.setNetwork("aqua"); opts.setSignerHost("https://signer-polygon.tor.us/api/sign"); diff --git a/src/test/java/org/torusresearch/torusutilstest/CelesteTest.java b/src/test/java/org/torusresearch/torusutilstest/CelesteTest.java index d44a1ce..ca960a8 100644 --- a/src/test/java/org/torusresearch/torusutilstest/CelesteTest.java +++ b/src/test/java/org/torusresearch/torusutilstest/CelesteTest.java @@ -50,7 +50,7 @@ public class CelesteTest { @BeforeAll static void setup() throws ExecutionException, InterruptedException, IOException, NoSuchAlgorithmException, InvalidKeySpecException { System.out.println("Setup Startingg"); - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CELESTE, FetchNodeDetails.PROXY_ADDRESS_CELESTE); + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CELESTE); TorusCtorOptions opts = new TorusCtorOptions("Custom", "YOUR_CLIENT_ID"); opts.setNetwork("celeste"); opts.setSignerHost("https://signer-polygon.tor.us/api/sign"); @@ -67,7 +67,7 @@ public void shouldGetPublicAddress() throws ExecutionException, InterruptedExcep VerifierArgs args = new VerifierArgs("tkey-google-celeste", TORUS_TEST_EMAIL); NodeDetails nodeDetails = fetchNodeDetails.getNodeDetails(args.getVerifier(), args.getVerifierId()).get(); TorusPublicKey publicAddress = torusUtils.getPublicAddress(nodeDetails.getTorusNodeEndpoints(), nodeDetails.getTorusNodePub(), args).get(); - assertEquals("0xeC80FB9aB308Be1789Bd3f9317962D5505A4A242", publicAddress.getAddress()); + assertEquals("0xC3115b9d6FaB99739b23DA9dfcBA47A4Ec4Cd113", publicAddress.getAddress()); } @@ -77,21 +77,21 @@ public void shouldFetchUserTypeAndPublicAddress() throws ExecutionException, Int VerifierArgs args = new VerifierArgs("tkey-google-celeste", TORUS_TEST_EMAIL); NodeDetails nodeDetails = fetchNodeDetails.getNodeDetails(args.getVerifier(), args.getVerifierId()).get(); TorusPublicKey key = torusUtils.getUserTypeAndAddress(nodeDetails.getTorusNodeEndpoints(), nodeDetails.getTorusNodePub(), args).get(); - assertEquals("0xeC80FB9aB308Be1789Bd3f9317962D5505A4A242", key.getAddress()); + assertEquals("0xC3115b9d6FaB99739b23DA9dfcBA47A4Ec4Cd113", key.getAddress()); assertEquals(TypeOfUser.v1, key.getTypeOfUser()); String v2Verifier = "tkey-google-celeste"; // 1/1 user String v2TestEmail = "somev2user@gmail.com"; TorusPublicKey key2 = torusUtils.getUserTypeAndAddress(nodeDetails.getTorusNodeEndpoints(), nodeDetails.getTorusNodePub(), new VerifierArgs(v2Verifier, v2TestEmail)).get(); - assertEquals("0x69fB3A96016817F698a1279aE2d65F3916F3Db6F", key2.getAddress()); - assertEquals(TypeOfUser.v1, key2.getTypeOfUser()); + assertEquals("0x8d69CE354DA39413f205FdC8680dE1F3FBBb36e2", key2.getAddress()); + assertEquals(TypeOfUser.v2, key2.getTypeOfUser()); // 2/n user String v2nTestEmail = "caspertorus@gmail.com"; TorusPublicKey key3 = torusUtils.getUserTypeAndAddress(nodeDetails.getTorusNodeEndpoints(), nodeDetails.getTorusNodePub(), new VerifierArgs(v2Verifier, v2nTestEmail)).get(); - assertEquals("0x24aCac36F8A4bD93052207dA410dA71AF92258b7", key3.getAddress()); - assertEquals(TypeOfUser.v1, key3.getTypeOfUser()); + assertEquals("0x8108c29976C458e76f797AD55A3715Ce80a3fe78", key3.getAddress()); + assertEquals(TypeOfUser.v2, key3.getTypeOfUser()); } @DisplayName("Key Assign test") diff --git a/src/test/java/org/torusresearch/torusutilstest/CyanTest.java b/src/test/java/org/torusresearch/torusutilstest/CyanTest.java index 953e0ba..0e00910 100644 --- a/src/test/java/org/torusresearch/torusutilstest/CyanTest.java +++ b/src/test/java/org/torusresearch/torusutilstest/CyanTest.java @@ -50,7 +50,7 @@ public class CyanTest { @BeforeAll static void setup() throws ExecutionException, InterruptedException, IOException, NoSuchAlgorithmException, InvalidKeySpecException { System.out.println("Setup Starting"); - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CYAN, FetchNodeDetails.PROXY_ADDRESS_CYAN); + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.CYAN); TorusCtorOptions opts = new TorusCtorOptions("Custom", "YOUR_CLIENT_ID"); opts.setNetwork("cyan"); opts.setSignerHost("https://signer-polygon.tor.us/api/sign"); diff --git a/src/test/java/org/torusresearch/torusutilstest/MainnetTest.java b/src/test/java/org/torusresearch/torusutilstest/MainnetTest.java index 702c069..617e0d2 100644 --- a/src/test/java/org/torusresearch/torusutilstest/MainnetTest.java +++ b/src/test/java/org/torusresearch/torusutilstest/MainnetTest.java @@ -50,7 +50,7 @@ public class MainnetTest { @BeforeAll static void setup() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { System.out.println("Setup Starting"); - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.MAINNET, FetchNodeDetails.PROXY_ADDRESS_MAINNET); + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.MAINNET); TorusCtorOptions opts = new TorusCtorOptions("Custom", "YOUR_CLIENT_ID"); opts.setNetwork("mainnet"); torusUtils = new TorusUtils(opts); diff --git a/src/test/java/org/torusresearch/torusutilstest/OneKeyTest.java b/src/test/java/org/torusresearch/torusutilstest/OneKeyTest.java index 4643305..46677ba 100644 --- a/src/test/java/org/torusresearch/torusutilstest/OneKeyTest.java +++ b/src/test/java/org/torusresearch/torusutilstest/OneKeyTest.java @@ -50,7 +50,7 @@ public class OneKeyTest { @BeforeAll static void setup() throws ExecutionException, InterruptedException, IOException, NoSuchAlgorithmException, InvalidKeySpecException { System.out.println("Setup Starting"); - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.TESTNET, FetchNodeDetails.PROXY_ADDRESS_TESTNET); + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.TESTNET); TorusCtorOptions opts = new TorusCtorOptions("Custom", "YOUR_CLIENT_ID"); opts.setNetwork("testnet"); opts.setEnableOneKey(true); diff --git a/src/test/java/org/torusresearch/torusutilstest/TorusUtilsTest.java b/src/test/java/org/torusresearch/torusutilstest/TorusUtilsTest.java index bb93390..4f7e800 100644 --- a/src/test/java/org/torusresearch/torusutilstest/TorusUtilsTest.java +++ b/src/test/java/org/torusresearch/torusutilstest/TorusUtilsTest.java @@ -50,7 +50,7 @@ public class TorusUtilsTest { @BeforeAll static void setup() throws ExecutionException, InterruptedException, IOException, NoSuchAlgorithmException, InvalidKeySpecException { System.out.println("Setup Starting"); - fetchNodeDetails = new FetchNodeDetails(TorusNetwork.TESTNET, FetchNodeDetails.PROXY_ADDRESS_TESTNET); + fetchNodeDetails = new FetchNodeDetails(TorusNetwork.TESTNET); TorusCtorOptions opts = new TorusCtorOptions("Custom", "YOUR_CLIENT_ID"); opts.setNetwork("testnet"); torusUtils = new TorusUtils(opts); @@ -65,7 +65,7 @@ public void shouldGetPublicAddress() throws ExecutionException, InterruptedExcep VerifierArgs args = new VerifierArgs("google-lrc", TORUS_TEST_EMAIL); NodeDetails nodeDetails = fetchNodeDetails.getNodeDetails(args.getVerifier(), args.getVerifierId()).get(); TorusPublicKey publicAddress = torusUtils.getPublicAddress(nodeDetails.getTorusNodeEndpoints(), nodeDetails.getTorusNodePub(), args).get(); - assertEquals("0xFf5aDad69F4e97AF4D4567e7C333C12df6836a70", publicAddress.getAddress()); + assertEquals("0x872eEfa7495599A6983d396fE8dcf542457CF33f", publicAddress.getAddress()); } @@ -75,7 +75,7 @@ public void shouldFetchUserTypeAndPublicAddress() throws ExecutionException, Int VerifierArgs args = new VerifierArgs("google-lrc", TORUS_TEST_EMAIL); NodeDetails nodeDetails = fetchNodeDetails.getNodeDetails(args.getVerifier(), args.getVerifierId()).get(); TorusPublicKey key = torusUtils.getUserTypeAndAddress(nodeDetails.getTorusNodeEndpoints(), nodeDetails.getTorusNodePub(), args).get(); - assertEquals("0xFf5aDad69F4e97AF4D4567e7C333C12df6836a70", key.getAddress()); + assertEquals("0x872eEfa7495599A6983d396fE8dcf542457CF33f", key.getAddress()); assertEquals(TypeOfUser.v1, key.getTypeOfUser()); String v2Verifier = "tkey-google-lrc"; From e9f3d8de287035b3666e42ca2987929b608eccbd Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 8 Jul 2024 16:01:51 +0530 Subject: [PATCH 2/3] feat: update fnd java version and unit-tests Signed-off-by: Gaurav Goel --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index db93e7b..3444bac 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'org.torusresearch' -version '3.2.1' +version '3.2.2' sourceCompatibility = 1.8 targetCompatibility = 1.8 From 3709e97892e6ffd394d97a936b662e936da8e238 Mon Sep 17 00:00:00 2001 From: Chaitanya Potti Date: Mon, 8 Jul 2024 19:50:37 +0800 Subject: [PATCH 3/3] fix test --- build.gradle | 2 +- src/test/java/org/torusresearch/torusutilstest/CyanTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3444bac..8f9a928 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ repositories { } dependencies { - implementation 'com.github.torusresearch:fetch-node-details-java:4.1.1' + implementation 'org.torusresearch:fetch-node-details-java:4.1.1' implementation 'org.web3j:core:4.8.8-android' implementation 'com.google.code.gson:gson:2.9.0' implementation 'com.squareup.okhttp3:okhttp:4.9.3' diff --git a/src/test/java/org/torusresearch/torusutilstest/CyanTest.java b/src/test/java/org/torusresearch/torusutilstest/CyanTest.java index 0e00910..06e54cc 100644 --- a/src/test/java/org/torusresearch/torusutilstest/CyanTest.java +++ b/src/test/java/org/torusresearch/torusutilstest/CyanTest.java @@ -112,7 +112,7 @@ public void shouldLogin() throws ExecutionException, InterruptedException, Torus put("verifier_id", TORUS_TEST_EMAIL); }}, JwtUtils.generateIdToken(TORUS_TEST_EMAIL, algorithmRs)).get(); System.out.println(retrieveSharesResponse.getPrivKey()); - BigInteger requiredPrivateKey = new BigInteger("1e0c955d73e73558f46521da55cc66de7b8fcb56c5b24e851616849b6a1278c8", 16); + BigInteger requiredPrivateKey = new BigInteger("42385046760370370667571434468449261359414980205144543049037030193411736357576", 10); assert (requiredPrivateKey.equals(retrieveSharesResponse.getPrivKey())); assertEquals("0xC615aA03Dd8C9b2dc6F7c43cBDfF2c34bBa47Ec9", retrieveSharesResponse.getEthAddress()); }