Skip to content

Commit

Permalink
feat: remove allowedOrigin from constructors and update all tests
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Goel <[email protected]>
  • Loading branch information
grvgoel81 authored and Gaurav Goel committed Sep 17, 2024
1 parent ca2b2c6 commit 819da74
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/web3auth/sfaexample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class SingleFactorAuth(
sfaParams: SFAParams,
ctx: Context,
sessionTime: Long = 86400,
allowedOrigin: String = "*"
) {
private var nodeDetailManager: FetchNodeDetails =
FetchNodeDetails(sfaParams.getNetwork())
Expand All @@ -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 {
Expand Down

0 comments on commit 819da74

Please sign in to comment.