Skip to content

Commit

Permalink
Merge pull request #26 from torusresearch/feat/updates
Browse files Browse the repository at this point in the history
Feat/updates
  • Loading branch information
chaitanyapotti authored Jul 8, 2024
2 parents ddb01b7 + 3709e97 commit 5007915
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'org.torusresearch'
version '3.2.1'
version '3.2.2'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -15,7 +15,7 @@ repositories {
}

dependencies {
implementation 'org.torusresearch:fetch-node-details-java:3.1.0'
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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
14 changes: 7 additions & 7 deletions src/test/java/org/torusresearch/torusutilstest/CelesteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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());
}


Expand All @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/torusresearch/torusutilstest/CyanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
}


Expand All @@ -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";
Expand Down

0 comments on commit 5007915

Please sign in to comment.