Skip to content

Commit 0692128

Browse files
committed
nit for SFA RN
1 parent e7e8338 commit 0692128

2 files changed

Lines changed: 59 additions & 40 deletions

File tree

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

Lines changed: 20 additions & 15 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>
@@ -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)**

0 commit comments

Comments
 (0)