Skip to content

Commit 2e39df3

Browse files
resolve review comments
1 parent b676625 commit 2e39df3

14 files changed

Lines changed: 408 additions & 28 deletions

docs/sdk/pnp/android/custom-authentication.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ description: "Web3Auth PnP Android SDK - Using Custom Authentication | Documenta
88
import TabItem from "@theme/TabItem";
99
import Tabs from "@theme/Tabs";
1010
import GrowthPlanNote from "@site/src/common/docs/_growth_plan_note.mdx";
11+
import SMSPasswordless from "@site/src/common/sdk/pnp/android/_sms_passwordless.mdx";
1112

1213
To use custom authentication (Using Social providers or Login providers like Auth0, AWS Cognito,
1314
Firebase etc. or even your own custom JWT login) you can add the configuration to the `loginConfig`
@@ -395,3 +396,11 @@ val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login
395396
)
396397
)
397398
```
399+
400+
### SMS Passwordless
401+
402+
To use the SMS Passwordless login, send the phone number as the `login_hint` parameter of the
403+
`ExtraLoginOptions`. Please make sure the phone number is in the format of
404+
+\{country_code}-\{phone_number}, i.e. (+91-09xx901xx1).
405+
406+
<SMSPasswordless />

docs/sdk/pnp/android/usage.mdx

Lines changed: 112 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import TabItem from "@theme/TabItem";
99
import Tabs from "@theme/Tabs";
1010
import AndroidResponse from "@site/src/common/sdk/pnp/_userinfo_response.mdx";
1111
import LogOut from "@site/src/common/sdk/pnp/android/_logout.mdx";
12+
import SMSPasswordless from "@site/src/common/sdk/pnp/android/_sms_passwordless.mdx";
1213

1314
Web3Auth's Android SDK is a set of libraries and tools that allow you to easily integrate Web3 with
1415
Android applications.
@@ -38,7 +39,7 @@ as GOOGLE, APPLE, FACEBOOK, etc., and do whitelabel login. The `login` function
3839

3940
| Parameter | Description |
4041
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41-
| `loginProvider` | It sets the OAuth login method to be used. You can use any of the supported values are `GOOGLE`, `FACEBOOK`, `REDDIT`, `DISCORD`, `TWITCH`, `APPLE`, `LINE`, `GITHUB`, `KAKAO`, `LINKEDIN`, `TWITTER`, `WEIBO`, `WECHAT`, `EMAIL_PASSWORDLESS`. |
42+
| `loginProvider` | It sets the OAuth login method to be used. You can use any of the supported values are `GOOGLE`, `FACEBOOK`, `REDDIT`, `DISCORD`, `TWITCH`, `APPLE`, `LINE`, `GITHUB`, `KAKAO`, `LINKEDIN`, `TWITTER`, `WEIBO`, `WECHAT`, `EMAIL_PASSWORDLESS`, `JWT`, `SMS_PASSWORDLESS`, and `FARCASTER`. |
4243
| `extraLoginOptions?` | It can be used to set the OAuth login options for corresponding `loginProvider`. For instance, you'll need to pass user's email address as. Default value for the field is `null`, and it accepts `ExtraLoginOptions` as a value. |
4344
| `redirectUrl?` | Url where user will be redirected after successfull login. By default user will be redirected to same page where login will be initiated. Default value for the field is `null`, and accepts `Uri` as a value. |
4445
| `appState?` | It can be used to keep track of the app state when user will be redirected to app after login. Default is `null`, and accepts `String` as a value. |
@@ -60,6 +61,43 @@ data class LoginParams(
6061
val mfaLevel: MFALevel? = null,
6162
val curve: Curve? = Curve.SECP256K1
6263
)
64+
65+
enum class Provider {
66+
@SerializedName("google")
67+
GOOGLE,
68+
@SerializedName("facebook")
69+
FACEBOOK,
70+
@SerializedName("reddit")
71+
REDDIT,
72+
@SerializedName("discord")
73+
DISCORD,
74+
@SerializedName("twitch")
75+
TWITCH,
76+
@SerializedName("apple")
77+
APPLE,
78+
@SerializedName("line")
79+
LINE,
80+
@SerializedName("github")
81+
GITHUB,
82+
@SerializedName("kakao")
83+
KAKAO,
84+
@SerializedName("linkedin")
85+
LINKEDIN,
86+
@SerializedName("twitter")
87+
TWITTER,
88+
@SerializedName("weibo")
89+
WEIBO,
90+
@SerializedName("wechat")
91+
WECHAT,
92+
@SerializedName("email_passwordless")
93+
EMAIL_PASSWORDLESS,
94+
@SerializedName("jwt")
95+
JWT,
96+
@SerializedName("sms_passwordless")
97+
SMS_PASSWORDLESS,
98+
@SerializedName("farcaster")
99+
FARCASTER
100+
}
63101
```
64102

