Skip to content

Commit 2604e59

Browse files
authored
Merge branch 'master' into add-guide-multiple-chains
2 parents 7f66bd6 + 5c814dc commit 2604e59

40 files changed

Lines changed: 577 additions & 499 deletions

docs/sdk/core-kit/sfa-react-native/initialize.mdx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
title: "Initializing Core Kit SFA React Native SDK"
33
sidebar_label: "Initialize"
44
displayed_sidebar: sdk
5-
description: "Web3Auth Core Kit Single Factor Auth React Native SDK - Initialize | Documentation - Web3Auth"
5+
description:
6+
"Web3Auth Core Kit Single Factor Auth React Native SDK - Initialize | Documentation - Web3Auth"
67
---
78

89
import ChainConfig from "@site/src/common/sdk/pnp/web/_chain-config.mdx";
@@ -11,7 +12,8 @@ import InstantiatingProvider from "@site/src/common/sdk/core-kit/sfa/_instantiat
1112
import TabItem from "@theme/TabItem";
1213
import Tabs from "@theme/Tabs";
1314

14-
After Installation, the next step to use Web3Auth Single Factor Auth Web SDK is to Initialize the SDK.
15+
After Installation, the next step to use Web3Auth Single Factor Auth Web SDK is to Initialize the
16+
SDK.
1517

1618
However, the Initialization is a two-step process, ie.
1719

@@ -23,7 +25,7 @@ However, the Initialization is a two-step process, ie.
2325
#### Import the `Web3Auth` class from `@web3auth/single-factor-auth-react-native` package.
2426

2527
```js
26-
import { Web3Auth } from "@web3auth/single-factor-auth-react-native";
28+
import Web3Auth from "@web3auth/single-factor-auth-react-native";
2729
```
2830

2931
#### Assign the `Web3Auth` class to a variable
@@ -40,25 +42,27 @@ import { Web3Auth } from "@web3auth/single-factor-auth-react-native";
4042

4143
```javascript
4244
import * as SecureStore from "expo-secure-store";
43-
import { Web3Auth } from "@web3auth/single-factor-auth-react-native";
45+
import Web3Auth from "@web3auth/single-factor-auth-react-native";
4446

4547
const web3auth = new Web3Auth(SecureStore, SdkInitOptions);
4648
```
4749

48-
The react native SFA Web3Auth constructor takes `SecureStore` and an object with `SdkInitOptions` as parameters for the expo-managed workflow.
50+
The react native SFA Web3Auth constructor takes `SecureStore` and an object with `SdkInitOptions` as
51+
parameters for the expo-managed workflow.
4952

5053
</TabItem>
5154

5255
<TabItem value="bare">
5356

5457
```javascript
5558
import EncryptedStorage from "react-native-encrypted-storage";
56-
import { Web3Auth } from "@web3auth/single-factor-auth-react-native";
59+
import Web3Auth from "@web3auth/single-factor-auth-react-native";
5760

5861
const web3auth = new Web3Auth(EncryptedStorage, SdkInitOptions);
5962
```
6063

61-
The react native SFA Web3Auth constructor takes `EncryptedStorage` and an object with `SdkInitOptions` as parameters for the bare workflow.
64+
The react native SFA Web3Auth constructor takes `EncryptedStorage` and an object with
65+
`SdkInitOptions` as parameters for the bare workflow.
6266

