Skip to content

Commit

Permalink
Merge pull request #70 from Web3Auth/bugfix/mfasettings
Browse files Browse the repository at this point in the history
fix: add mfaSettings in initOptions
  • Loading branch information
chaitanyapotti authored Nov 2, 2023
2 parents e41cd2b + 04f0cf2 commit 2312438
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions app/src/main/java/com/web3auth/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
extraLoginOptions = ExtraLoginOptions(login_hint = hintEmail)
}
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(
LoginParams(selectedLoginProvider, extraLoginOptions = extraLoginOptions)
LoginParams(
selectedLoginProvider,
extraLoginOptions = extraLoginOptions,
mfaLevel = MFALevel.OPTIONAL
)
)
loginCompletableFuture.whenComplete { _, error ->
if (error == null) {
Expand Down Expand Up @@ -130,7 +134,8 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
"loginConfig" to LoginConfigItem(
"torus",
typeOfLogin = TypeOfLogin.GOOGLE,
name = ""
name = "",
clientId = ""
)
)
)
Expand Down
9 changes: 8 additions & 1 deletion core/src/main/java/com/web3auth/core/Web3Auth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions) {
gson.toJson(web3AuthOption.loginConfig)
if (web3AuthOption.buildEnv != null) initOptions["buildEnv"] =
web3AuthOption.buildEnv.toString().lowercase()
if (web3AuthOption.mfaSettings != null) initOptions["mfaSettings"] =
gson.toJson(web3AuthOption.mfaSettings)
if (params?.sessionTime != null) initOptions["sessionTime"] =
params.sessionTime.toString()

val initParams = mutableMapOf(
"loginProvider" to params?.loginProvider,
"extraLoginOptions" to params?.extraLoginOptions,
"redirectUrl" to if (params?.redirectUrl != null) params.redirectUrl.toString() else initOptions["redirectUrl"].toString()
"redirectUrl" to if (params?.redirectUrl != null) params.redirectUrl.toString() else initOptions["redirectUrl"].toString(),
"mfaLevel" to params?.mfaLevel,
"curve" to params?.curve,
"dappShare" to params?.dappShare
)

val paramMap = mapOf(
Expand Down

0 comments on commit 2312438

Please sign in to comment.