Skip to content

Commit b0dbbe0

Browse files
committed
Update RN docs
1 parent f09a482 commit b0dbbe0

File tree

15 files changed

+106
-87
lines changed

15 files changed

+106
-87
lines changed

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"Metamask's",
1818
"metastring",
1919
"nodir",
20-
"openlogin",
2120
"palenight",
2221
"passwordless",
2322
"solana",

docs/sdk/pnp/react-native/custom-authentication.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ should be a `LoginConfig` object.
5050
```javascript
5151
import * as WebBrowser from "@toruslabs/react-native-web-browser";
5252
import Web3Auth, {
53-
OPENLOGIN_NETWORK,
53+
WEB3AUTH_NETWORK,
5454
LOGIN_PROVIDER,
5555
TypeOfLogin,
5656
} from "@web3auth/react-native-sdk";
5757

5858
const web3auth = new Web3Auth(WebBrowser, {
5959
clientId: "YOUR_CLIENT_ID", // web3auth's client id
60-
network: OPENLOGIN_NETWORK.MAINNET, // or other networks
60+
network: WEB3AUTH_NETWORK.MAINNET, // or other networks
6161
loginConfig: {
6262
google: {
6363
verifier: "google-verifier", // Get this from the Web3Auth Dashboard
@@ -141,7 +141,7 @@ export const LOGIN_PROVIDER = {
141141
```javascript
142142
web3auth.login({
143143
loginProvider: LOGIN_PROVIDER.GOOGLE,
144-
redirectUrl: `${scheme}://openlogin`,
144+
redirectUrl: `${scheme}://auth`,
145145
extraLoginOptions: {
146146
login_hint: "[email protected]", // Optional: pre-fill the email field
147147
},
@@ -153,7 +153,7 @@ web3auth.login({
153153
```javascript
154154
web3auth.login({
155155
loginProvider: LOGIN_PROVIDER.JWT,
156-
redirectUrl: `${scheme}://openlogin`,
156+
redirectUrl: `${scheme}://auth`,
157157
extraLoginOptions: {
158158
id_token: "YOUR_JWT_ID_TOKEN", // JWT ID token
159159
domain: "https://example.auth0.com", // Auth0 domain
@@ -175,7 +175,7 @@ verifier.
175175
```javascript
176176
const web3auth = new Web3Auth(WebBrowser, {
177177
clientId: "YOUR_CLIENT_ID", // Web3Auth's client id
178-
network: OPENLOGIN_NETWORK.MAINNET, // or other networks
178+
network: WEB3AUTH_NETWORK.MAINNET, // or other networks
179179
loginConfig: {
180180
google: {
181181
verifier: "aggregate-verifier",
@@ -205,7 +205,7 @@ const web3auth = new Web3Auth(WebBrowser, {
205205
```javascript
206206
web3auth.login({
207207
loginProvider: LOGIN_PROVIDER.GOOGLE, // or LOGIN_PROVIDER.JWT
208-
redirectUrl: `${scheme}://openlogin`,
208+
redirectUrl: `${scheme}://auth`,
209209
});
210210
```
211211

docs/sdk/pnp/react-native/initialize.mdx

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ have to be configured within this step, if you wish to customize your Web3Auth I
2727
You may also import additional types from the SDK to help in the development process.
2828

2929
```typescript
30-
import Web3Auth, { OPENLOGIN_NETWORK, LOGIN_PROVIDER } from "@web3auth/react-native-sdk";
30+
import Web3Auth, { WEB3AUTH_NETWORK, LOGIN_PROVIDER } from "@web3auth/react-native-sdk";
3131
```
3232

3333
### Importing a `WebBrowser` implementation
@@ -134,18 +134,20 @@ an argument. The fields of such objects are listed below.
134134

135135
<TabItem value="table">
136136

137-
| Parameter | Description |
138-
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
139-
| `clientId` | Your Web3Auth Client ID. You can get it from Web3Auth [Dashboard](https://dashboard.web3auth.io/) under project details. It's a mandatory field of type `string` |
140-
| `network` | Defines the Web3Auth network. It's a mandatory field of type `OPENLOGIN_NETWORK_TYPE`. |
141-
| `redirectUrl` | URL that Web3Auth will redirect API responses upon successful authentication from browser. It's a mandatory field of type `string`. |
142-
| `whiteLabel?` | WhiteLabel options for web3auth. It helps you define custom UI, branding, and translations for your brand app. It takes `WhiteLabelData` as a value. |
143-
| `loginConfig?` | Login config for the custom verifiers. It takes `LoginConfig` as a value. |
144-
| `useCoreKitKey?` | Use CoreKit Key to get core kit key. It's an optional field with default value as `false`. |
145-
| `mfaSettings?` | Allows developers to configure the Mfa settings for authentication. It takes `MfaSettings` as a value. |
146-
| `sessionTime?` | It allows developers to configure the session management time. Session Time is in seconds, default is 86400 seconds which is 1 day. `sessionTime` can be max 7 days |
147-
| `storageServerUrl?` | Specify a custom storage url. Default value is `https://broadcast-server.tor.us`. |
148-
| `storageKey?` | Specify the storage key. Setting to "local" will persist social login session accross browser tabs. Available options are "local" and "session". |
137+
| Parameter | Description |
138+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
139+
| `clientId` | Your Web3Auth Client ID. You can get it from Web3Auth [Dashboard](https://dashboard.web3auth.io/) under project details. It's a mandatory field of type `string` |
140+
| `network` | Defines the Web3Auth network. It's a mandatory field of type `WEB3AUTH_NETWORK_TYPE`. |
141+
| `redirectUrl` | URL that Web3Auth will redirect API responses upon successful authentication from browser. It's a mandatory field of type `string`. |
142+
| `privateKeyProvider` | Private key provider for your chain namespace. |
143+
| `accountAbstractionProvider?` | Account abstraction provider for your preferred chain and provider. |
144+
| `whiteLabel?` | WhiteLabel options for web3auth. It helps you define custom UI, branding, and translations for your brand app. It takes `WhiteLabelData` as a value. |
145+
| `loginConfig?` | Login config for the custom verifiers. It takes `LoginConfig` as a value. |
146+
| `useCoreKitKey?` | Use CoreKit Key to get core kit key. It's an optional field with default value as `false`. |
147+
| `mfaSettings?` | Allows developers to configure the Mfa settings for authentication. It takes `MfaSettings` as a value. |
148+
| `sessionTime?` | It allows developers to configure the session management time. Session Time is in seconds, default is 86400 seconds which is 1 day. `sessionTime` can be max 7 days |
149+
| `storageServerUrl?` | Specify a custom storage url. Default value is `https://broadcast-server.tor.us`. |
150+
| `storageKey?` | Specify the storage key. Setting to "local" will persist social login session accross browser tabs. Available options are "local" and "session". |
149151

150152
</TabItem>
151153

@@ -158,9 +160,9 @@ export type SdkInitParams = {
158160
* dapp on {@link "https://dashboard.web3auth.io"| developer dashboard}
159161
*/
160162
clientId: string;
161-
network: OPENLOGIN_NETWORK_TYPE;
163+
network: WEB3AUTH_NETWORK_TYPE;
162164
/**
163-
* This parameter will be used to change the build environment of openlogin sdk.
165+
* This parameter will be used to change the build environment of auth sdk.
164166
* @defaultValue production
165167
*/
166168
buildEnv?: BUILD_ENV_TYPE;
@@ -186,7 +188,7 @@ export type SdkInitParams = {
186188
*/
187189
loginConfig?: LoginConfig;
188190
/**
189-
* options for whitelabling default openlogin modal.
191+
* options for whitelabling default auth modal.
190192
*/
191193
whiteLabel?: WhiteLabelData;
192194
/**
@@ -216,29 +218,45 @@ export type SdkInitParams = {
216218
*/
217219
mfaSettings?: MfaSettings;
218220
/**
219-
* This parameter will be used to use openlogin mpc
221+
* This parameter will be used to use auth mpc
220222
* @defaultValue false
221223
*/
222224
enableLogging?: boolean;
223225
useCoreKitKey?: boolean;
226+
walletSdkURL?: string;
227+
/**
228+
* Private key provider for your chain namespace
229+
*/
230+
privateKeyProvider: IBaseProvider<string>;
231+
/**
232+
* Account abstraction provider for your chain namespace
233+
*/
234+
accountAbstractionProvider?: IBaseProvider<IProvider>;
224235
};
225236
```
226237

227238
</TabItem>
228239

229240
</Tabs>
230241

231-
## Instantiating a Provider
232-
233-
<InstantiatingProvider />
234-
235-
### Adding a Custom Chain Configuration
242+
## Adding a Custom Chain Configuration
236243

237244
#### `chainConfig`
238245

239246
<ChainConfig />
240247

241-
## Example
248+
:::tip
249+
250+
Get the **Chain Config** for your preferred Blockchain from the
251+
[Connect Blockchain Reference](/connect-blockchain#reference-guides-for-blockchain-connections).
252+
253+
:::
254+
255+
## Instantiating a Provider
256+
257+
<InstantiatingProvider />
258+
259+
### Usage
242260

243261
<Tabs
244262
defaultValue="bare"
@@ -256,13 +274,13 @@ import * as WebBrowser from "@toruslabs/react-native-web-browser";
256274
import EncryptedStorage from "react-native-encrypted-storage";
257275
import Web3Auth, {
258276
LOGIN_PROVIDER,
259-
OPENLOGIN_NETWORK,
277+
WEB3AUTH_NETWORK,
260278
ChainNamespace,
261279
} from "@web3auth/react-native-sdk";
262280
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
263281

264282
const scheme = "web3authrnexample"; // Or your desired app redirection scheme
265-
const redirectUrl = `${scheme}://openlogin`;
283+
const redirectUrl = `${scheme}://auth`;
266284

267285
const clientId =
268286
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; // get from https://dashboard.web3auth.io
@@ -281,7 +299,7 @@ const chainConfig = {
281299
logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
282300
};
283301

284-
const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
302+
const privateKeyProvider = new EthereumPrivateKeyProvider({
285303
config: {
286304
chainConfig,
287305
},
@@ -290,7 +308,8 @@ const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
290308
const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
291309
clientId,
292310
redirectUrl,
293-
network: OPENLOGIN_NETWORK.SAPPHIRE_MAINNET, // or other networks
311+
network: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or other networks
312+
privateKeyProvider,
294313
});
295314
```
296315

@@ -302,7 +321,7 @@ const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
302321
import * as WebBrowser from "expo-web-browser";
303322
import * as SecureStore from "expo-secure-store";
304323
import Web3Auth, {
305-
OPENLOGIN_NETWORK,
324+
WEB3AUTH_NETWORK,
306325
LOGIN_PROVIDER,
307326
ChainNamespace,
308327
} from "@web3auth/react-native-sdk";
@@ -329,7 +348,7 @@ const chainConfig = {
329348
logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
330349
};
331350

332-
const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
351+
const privateKeyProvider = new EthereumPrivateKeyProvider({
333352
config: {
334353
chainConfig,
335354
},
@@ -338,7 +357,8 @@ const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
338357
const web3auth = new Web3Auth(WebBrowser, SecureStore, {
339358
clientId,
340359
redirectUrl,
341-
network: OPENLOGIN_NETWORK.SAPPHIRE_MAINNET, // or other networks
360+
network: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or other networks
361+
privateKeyProvider,
342362
});
343363
```
344364

@@ -351,13 +371,13 @@ import * as WebBrowser from "@toruslabs/react-native-web-browser";
351371
import EncryptedStorage from "react-native-encrypted-storage";
352372
import Web3Auth, {
353373
LOGIN_PROVIDER,
354-
OPENLOGIN_NETWORK,
374+
WEB3AUTH_NETWORK,
355375
ChainNamespace,
356376
} from "@web3auth/react-native-sdk";
357377
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
358378

359379
const scheme = "web3authrnbareauth0example"; // Or your desired app redirection scheme
360-
const redirectUrl = `${scheme}://openlogin`;
380+
const redirectUrl = `${scheme}://auth`;
361381
const clientId =
362382
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ";
363383

@@ -375,17 +395,18 @@ const chainConfig = {
375395
logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
376396
};
377397

378-
const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
398+
const privateKeyProvider = new EthereumPrivateKeyProvider({
379399
config: {
380400
chainConfig,
381401
},
382402
});
383403

384404
const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
385405
clientId,
386-
network: OPENLOGIN_NETWORK.SAPPHIRE_MAINNET, // or other networks
406+
network: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or other networks
387407
redirectUrl,
388408
useCoreKitKey: true,
409+
privateKeyProvider,
389410
loginConfig: {
390411
jwt: {
391412
verifier: "w3a-auth0-demo",

docs/sdk/pnp/react-native/install.mdx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import TabItem from "@theme/TabItem";
88
import Tabs from "@theme/Tabs";
99
import ExpoWarning from "@site/src/common/docs/_expo-warning.mdx";
1010

11+
#### [`@web3auth/react-native-sdk`](https://github.com/web3auth/web3auth-react-native-sdk)
12+
13+
```bash npm2yarn
14+
npm install --save @web3auth/react-native-sdk
15+
```
16+
1117
## Selecting your Workflow
1218

1319
In React Native, you have the choice to use one of the following workflows:
@@ -36,13 +42,7 @@ You can read more about different workflows in the
3642

3743
:::
3844

39-
## Installation
40-
41-
#### [`@web3auth/react-native-sdk`](https://github.com/web3auth/web3auth-react-native-sdk)
42-
43-
```bash npm2yarn
44-
npm install --save @web3auth/react-native-sdk
45-
```
45+
## Installing Helper Modules
4646

4747
### Adding a Web Browser Module
4848

@@ -60,8 +60,6 @@ bare workflow or managed workflow.
6060

6161
<TabItem value="expo">
6262

63-
#### Expo Web Browser
64-
6563
When using our SDK with an Expo-based React Native app (aka managed workflow), you have to install
6664
the `expo-web-browser` package as a `WebBrowser` implementation.
6765

@@ -73,8 +71,6 @@ expo install expo-web-browser
7371

7472
<TabItem value="bare">
7573

76-
#### React Native Web Browser
77-
7874
When using our SDK with a bare workflow React Native app, you have to install a `WebBrowser`
7975
implementation made by us.
8076

@@ -100,8 +96,6 @@ management without storing the private keys of the user in the device.
10096

10197
<TabItem value="expo">
10298

103-
#### Expo Secure Store
104-
10599
When using our SDK with an Expo-based React Native app (aka managed workflow), you have to install
106100
the `expo-secure-store` package as a `Storage` implementation.
107101

@@ -113,8 +107,6 @@ expo install expo-secure-store
113107

114108
<TabItem value="bare">
115109

116-
#### React Native Encrypted Storage
117-
118110
When using our SDK with a bare workflow React Native app, you have to install a `Storage`
119111
implementation provided by react-native.
120112

@@ -125,6 +117,17 @@ npm install --save react-native-encrypted-storage
125117
</TabItem>
126118
</Tabs>
127119

120+
### Add a Provider to your project
121+
122+
The `@web3auth/react-native` package requires a private key provider to facilitate interaction with
123+
your preferred blockchain network. You can choose between the following providers based on your
124+
usecase.
125+
126+
- [EIP1193 Private Key Provider for EVM Compatible Chains](/sdk/pnp/react-native/providers/evm)
127+
- [Solana Private Key Provider for Solana Blockchain](/sdk/pnp/react-native/providers/solana)
128+
- [XRPL Private Key Provider for XRPL Blockchain](/sdk/pnp/react-native/providers/xrpl)
129+
- [Common Private Key Provider for Connecting to any Blockchain](/sdk/pnp/react-native/providers/common)
130+
128131
## Configuration
129132

130133
After you have installed the files needed for your workflow, you'll have to configure the SDK with
@@ -234,12 +237,12 @@ targetSdkVersion = 31
234237

235238
- Your `redirectUrl` is your defined scheme following some identifier or your choice. For example,
236239
if your scheme is `web3authrnexample`, you can define your `redirectUrl` as
237-
`web3authrnexample://openlogin`. Make sure you register this `redirectUrl` in the
240+
`web3authrnexample://auth`. Make sure you register this `redirectUrl` in the
238241
[Web3Auth Developer Dashboard](https://dashboard.web3auth.io).
239242

240243
```tsx title="App.js"
241244
const scheme = "web3authrnexample"; // Or your desired app redirection scheme
242-
const resolvedRedirectUrl = `${scheme}://openlogin`;
245+
const resolvedRedirectUrl = `${scheme}://auth`;
243246
```
244247

245248
#### iOS

docs/sdk/pnp/react-native/mfa.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ for free.
5353
:::
5454

5555
You can configure the order of MFA or enable/disable MFA type by passing the `mfaSettings` object in
56-
`OpenLoginOptions`. We offer the following backup factors under `mfaSettings`:
56+
`Web3AuthOptions`. We offer the following backup factors under `mfaSettings`:
5757

5858
- `deviceShareFactor`,
5959
- `backUpShareFactor`,

docs/sdk/pnp/react-native/usage.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export type LoginParams = BaseRedirectParams & {
138138
* - `'secp256k1'`: secp256k1 based pub key is added as a wallet public key in jwt token to use.
139139
* - `'ed25519'`: ed25519 based pub key is added as a wallet public key in jwt token to use.
140140
*
141-
* Note: This parameter won't change format of private key returned by openlogin. Private key returned
142-
* by openlogin is always `secp256k1`. As of now you have to convert it to `'ed25519'` if you want.
141+
* Note: This parameter won't change format of private key returned by auth service. Private key returned
142+
* by auth service is always `secp256k1`. As of now you have to convert it to `'ed25519'` if you want.
143143
* You can use `@toruslabs/openlogin-ed25519` npm package for this purpose.
144144
*
145145
*

0 commit comments

Comments
 (0)