65103
</TabItem>
@@ -92,6 +130,8 @@ Use getUserInfo() to get the user info of the user.
92130
{ label: "Discord", value: "discord" },
93131
{ label: "Twitch", value: "twitch" },
94132
{ label: "Email Passwordless", value: "email_passwordless" },
133+
{ label: "SMS Passwordless", value: "sms_passwordles" },
134+
{ label: "Farcaster", value: "farcaster" },
95135
{ label: "JWT", value: "jwt" },
96136
]}
97137
>
@@ -317,6 +357,21 @@ class MainActivity : AppCompatActivity() {
317357

318358
</TabItem>
319359

360+
<TabItem value="sms_passwordless">
361+
<SMSPasswordless />
362+
</TabItem>
363+
364+
<TabItem value="farcaster">
365+
```kotlin title="Usage"
366+
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(
367+
LoginParams(
368+
// highlight-next-line
369+
Provider.farcaster,
370+
)
371+
)
372+
```
373+
</TabItem>
374+
320375
<TabItem value="jwt">
321376

322377
```kotlin title="Usage"
@@ -489,6 +544,16 @@ which will used during custom verifiers. If you are using default login provider
489544
pass `LoginParams`. If you are using custom jwt verifiers, you need to pass the JWT token in
490545
`loginParams` as well.
491546

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+
492557
```kotlin title="Usage"
493558
import android.widget.Button
494559
import com.web3auth.core.Web3Auth
@@ -523,6 +588,51 @@ class MainActivity : AppCompatActivity() {
523588
}
524589
```
525590

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>
635+
526636
## Launch Wallet Services
527637

528638
The `launchWalletServices` method launches a WebView which allows you to use the templated wallet UI
@@ -579,7 +689,7 @@ data class ChainConfig(
579689
val ticker: String?,
580690
val tickerName: String? = null,
581691
)
582-
```
692+
````
583693
584694
</TabItem>
585695
</Tabs>

docs/sdk/pnp/flutter/custom-authentication.mdx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ description: "Web3Auth PnP Flutter SDK - Using Custom Authentication | Documenta
88
import TabItem from "@theme/TabItem";
99
import Tabs from "@theme/Tabs";
1010
import GrowthPlanNote from "@site/src/common/docs/_growth_plan_note.mdx";
11+
import SMSPasswordless from "@site/src/common/sdk/pnp/flutter/_sms_passwordless.mdx";
1112

1213
To use custom authentication (Using Social providers or Login providers like Auth0, AWS Cognito,
1314
Firebase etc. or even your own custom JWT login) you can add the configuration to the `loginConfig`
@@ -148,7 +149,9 @@ enum TypeOfLogin {
148149
line,
149150
email_passwordless,
150151
email_password,
151-
jwt
152+
jwt,
153+
sms_passwordless,
154+
farcaster,
152155
}
153156
```
154157

@@ -541,7 +544,7 @@ final Web3AuthResponse response = await Web3AuthFlutter.login(
541544

542545
### Email Passwordless
543546

544-
To use the `EMAIL_PASSWORDLESS` login, you need to put the email into the `login_hint` parameter of
547+
To use the Email Passwordless login, you need to put the email into the `login_hint` parameter of
545548
the `ExtraLoginOptions`. By default, the login flow will be `code` flow, if you want to use the
546549
`link` flow, you need to put `flow_type` into the `additionalParams` parameter of the
547550
`ExtraLoginOptions`.
@@ -568,7 +571,7 @@ Future<void> initWeb3Auth() async {
568571
await Web3AuthFlutter.init(
569572
Web3AuthOptions(
570573
clientId: "WEB3AUTH_CLIENT_ID",
571-
network: Network.testnet,
574+
network: Network.sapphire_mainnet,
572575
redirectUrl: redirectUrl,
573576
),
574577
);
@@ -586,3 +589,11 @@ final Web3AuthResponse response = await Web3AuthFlutter.login(
586589
),
587590
);
588591
```
592+
593+
### SMS Passwordless
594+
595+
To use the SMS Passwordless login, send the phone number as the `login_hint` parameter of the
596+
`ExtraLoginOptions`. Please make sure the phone number is in the format of
597+
+\{country_code}-\{phone_number}, i.e. (+91-09xx901xx1).
598+
599+
<SMSPasswordless />

docs/sdk/pnp/flutter/install.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import IOSWhitelist from "@site/src/common/sdk/pnp/ios/ios-whitelist.mdx";
2424

2525
## Android
2626

27-
Once we have install Web3Auth Flutter SDK, we also need add the configuration for Android.
27+
Once we have installed Web3Auth Flutter SDK, we also need to add the configuration for Android.
2828

2929
### Update compileSdkVersion
3030

@@ -40,8 +40,8 @@ Once we have install Web3Auth Flutter SDK, we also need add the configuration fo
4040

4141
### Configuration
4242

43-
Once the gradles and permission has been updated, we need to configure Web3Auth project by
44-
whitelisting you scheme and package name.
43+
Once the gradles and permission has been updated, you need to configure Web3Auth project by
44+
whitelisting your scheme and package name.
4545

4646
#### Configure Web3Auth project
4747

0 commit comments

Comments
 (0)