@@ -10,6 +10,7 @@ import Tabs from "@theme/Tabs";
1010import AndroidResponse from " @site/src/common/sdk/pnp/_userinfo_response.mdx" ;
1111import LogOut from " @site/src/common/sdk/pnp/android/_logout.mdx" ;
1212import SMSPasswordless from " @site/src/common/sdk/pnp/android/_sms_passwordless.mdx" ;
13+ import EnableMFAMethod from " @site/src/common/sdk/pnp/android/_enable-mfa.mdx" ;
1314
1415Web3Auth's Android SDK is a set of libraries and tools that allow you to easily integrate Web3 with
1516Android applications.
@@ -539,99 +540,7 @@ class MainActivity : AppCompatActivity() {
539540
540541## Enable MFA for a user
541542
542- The ` enableMFA ` method is used to trigger MFA setup flow for users. The method takes ` LoginParams `
543- which will used during custom verifiers. If you are using default login providers, you don't need to
544- pass ` LoginParams ` . If you are using custom jwt verifiers, you need to pass the JWT token in
545- ` loginParams ` as well.
546-
547- <Tabs
548- defaultValue = " default-verifier"
549- values = { [
550- { label: " Default Verifier" , value: " default-verifier" },
551- { label: " Custom JWT Verifier" , value: " custom-jwt-verifier" },
552- ]}
553- >
554-
555- <TabItem value = " default-verifier" >
556-
557- ``` kotlin title="Usage"
558- import android.widget.Button
559- import com.web3auth.core.Web3Auth
560- import android.os.Bundle
561-
562- class MainActivity : AppCompatActivity () {
563- private lateinit var web3Auth: Web3Auth
564-
565- private fun enableMFA () {
566- // highlight-next-line
567- val completableFuture = web3Auth.enableMFA()
568-
569- completableFuture.whenComplete{_, error ->
570- if (error == null ) {
571- Log .d(" MainActivity_Web3Auth" , " Launched successfully" )
572- // Add your logic
573- } else {
574- // Add your logic on error
575- Log .d(" MainActivity_Web3Auth" , error.message ? : " Something went wrong" )
576- }
577- }
578- }
579-
580- override fun onCreate (savedInstanceState : Bundle ? ) {
581- .. .
582- // Setup UI and event handlers
583- val enableMFAButton = findViewById<Button >(R .id.enableMFAButton)
584- enableMFAButton.setOnClickListener { enableMFA() }
585- .. .
586- }
587- .. .
588- }
589- ```
590-
591- </TabItem >
592-
593- <TabItem value = " custom-jwt-verifier" >
594- ``` kotlin title="Usage"
595- import android.widget.Button
596- import com.web3auth.core.Web3Auth
597- import android.os.Bundle
598-
599- class MainActivity : AppCompatActivity () { private lateinit var web3Auth: Web3Auth
600-
601- private fun enableMFA () {
602- val loginParams = LoginParams (
603- Provider .JWT ,
604- extraLoginOptions = ExtraLoginOptions (id_token = " your_jwt_token" )
605- )
606-
607- // highlight-next-line
608- val completableFuture = web3Auth.enableMFA(loginParams)
609-
610- completableFuture.whenComplete{_, error ->
611- if (error == null ) {
612- Log .d(" MainActivity_Web3Auth" , " Launched successfully" )
613- // Add your logic
614- } else {
615- // Add your logic on error
616- Log .d(" MainActivity_Web3Auth" , error.message ? : " Something went wrong" )
617- }
618- }
619- }
620-
621- override fun onCreate (savedInstanceState : Bundle ? ) {
622- .. .
623- // Setup UI and event handlers
624- val enableMFAButton = findViewById<Button >(R .id.enableMFAButton)
625- enableMFAButton.setOnClickListener { enableMFA() }
626- .. .
627- }
628- .. .
629-
630- }
631-
632- ````
633- < / TabItem >
634- < / Tabs >
543+ <EnableMFAMethod />
635544
636545## Launch Wallet Services
637546
@@ -689,7 +598,7 @@ data class ChainConfig(
689598 val ticker : String? ,
690599 val tickerName : String? = null ,
691600)
692- ````
601+ ```
693602
694603</TabItem >
695604</Tabs >
0 commit comments