From 05174a09a5e426291c6ec7b7ab2a4a3e47614e0b Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 8 Jul 2024 17:45:49 +0530 Subject: [PATCH 1/2] refactor: update fnd-java, torus-utils-java and session-manager-android deps Signed-off-by: Gaurav Goel --- singlefactorauth/build.gradle | 6 +++--- .../web3auth/singlefactorauth/SingleFactorAuth.kt | 15 ++------------- .../types/SingleFactorAuthArgs.kt | 10 ---------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/singlefactorauth/build.gradle b/singlefactorauth/build.gradle index 2cfa96c..59517d4 100644 --- a/singlefactorauth/build.gradle +++ b/singlefactorauth/build.gradle @@ -37,12 +37,12 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'org.web3j:crypto:4.9.5' - implementation 'com.github.torusresearch:torus-utils-java:3.2.1' - implementation 'org.torusresearch:fetch-node-details-java:3.1.0' + implementation 'com.github.torusresearch:torus-utils-java:3.3.0' + implementation 'com.github.torusresearch:fetch-node-details-java:4.1.1' implementation 'com.google.code.gson:gson:2.9.1' implementation 'org.slf4j:slf4j-simple:2.0.3' //session-manager-sdk - implementation 'com.github.Web3Auth:session-manager-android:0.0.8' + implementation 'com.github.Web3Auth:session-manager-android:1.3.0' testImplementation 'junit:junit:4.13.2' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' diff --git a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt index 4ef50de..af3487e 100644 --- a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt +++ b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt @@ -16,7 +16,6 @@ import org.json.JSONObject import org.torusresearch.fetchnodedetails.FetchNodeDetails import org.torusresearch.fetchnodedetails.types.NodeDetails import org.torusresearch.torusutils.TorusUtils -import org.torusresearch.torusutils.helpers.Utils import org.torusresearch.torusutils.types.RetrieveSharesResponse import org.torusresearch.torusutils.types.TorusCtorOptions import org.torusresearch.torusutils.types.TorusPublicKey @@ -33,17 +32,7 @@ class SingleFactorAuth(singleFactorAuthArgs: SingleFactorAuthArgs) { private val gson = GsonBuilder().disableHtmlEscaping().create() init { - nodeDetailManager = if (Utils.isEmpty(singleFactorAuthArgs.networkUrl)) { - FetchNodeDetails( - singleFactorAuthArgs.getNetwork(), - SingleFactorAuthArgs.CONTRACT_MAP[singleFactorAuthArgs.getNetwork()] - ) - } else { - FetchNodeDetails( - singleFactorAuthArgs.networkUrl, - SingleFactorAuthArgs.CONTRACT_MAP[singleFactorAuthArgs.getNetwork()] - ) - } + nodeDetailManager = FetchNodeDetails(singleFactorAuthArgs.getNetwork()) val opts = TorusCtorOptions("single-factor-auth-android", singleFactorAuthArgs.clientid) opts.isEnableOneKey = true opts.network = singleFactorAuthArgs.getNetwork().toString() @@ -101,7 +90,7 @@ class SingleFactorAuth(singleFactorAuthArgs: SingleFactorAuthArgs) { json.put("privateKey", retrieveSharesResponse.privKey.toString()) json.put("publicAddress", retrieveSharesResponse.ethAddress) sessionManager.createSession( - json.toString(), sessionTime + json.toString(), sessionTime, true ) } diff --git a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/types/SingleFactorAuthArgs.kt b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/types/SingleFactorAuthArgs.kt index 381ea4f..48dd006 100644 --- a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/types/SingleFactorAuthArgs.kt +++ b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/types/SingleFactorAuthArgs.kt @@ -1,6 +1,5 @@ package com.web3auth.singlefactorauth.types -import org.torusresearch.fetchnodedetails.FetchNodeDetails import org.torusresearch.fetchnodedetails.types.TorusNetwork class SingleFactorAuthArgs(network: TorusNetwork, clientid: String) { @@ -22,15 +21,6 @@ class SingleFactorAuthArgs(network: TorusNetwork, clientid: String) { } companion object { - var CONTRACT_MAP: HashMap = - object : HashMap() { - init { - put(TorusNetwork.MAINNET, FetchNodeDetails.PROXY_ADDRESS_MAINNET) - put(TorusNetwork.TESTNET, FetchNodeDetails.PROXY_ADDRESS_TESTNET) - put(TorusNetwork.CYAN, FetchNodeDetails.PROXY_ADDRESS_CYAN) - put(TorusNetwork.AQUA, FetchNodeDetails.PROXY_ADDRESS_AQUA) - } - } var SIGNER_MAP: HashMap = object : HashMap() { init { put(TorusNetwork.MAINNET, "https://signer.tor.us") From c683077ccf0ccf02827bce4081f894e329ea2270 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Mon, 8 Jul 2024 18:10:51 +0530 Subject: [PATCH 2/2] refactor: update deps Signed-off-by: Gaurav Goel --- singlefactorauth/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/singlefactorauth/build.gradle b/singlefactorauth/build.gradle index 59517d4..445419b 100644 --- a/singlefactorauth/build.gradle +++ b/singlefactorauth/build.gradle @@ -37,8 +37,8 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'org.web3j:crypto:4.9.5' - implementation 'com.github.torusresearch:torus-utils-java:3.3.0' - implementation 'com.github.torusresearch:fetch-node-details-java:4.1.1' + implementation 'org.torusresearch:torus-utils-java:3.3.0' + implementation 'org.torusresearch:fetch-node-details-java:4.1.1' implementation 'com.google.code.gson:gson:2.9.1' implementation 'org.slf4j:slf4j-simple:2.0.3' //session-manager-sdk