6367
</TabItem>
6468
</Tabs>
@@ -144,7 +148,7 @@ export interface SdkInitOptions {
144148
```ts
145149
const web3auth = new Web3Auth(SecureStore, {
146150
clientId: "WEB3AUTH_CLIENT_ID", // Get your Client ID from the Web3Auth Dashboard
147-
web3AuthNetwork: "sapphire_mainnet",
151+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
148152
usePnPKey: false, // By default, this sdk returns CoreKitKey
149153
});
150154
```
@@ -156,7 +160,7 @@ const web3auth = new Web3Auth(SecureStore, {
156160
```ts
157161
const web3auth = new Web3Auth(EncryptedStorage, {
158162
clientId: "WEB3AUTH_CLIENT_ID", // Get your Client ID from the Web3Auth Dashboard
159-
web3AuthNetwork: "sapphire_mainnet",
163+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
160164
usePnPKey: false, // By default, this sdk returns CoreKitKey
161165
});
162166
```
@@ -172,8 +176,9 @@ const web3auth = new Web3Auth(EncryptedStorage, {
172176

173177
#### `init()`
174178

175-
To complete the initialization process, we need to initialize the `Web3Auth` instance, which we named `web3auth`. This is achieved by calling the
176-
`init()` function of the previously created `web3auth` instance, using a **private key provider**.
179+
To complete the initialization process, we need to initialize the `Web3Auth` instance, which we
180+
named `web3auth`. This is achieved by calling the `init()` function of the previously created
181+
`web3auth` instance, using a **private key provider**.
177182

178183
```ts
179184
await web3auth.init(privateKeyProvider);
@@ -193,9 +198,9 @@ await web3auth.init(privateKeyProvider);
193198

194199
```ts
195200
import * as SecureStore from "expo-secure-store";
196-
import { Web3Auth } from "@web3auth/single-factor-auth-react-native";
201+
import Web3Auth from "@web3auth/single-factor-auth-react-native";
197202
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
198-
import { CHAIN_NAMESPACES } from "@web3auth/base";
203+
import { CHAIN_NAMESPACES, WEB3AUTH_NETWORK } from "@web3auth/base";
199204

200205
// Swap with a different provider if you want to use a different blockchain
201206
const privateKeyProvider = new EthereumPrivateKeyProvider({
@@ -214,7 +219,7 @@ const privateKeyProvider = new EthereumPrivateKeyProvider({
214219

215220
const web3auth = new Web3Auth(SecureStore, {
216221
clientId: "WEB3AUTH_CLIENT_ID", // Get your Client ID from the Web3Auth Dashboard
217-
web3AuthNetwork: "sapphire_mainnet",
222+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
218223
usePnPKey: false, // By default, this sdk returns CoreKitKey
219224
});
220225

@@ -227,9 +232,9 @@ await web3auth.init(privateKeyProvider);
227232

228233
```ts
229234
import EncryptedStorage from "react-native-encrypted-storage";
230-
import { Web3Auth } from "@web3auth/single-factor-auth-react-native";
235+
import Web3Auth from "@web3auth/single-factor-auth-react-native";
231236
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
232-
import { CHAIN_NAMESPACES } from "@web3auth/base";
237+
import { CHAIN_NAMESPACES, WEB3AUTH_NETWORK } from "@web3auth/base";
233238

234239
// Swap with a different provider if you want to use a different blockchain
235240
const privateKeyProvider = new EthereumPrivateKeyProvider({
@@ -248,7 +253,7 @@ const privateKeyProvider = new EthereumPrivateKeyProvider({
248253

249254
const web3auth = new Web3Auth(EncryptedStorage, {
250255
clientId: "WEB3AUTH_CLIENT_ID", // Get your Client ID from the Web3Auth Dashboard
251-
web3AuthNetwork: "sapphire_mainnet",
256+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
252257
usePnPKey: false, // By default, this sdk returns CoreKitKey
253258
});
254259

docs/sdk/core-kit/sfa-react-native/install.mdx

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
title: "Installing Core Kit SFA React Native SDK"
33
sidebar_label: "Install"
44
displayed_sidebar: sdk
5-
description: "Web3Auth Core Kit Single Factor Auth React Native SDK - Install | Documentation - Web3Auth"
5+
description:
6+
"Web3Auth Core Kit Single Factor Auth React Native SDK - Install | Documentation - Web3Auth"
67
---
78

89
import TabItem from "@theme/TabItem";
@@ -15,22 +16,25 @@ In React Native, you have the choice to use one of the following workflows:
1516

1617
### Expo Managed Workflow
1718

18-
Your Expo app is built on your Expo's cloud, so you don't have control over the native modules used in the app. Developers build managed workflow apps
19-
using `expo-cli` on their computers and a development client on their mobile devices. Managed workflow apps typically use one or more Expo services,
20-
such as push notifications, builds, and updates.
19+
Your Expo app is built on your Expo's cloud, so you don't have control over the native modules used
20+
in the app. Developers build managed workflow apps using `expo-cli` on their computers and a
21+
development client on their mobile devices. Managed workflow apps typically use one or more Expo
22+
services, such as push notifications, builds, and updates.
2123

2224
<ExpoWarning />
2325

2426
### Bare React Native Workflow
2527

26-
Your Bare React Native app is entirely built on your machine. In this workflow, the developer has complete control, along with the complexity that
27-
comes with that. Configuration with `app.json` / `app.config.js` is mostly not supported in this context; instead, you will need to configure each
28-
native project directly with Swift/Kotlin native modules. Check out the [troubleshooting section](/sdk/pnp/react-native/install#troubleshooting) for
29-
fixing common issues.
28+
Your Bare React Native app is entirely built on your machine. In this workflow, the developer has
29+
complete control, along with the complexity that comes with that. Configuration with `app.json` /
30+
`app.config.js` is mostly not supported in this context; instead, you will need to configure each
31+
native project directly with Swift/Kotlin native modules. Check out the
32+
[troubleshooting section](/sdk/pnp/react-native/install#troubleshooting) for fixing common issues.
3033

3134
:::tip
3235

33-
You can read more about different workflows in the [Expo documentation](https://docs.expo.dev/archive/managed-vs-bare/).
36+
You can read more about different workflows in the
37+
[Expo documentation](https://docs.expo.dev/archive/managed-vs-bare/).
3438

3539
:::
3640

@@ -44,8 +48,8 @@ npm install --save @web3auth/single-factor-auth-react-native
4448

4549
### Adding a `Storage` Module
4650

47-
Now with v4, we need to pass a `Storage` parameter to the SDK, which will be used for session management without storing the private keys of the user
48-
in the device.
51+
Now with v4, we need to pass a `Storage` parameter to the SDK, which will be used for session
52+
management without storing the private keys of the user in the device.
4953

5054
<Tabs
5155
defaultValue="bare"
@@ -59,11 +63,11 @@ in the device.
5963

6064
#### Expo Secure Store
6165

62-
When using our SDK with an Expo-based React Native app (aka managed workflow), you have to install the `expo-secure-store` package as a `Storage`
63-
implementation.
66+
When using our SDK with an Expo-based React Native app (aka managed workflow), you have to install
67+
the `expo-secure-store` package as a `Storage` implementation.
6468

6569
```shell
66-
expo install expo-secure-store
70+
npx expo install expo-secure-store
6771
```
6872

6973
</TabItem>
@@ -72,7 +76,8 @@ expo install expo-secure-store
7276

7377
#### React Native Encrypted Storage
7478

75-
When using our SDK with a bare workflow React Native app, you have to install a `Storage` implementation provided by react-native.
79+
When using our SDK with a bare workflow React Native app, you have to install a `Storage`
80+
implementation provided by react-native.
7681

7782
```bash npm2yarn
7883
npm install --save react-native-encrypted-storage
@@ -83,14 +88,15 @@ npm install --save react-native-encrypted-storage
8388

8489
## Configuration
8590

86-
After you have installed the files needed for your workflow, you'll have to configure the SDK with some additional steps to be able to use the SDK
87-
properly.
91+
After you have installed the files needed for your workflow, you'll have to configure the SDK with
92+
some additional steps to be able to use the SDK properly.
8893

8994
### Expo Managed Workflow
9095

9196
- Adding URL scheme to `app.json`
9297

93-
To allow the Expo-based SDK to work with exported Expo Android apps, you need to add the designated scheme into `app.json`
98+
To allow the Expo-based SDK to work with exported Expo Android apps, you need to add the designated
99+
scheme into `app.json`
94100

95101
```json title="app.json"
96102
{
@@ -102,13 +108,16 @@ To allow the Expo-based SDK to work with exported Expo Android apps, you need to
102108

103109
:::tip
104110

105-
You may refer to [these example apps](/examples?product=Core+Kit&sdk=Single+Factor+Auth+React+Native+SDK) and try it out yourself.
111+
You may refer to
112+
[these example apps](/examples?product=Core+Kit&sdk=Single+Factor+Auth+React+Native+SDK) and try it
113+
out yourself.
106114

107115
:::
108116

109117
### Bare React Native Workflow
110118

111-
For the bare workflow, you need to perform additional installation steps, alongside specific configurations for Android and iOS separately.
119+
For the bare workflow, you need to perform additional installation steps, alongside specific
120+
configurations for Android and iOS separately.
112121

113122
#### Android
114123

@@ -136,7 +145,8 @@ targetSdkVersion = 31
136145
</intent-filter>
137146
```
138147

139-
- SDK version 31 requires you to explicitly define `android:exported="true"` in `AndroidManifest.xml`, check whether it is correctly present or not.
148+
- SDK version 31 requires you to explicitly define `android:exported="true"` in
149+
`AndroidManifest.xml`, check whether it is correctly present or not.
140150

141151
```xml title="android/app/src/main/AndroidManifest.xml"
142152
<activity
@@ -166,14 +176,18 @@ pod install
166176

167177
:::tip
168178

169-
You may refer to **[these example apps](/examples?product=Core+Kit&sdk=Single+Factor+Auth+React+Native+SDK)** and try it out yourself.
179+
You may refer to
180+
**[these example apps](/examples?product=Core+Kit&sdk=Single+Factor+Auth+React+Native+SDK)** and try
181+
it out yourself.
170182

171183
:::
172184

173185
## Troubleshooting
174186

175187
### Bundler Issues: Missing Dependencies
176188

177-
You might face issues mentioning that certain dependencies are missing within the React Native environment. These are node dependencies that need to
178-
be polyfilled in your application, to enable Web3Auth functionalities. Furthermore, your bundler needs to be reconfigured to use them while building
179-
the app. Please check out our **[React Native Troubleshooting Guide](/troubleshooting/metro-issues)**
189+
You might face issues mentioning that certain dependencies are missing within the React Native
190+
environment. These are node dependencies that need to be polyfilled in your application, to enable
191+
Web3Auth functionalities. Furthermore, your bundler needs to be reconfigured to use them while
192+
building the app. Please check out our
193+
**[React Native Troubleshooting Guide](/troubleshooting/metro-issues)**

docs/sdk/pnp/android/android.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ generated in a non-custodial way on successful user authentication. This authent
1313
achieved by using any social login options that Web3Auth supports or custom authentication flow of
1414
your choice.
1515

16-
#### This Documentation is based on the `7.1.1` SDK Version.
16+
#### This Documentation is based on the `7.3.0` SDK Version.
1717

1818
## Requirements
1919

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

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,36 @@ description: "Web3Auth PnP Android SDK - Using Custom Authentication | Documenta
77

88
import TabItem from "@theme/TabItem";
99
import Tabs from "@theme/Tabs";
10+
import GrowthPlanNote from "@site/src/common/docs/_growth_plan_note.mdx";
1011

11-
To use custom authentication (Using Social providers or Login providers like Auth0, AWS Cognito, Firebase etc. or even your own custom JWT login) you
12-
can add the configuration to the `loginConfig` parameter of the `Web3AuthOptions` object during the initialization.
12+
To use custom authentication (Using Social providers or Login providers like Auth0, AWS Cognito,
13+
Firebase etc. or even your own custom JWT login) you can add the configuration to the `loginConfig`
14+
parameter of the `Web3AuthOptions` object during the initialization.
1315

14-
The `loginConfig` parameter is a key value map. The key should be one of the `Web3AuthProvider` in its string form, and the value should be a
15-
`LoginConfigItem` instance.
16+
The `loginConfig` parameter is a key value map. The key should be one of the `Web3AuthProvider` in
17+
its string form, and the value should be a `LoginConfigItem` instance.
1618

1719
First, configure your own verifier in the Web3Auth Dashboard to use custom authentication.
1820

19-
:::note
20-
21-
This is a paid feature and the minimum [pricing plan](https://web3auth.io/pricing.html) to use this SDK in a production environment is the **Growth
22-
Plan**. You can use this feature in the development environment for free.
23-
24-
:::
21+
<GrowthPlanNote />
2522

2623
:::tip Create Custom Verifier
2724

28-
Check out how to create a **[Custom Verifier](/auth-provider-setup/verifiers)** on the Web3Auth Dashboard.
25+
Check out how to create a **[Custom Verifier](/auth-provider-setup/verifiers)** on the Web3Auth
26+
Dashboard.
2927

3028
:::
3129

3230
:::info using dapp share
3331

3432
- dApp Share is only returned for the Custom verifiers.
35-
- Also, 2FA should be enabled for the account using it. Use `mfaLevel = MFALevel.MANDATORY` in the `LoginParams` during login. See
36-
**[MFA](/sdk/pnp/android/mfa)** for more details.
33+
- Also, 2FA should be enabled for the account using it. Use `mfaLevel = MFALevel.MANDATORY` in the
34+
`LoginParams` during login. See **[MFA](/sdk/pnp/android/mfa)** for more details.
3735

3836
:::
3937

40-
Then, you should specify the details of your verifier in the `LoginConfigItem` struct, the details of this struct are as follows:
38+
Then, you should specify the details of your verifier in the `LoginConfigItem` struct, the details
39+
of this struct are as follows:
4140

4241
## `LoginConfigItem`
4342

@@ -241,8 +240,9 @@ web3Auth = Web3Auth (
241240

242241
## `ExtraLoginOptions` for special login methods
243242

244-
Additional to the `LoginConfig` you can pass extra options to the `login` function to configure the login flow for cases requiring additional info for
245-
enabling login. The `ExtraLoginOptions` accepts the following parameters:
243+
Additional to the `LoginConfig` you can pass extra options to the `login` function to configure the
244+
login flow for cases requiring additional info for enabling login. The `ExtraLoginOptions` accepts
245+
the following parameters:
246246

247247
<Tabs
248248
defaultValue="table"
@@ -314,8 +314,9 @@ data class ExtraLoginOptions(
314314

315315
### Using Auth0 Login
316316

317-
Auth0 has a special login flow, called the SPA flow. This flow requires a `client_id` and `domain` to be passed, and Web3Auth will get the JWT
318-
`id_token` from Auth0 directly. You can pass these configurations in the `ExtraLoginOptions` object in the login function.
317+
Auth0 has a special login flow, called the SPA flow. This flow requires a `client_id` and `domain`
318+
to be passed, and Web3Auth will get the JWT `id_token` from Auth0 directly. You can pass these
319+
configurations in the `ExtraLoginOptions` object in the login function.
319320

320321
```tsx
321322
web3Auth = Web3Auth (
@@ -348,9 +349,10 @@ val loginCompletableFuture: CompletableFuture<Web3AuthResponse> =
348349

349350
### Custom JWT Login
350351

351-
If you're using any other provider like Firebase/ AWS Cognito or deploying your own Custom JWT server, you need to put the jwt token into the
352-
`id_token` field of the `extraLoginOptions`, additionally, you need to pass over the `domain` field as well, which is mandatory. If you don't have a
353-
domain, just passover a string in that field.
352+
If you're using any other provider like Firebase/ AWS Cognito or deploying your own Custom JWT
353+
server, you need to put the jwt token into the `id_token` field of the `extraLoginOptions`,
354+
additionally, you need to pass over the `domain` field as well, which is mandatory. If you don't
355+
have a domain, just passover a string in that field.
354356

355357
```tsx
356358
web3Auth = Web3Auth (
@@ -381,7 +383,8 @@ val loginCompletableFuture: CompletableFuture<Web3AuthResponse> =
381383

382384
### Email Passwordless
383385

384-
To use the `EMAIL_PASSWORDLESS` login, you need to put the email into the `login_hint` field of the `extraLoginOptions`.
386+
To use the `EMAIL_PASSWORDLESS` login, you need to put the email into the `login_hint` field of the
387+
`extraLoginOptions`.
385388

386389
```kotlin
387390
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(

0 commit comments

Comments
 (0)