Skip to content

Commit

Permalink
Merge pull request #495 from Web3Auth/rn-docs-update
Browse files Browse the repository at this point in the history
docs-update
  • Loading branch information
ihsraham authored Oct 5, 2023
2 parents 7a4ca52 + eb52342 commit f8a49a6
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 58 deletions.
12 changes: 6 additions & 6 deletions docs/sdk/core-kit/sfa-node/initialize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ This Web3Auth constructor takes an object with `Web3AuthOptions` as input.

<TabItem value="table">

| Parameter | Type | Description | Mandatory |
| ------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | --------- |
| `clientId` | `string` | Web3Auth Client ID. Obtain your `clientId` from the [Web3Auth Developer Dashboard](https://dashboard.web3auth.io/). | Yes |
| `web3AuthNetwork?` | `testnet`, `mainnet`, `cyan`, `aqua` | Web3Auth Networks | No |
| `enableLogging?` | `boolean` | Setting it to true will enable logs. | No |
| `usePnPKey?` | `boolean` | Setting this to true returns the same key as web sdk (i.e., plug n play key), By default, this sdk returns `CoreKitKey`. | No |
| Parameter | Type | Description | Mandatory |
| ------------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | --------- |
| `clientId` | `string` | Web3Auth Client ID. Obtain your `clientId` from the [Web3Auth Developer Dashboard](https://dashboard.web3auth.io/). | Yes |
| `web3AuthNetwork?` | `sapphire_mainnet` or `sapphire_testnet` | Web3Auth Networks | No |
| `enableLogging?` | `boolean` | Setting it to true will enable logs. | No |
| `usePnPKey?` | `boolean` | Setting this to true returns the same key as web sdk (i.e., plug n play key), By default, this sdk returns `CoreKitKey`. | No |

</TabItem>

Expand Down
18 changes: 9 additions & 9 deletions docs/sdk/core-kit/sfa-node/sfa-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ displayed_sidebar: sdk
description: "Web3Auth Core Kit Single Factor Auth Node.js SDK | Documentation - Web3Auth"
---

Web3Auth's `@web3auth/node-sdk` SDK is a simple and easy to use SDK in your Node.js backend to get the same experience of Web3Auth frontend SDKs.
Web3Auth's `@web3auth/node-sdk` SDK is a simple and easy-to-use SDK in your Node.js backend to get the same experience as Web3Auth frontend SDKs.

:::info This SDK gives you semi custodial keys
:::info This SDK gives you semi-custodial keys

The `@web3auth/node` SDK gives you the simplest flow for onboarding a user with Web3Auth. The user just needs to click on the login button, connect to
their favourite social account (OAuth) or any passwordless flow, like email passwordless, biometric authentication etc., and a private key is
generated for them. This flow has a 1/1 Key Share setup and the whole key via Web3Auth Auth Network key shares is provided directly to your app, and
their favorite social account (OAuth) or any passwordless flow, like email passwordless, biometric authentication etc., and a private key is generated
for them. This flow has a 1/1 Key Share setup and the whole key via Web3Auth Auth Network key shares is provided directly to your app, and
reconstructed within it.

This flow is still non custodial since the nodes in the Web3Auth network have a 5/9 consensus mechanism to generate the key shares. However, one can
claim that this flow is custodial to the OAuth Login provider, since this is directly generated using credentials provided by them.
This flow is still non-custodial since the nodes in the Web3Auth network have a 5/9 consensus mechanism to generate the key shares. However, one can
claim that this flow is custodial to the OAuth Login provider since this is directly generated using credentials provided by them.

Hence we can call this flow a semi-custodial flow, and encourage users to enable MFA to have a 2/3 Key Share setup, which is a fully non custodial.
Hence we can call this flow a semi-custodial flow, and encourage users to enable MFA to have a 2/3 Key Share setup, which is fully non-custodial.

:::

#### This Documentation is based on `2.0.1` SDK Version.
#### This Documentation is based on `3.0.0` SDK Version.

## Requirements

- This is a backend SDK and can in any node environment
- This is a backend SDK and can be used in any node environment
- Basic knowledge of NodeJS

## Resources
Expand Down
9 changes: 3 additions & 6 deletions docs/sdk/core-kit/sfa-react-native/initialize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,18 @@ export interface SdkInitOptions {
* Web3Auth Network to use for login
* @defaultValue mainnet
*/
web3AuthNetwork?: TORUS_LEGACY_NETWORK_TYPE;

web3AuthNetwork?: TORUS_NETWORK_TYPE;
/**
* setting to true will enable logs
*
* @defaultValue false
*/
enableLogging?: boolean;

/**
* setting this to true returns the same key as web sdk (i.e., plug n play key)
* By default, this sdk returns CoreKitKey
*/
usePnPKey?: boolean;

/**
* How long should a login session last at a minimum in seconds
*
Expand Down Expand Up @@ -221,7 +218,7 @@ const web3auth = new Web3Auth(SecureStore, {
usePnPKey: "false", // By default, this sdk returns CoreKitKey
});

await authProvider.init(privateKeyProvider);
await web3auth.init(privateKeyProvider);
```

</TabItem>
Expand Down Expand Up @@ -255,7 +252,7 @@ const web3auth = new Web3Auth(EncryptedStorage, {
usePnPKey: "false", // By default, this sdk returns CoreKitKey
});

await authProvider.init(privateKeyProvider);
await web3auth.init(privateKeyProvider);
```

</TabItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/core-kit/sfa-react-native/sfa-react-native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SFA React Native and circumvent redirection to openlogin hosted screens.
This SDK offers you the flexibility to provide seamless and secure authentication for your users, while preserving your app's unique user experience
and interface.

#### This Documentation is based on `1.1.0` SDK Version.
#### This Documentation is based on `2.0.0` SDK Version.

## Requirements

Expand Down
10 changes: 5 additions & 5 deletions docs/sdk/core-kit/sfa-react-native/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Natively, the instance of Web3Auth (referred to as web3auth in our examples) ret

`connect(loginParams: LoginParams)`

To login a user in the Web3Auth SFA Web SDK, you need to call `connect()` function.
To log a user in the Web3Auth SFA Web SDK, you need to call `connect()` function.

| Variable | Type | Description | Mandatory |
| ------------- | -------- | ---------------- | --------- |
Expand All @@ -38,15 +38,15 @@ To login a user in the Web3Auth SFA Web SDK, you need to call `connect()` functi
#### Returns

```js
connect(loginParams: LoginParams): Promise<SafeEventEmitterProvider | null>
connect(loginParams: LoginParams): Promise<IProvider | null>
```

#### `LoginParams`

`connect(loginParams: LoginParams)`

On successful login, the `connect()` function returns a `SafeEventEmitterProvider` instance. This instance contains the respective provider
corresponding to your selected blockchain. You can use this provider to connect your user to the blockchain and make transactions.
On successful login, the `connect()` function returns a `IProvider` instance. This instance contains the respective provider corresponding to your
selected blockchain. You can use this provider to connect your user to the blockchain and make transactions.

On unsuccessful login, this function will return a `null` value.

Expand Down Expand Up @@ -135,7 +135,7 @@ Returns the native provider which can be used to make different blockchain trans
#### Returns

```js
get provider(): SafeEventEmitterProvider | null;
get provider(): IProvider | null;
```

## Get connected status
Expand Down
65 changes: 36 additions & 29 deletions docs/sdk/pnp/react-native/initialize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@ below.

<TabItem value="table">

| Parameter | Type | Mandatory | Description |
| ------------- | ------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| clientId | String | Yes | Your Web3Auth project ID obtained from the Web3Auth dashboard |
| network | Choose between `mainnet`, `cyan`,`aqua`,`celeste` , `testnet` | Yes | Web3Auth network to run on, either CYAN, MAINNET, AQUA, CELESTE or TESTNET |
| redirectUrl | String | No | The redirectUrl that the Web3Auth login flow will use to redirect back to the app. |
| loginConfig | LoginConfig | No | A configuration optional object to customize login flow. |
| whiteLabel | WhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. |
| sessionTime | Any number from 1 to 86400\*7. Default is 86400 | No | Decides how long should a login session last in seconds |
| mfaSettings | MfaSettings | No | This parameter will be used to enable mfa factors and set priority on UI listing. List of factors available <ul><li>backUpShareFactor</li><li>socialFactor</li><li>passwordFactor</li><li>deviceShareFactor</li></ul> |
| useCoreKitKey | boolean | No | Use `useCoreKitKey` as `true`, if you're using this SDK with the Single Factor Auth Web SDK |
| sdkUrl | String | No | The url to the SDK frontend, should not need any changes normally. |
| Parameter | Type | Mandatory | Description |
| ------------- | ----------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| clientId | String | Yes | Your Web3Auth project ID obtained from the Web3Auth dashboard |
| network | Choose between `sapphire_mainnet`, `sapphire_testnet` | Yes | Web3Auth network to run on, either `sapphire_mainnet` or `sapphire_testnet` |
| redirectUrl | String | No | The redirectUrl that the Web3Auth login flow will use to redirect back to the app. |
| loginConfig | LoginConfig | No | A configuration optional object to customize login flow. |
| whiteLabel | WhiteLabelData | No | A configuration optional object to customize UI, branding, and translations for your brand. Refer to the WhiteLabeling section for more info. |
| sessionTime | Any number from 1 to 86400\*7. Default is 86400 | No | Decides how long should a login session last in seconds |
| mfaSettings | MfaSettings | No | This parameter will be used to enable mfa factors and set priority on UI listing. List of factors available <ul><li>backUpShareFactor</li><li>socialFactor</li><li>passwordFactor</li><li>deviceShareFactor</li></ul> |
| useCoreKitKey | boolean | No | Use `useCoreKitKey` as `true`, if you're using this SDK with the Single Factor Auth Web SDK |
| sdkUrl | String | No | The url to the SDK frontend, should not need any changes normally. |

</TabItem>

Expand All @@ -152,7 +152,6 @@ export type SdkInitParams = {
* dapp on {@link "https://dashboard.web3auth.io"| developer dashboard}
*/
clientId: string;

/**
* network specifies the openlogin sdk url to be used.
*
Expand All @@ -162,7 +161,11 @@ export type SdkInitParams = {
* - `'development'`: http://localhost:3000 will be used for development purpose.
*/
network: OPENLOGIN_NETWORK_TYPE;

/**
* This parameter will be used to change the build environment of openlogin sdk.
* @defaultValue production
*/
buildEnv?: BUILD_ENV_TYPE;
/**
* redirectUrl is the dapp's url where user will be redirected after login.
*
Expand All @@ -171,7 +174,6 @@ export type SdkInitParams = {
* else initialization will give error.
*/
redirectUrl?: string;

/**
* loginConfig enables you to pass your own login verifiers configuration for various
* loginProviders.
Expand All @@ -185,38 +187,43 @@ export type SdkInitParams = {
*
*/
loginConfig?: LoginConfig;

/**
* options for whitelabling default openlogin modal.
*/
whiteLabel?: WhiteLabelData,

whiteLabel?: WhiteLabelData;
/**
* Specify a custom storage server url
* @defaultValue https://broadcast-server.tor.us
* @internal
*/
storageServerUrl?: string;
/**
* setting to "local" will persist social login session accross browser tabs.
*
* @defaultValue "local"
*/
storageKey?: "session" | "local";
/**
* How long should a login session last at a minimum in seconds
*
* @defaultValue 86400 seconds
* @remarks Max value of sessionTime can be 7 * 86400 (7 days)
*/
sessionTime?: number;

/**
* This parameter will be used to enable mfa factors and set priority on UI listing.
* List of factors available
* backUpShareFactor | socialFactor | passwordFactor
* @defaultValue false
*/
mfaSettings?: MfaSettings;

/**
* Uses core-kit key with web3auth provider
* This parameter will be used to use openlogin mpc
* @defaultValue false
*/
useMpc?: boolean;
enableLogging?: boolean;
useCoreKitKey?: boolean;

/**
* sdkUrl is the url to the sdk frontend, should not need any changes normally.
*/
sdkUrl?: string;
};
```

Expand Down Expand Up @@ -252,7 +259,7 @@ const clientId = "YOUR WEB3AUTH CLIENT ID";

const web3auth = new Web3Auth(WebBrowser, SecureStore, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
network: OPENLOGIN_NETWORK.SAPPHIRE_MAINNET, // or other networks
});
```

Expand All @@ -272,7 +279,7 @@ const clientId = "YOUR WEB3AUTH CLIENT ID";

const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
network: OPENLOGIN_NETWORK.SAPPHIRE_MAINNET, // or other networks
});
```

Expand All @@ -294,7 +301,7 @@ const clientId = "YOUR WEB3AUTH CLIENT ID";

const web3auth = new Web3Auth(WebBrowser, SecureStore, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
network: OPENLOGIN_NETWORK.SAPPHIRE_MAINNET, // or other networks
loginConfig: {
jwt: {
name: "Web3Auth-Auth0-JWT",
Expand Down Expand Up @@ -322,7 +329,7 @@ const clientId = "YOUR WEB3AUTH CLIENT ID";

const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
network: OPENLOGIN_NETWORK.SAPPHIRE_MAINNET, // or other networks
loginConfig: {
jwt: {
name: "Web3Auth-Auth0-JWT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function signInWithEmailPassword() {
// Instantiate Web3Auth SFA SDK
const web3AuthSfa = new Web3Auth(EncryptedStorage, {
clientId: "WEB3AUTH_CLIENT_ID", // Get your Client ID from the Web3Auth Dashboard
web3AuthNetwork: "cyan",
web3AuthNetwork: "sapphire_mainnet", // Get your network from the Web3Auth Dashboard
usePnPKey: false, // By default, this sdk returns CoreKitKey
});

Expand Down
2 changes: 1 addition & 1 deletion src/common/sdk/core-kit/sfa/_sfa_rn_expo_auth0_example.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Web3Auth from '@web3auth/single-factor-auth-react-native';
// Instantiate Web3Auth SFA SDK
const web3AuthSfa = new Web3Auth(SecureStore, {
clientId: "WEB3AUTH_CLIENT_ID", // Get your Client ID from the Web3Auth Dashboard
web3AuthNetwork: 'cyan',
web3AuthNetwork: 'sapphire_mainnet',
usePnPKey: false, // By default, this sdk returns CoreKitKey
});

Expand Down

1 comment on commit f8a49a6

@vercel
Copy link

@vercel vercel bot commented on f8a49a6 Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web3auth-docs – ./

web3auth-docs-git-master-web3auth.vercel.app
w3a-docs.vercel.app
web3auth-docs-web3auth.vercel.app

Please sign in to comment.