From 819da740dce7ea369143ce38cf32efdc7c406411 Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Tue, 17 Sep 2024 09:40:39 +0530 Subject: [PATCH] feat: remove allowedOrigin from constructors and update all tests Signed-off-by: Gaurav Goel --- app/src/main/java/com/web3auth/sfaexample/MainActivity.kt | 2 +- .../java/com/web3auth/singlefactorauth/AquaTest.kt | 4 ++-- .../java/com/web3auth/singlefactorauth/CyanTest.kt | 4 ++-- .../java/com/web3auth/singlefactorauth/SapphireDevnetTest.kt | 4 ++-- .../java/com/web3auth/singlefactorauth/SapphireMainnetTest.kt | 4 ++-- .../com/web3auth/singlefactorauth/SingleFactorAuthTest.kt | 4 ++-- .../java/com/web3auth/singlefactorauth/SingleFactorAuth.kt | 3 +-- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/web3auth/sfaexample/MainActivity.kt b/app/src/main/java/com/web3auth/sfaexample/MainActivity.kt index 3e7a1eb..072e82c 100644 --- a/app/src/main/java/com/web3auth/sfaexample/MainActivity.kt +++ b/app/src/main/java/com/web3auth/sfaexample/MainActivity.kt @@ -32,7 +32,7 @@ class MainActivity : AppCompatActivity() { val idToken = JwtUtils.generateIdToken(TORUS_TEST_EMAIL) sfaParams = SFAParams(Web3AuthNetwork.SAPPHIRE_MAINNET, "YOUR_CLIENT_ID", null, 0) - singleFactorAuth = SingleFactorAuth(sfaParams, this, 86400, this.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, this, 86400) loginParams = LoginParams(TEST_VERIFIER, TORUS_TEST_EMAIL, idToken) if (singleFactorAuth.isSessionIdExists()) { diff --git a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/AquaTest.kt b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/AquaTest.kt index c8cc705..5a1646d 100644 --- a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/AquaTest.kt +++ b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/AquaTest.kt @@ -37,7 +37,7 @@ class AquaTest { val context = getInstrumentation().context sfaParams = SFAParams(Web3AuthNetwork.AQUA, "YOUR_CLIENT_ID", null, 0) - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" @@ -68,7 +68,7 @@ class AquaTest { fun shouldAggregrateGetTorusKey() { sfaParams = SFAParams(Web3AuthNetwork.AQUA, "YOUR_CLIENT_ID") val context = getInstrumentation().context - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" diff --git a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/CyanTest.kt b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/CyanTest.kt index ba5de29..58ee796 100644 --- a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/CyanTest.kt +++ b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/CyanTest.kt @@ -33,7 +33,7 @@ class CyanTest { fun shouldGetTorusKey() { val context = InstrumentationRegistry.getInstrumentation().context sfaParams = SFAParams(Web3AuthNetwork.CYAN, "YOUR_CLIENT_ID", null, 0) - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" @@ -63,7 +63,7 @@ class CyanTest { fun shouldAggregrateGetTorusKey() { val context = InstrumentationRegistry.getInstrumentation().context sfaParams = SFAParams(Web3AuthNetwork.CYAN, "YOUR_CLIENT_ID") - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" diff --git a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireDevnetTest.kt b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireDevnetTest.kt index e868497..5d3846f 100644 --- a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireDevnetTest.kt +++ b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireDevnetTest.kt @@ -36,7 +36,7 @@ class SapphireDevnetTest { Web3AuthNetwork.SAPPHIRE_DEVNET, "CLIENT ID", null, 0 ) - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" @@ -69,7 +69,7 @@ class SapphireDevnetTest { Web3AuthNetwork.SAPPHIRE_DEVNET, "CLIENT_ID" ) - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" diff --git a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireMainnetTest.kt b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireMainnetTest.kt index 3b0426d..3ca16be 100644 --- a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireMainnetTest.kt +++ b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SapphireMainnetTest.kt @@ -37,7 +37,7 @@ class SapphireMainnetTest { "CLIENT ID", null, 0 ) - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" @@ -70,7 +70,7 @@ class SapphireMainnetTest { Web3AuthNetwork.SAPPHIRE_MAINNET, "CLIENT_ID" ) - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" diff --git a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SingleFactorAuthTest.kt b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SingleFactorAuthTest.kt index 3cb193e..6609857 100644 --- a/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SingleFactorAuthTest.kt +++ b/singlefactorauth/src/androidTest/java/com/web3auth/singlefactorauth/SingleFactorAuthTest.kt @@ -33,7 +33,7 @@ class SingleFactorAuthTest { fun shouldGetTorusKey() { val context = InstrumentationRegistry.getInstrumentation().context sfaParams = SFAParams(Web3AuthNetwork.MAINNET, "CLIENT_ID", null, 0) - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" @@ -63,7 +63,7 @@ class SingleFactorAuthTest { fun shouldAggregrateGetTorusKey() { val context = InstrumentationRegistry.getInstrumentation().context sfaParams = SFAParams(Web3AuthNetwork.MAINNET, "YOUR_CLIENT_ID") - singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400, context.packageName) + singleFactorAuth = SingleFactorAuth(sfaParams, context, 86400) val privateKey = readPrivateKeyFromReader( WellKnownSecret.pem(), "EC" diff --git a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt index 20683c1..3fd830d 100644 --- a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt +++ b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt @@ -25,7 +25,6 @@ class SingleFactorAuth( sfaParams: SFAParams, ctx: Context, sessionTime: Long = 86400, - allowedOrigin: String = "*" ) { private var nodeDetailManager: FetchNodeDetails = FetchNodeDetails(sfaParams.getNetwork()) @@ -41,7 +40,7 @@ class SingleFactorAuth( ) network = sfaParams.getNetwork() torusUtils = TorusUtils(torusOptions) - sessionManager = SessionManager(ctx, sessionTime, allowedOrigin) + sessionManager = SessionManager(ctx, sessionTime, ctx.packageName) } fun initialize(ctx: Context): SFAKey {