Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Web3Auth is where passwordless auth meets non-custodial key infrastructure for W
Checkout the official [Web3Auth Documentation](https://web3auth.io/docs) and [SDK Reference](https://web3auth.io/docs/sdk/pnp/react-native) to get started!

## 💡 Features

- Plug and Play, OAuth based Web3 Authentication Service
- Fully decentralized, non-custodial key infrastructure
- End to end Whitelabelable solution
Expand Down Expand Up @@ -99,42 +100,42 @@ web3authrnexample://openlogin

## 💥 Initialization & Usage

In your sign-in activity', create an `Web3Auth` instance with your Web3Auth project's configurations and
In your sign-in activity', create an `Web3Auth` instance with your Web3Auth project's configurations and
configure it like this:

### Expo Managed Workflow

```js
import * as WebBrowser from 'expo-web-browser';
import Web3Auth, { LOGIN_PROVIDER, OPENLOGIN_NETWORK } from "@web3auth/react-native-sdk";
import * as WebBrowser from "expo-web-browser";
import Web3Auth, { AUTH_CONNECTION, OPENLOGIN_NETWORK } from "@web3auth/react-native-sdk";

const web3auth = new Web3Auth(WebBrowser, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
redirectUrl: resolvedRedirectUrl,
});
const info = await web3auth.login({
loginProvider: LOGIN_PROVIDER.GOOGLE,
redirectUrl: resolvedRedirectUrl,
mfaLevel: 'mandatory', // optional
curve: 'secp256k1', // optional
authConnection: AUTH_CONNECTION.GOOGLE,
mfaLevel: "mandatory", // optional
curve: "secp256k1", // optional
});
```

### Bare Workflow

```js
import * as WebBrowser from '@toruslabs/react-native-web-browser';
import Web3Auth, { LOGIN_PROVIDER, OPENLOGIN_NETWORK } from "@web3auth/react-native-sdk";
import * as WebBrowser from "@toruslabs/react-native-web-browser";
import Web3Auth, { AUTH_CONNECTION, OPENLOGIN_NETWORK } from "@web3auth/react-native-sdk";

const web3auth = new Web3Auth(WebBrowser, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
redirectUrl: resolvedRedirectUrl,
});
const info = await web3auth.login({
loginProvider: LOGIN_PROVIDER.GOOGLE,
redirectUrl: resolvedRedirectUrl,
mfaLevel: 'mandatory', // optional
curve: 'secp256k1', // optional
authConnection: AUTH_CONNECTION.GOOGLE,
mfaLevel: "mandatory", // optional
curve: "secp256k1", // optional
});
```

Expand Down
20 changes: 10 additions & 10 deletions demo/rn-bare-example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React, { useEffect, useState } from "react";
import { StyleSheet, Text, View, Button, ScrollView, Dimensions, TextInput, Switch } from "react-native";
import "@ethersproject/shims";
import { ethers } from "ethers";

// IMP START - Quick Start
import * as WebBrowser from "@toruslabs/react-native-web-browser";
import EncryptedStorage from "react-native-encrypted-storage";
import Web3Auth, { LOGIN_PROVIDER, WEB3AUTH_NETWORK, ChainNamespace } from "@web3auth/react-native-sdk";
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
import { MMKVLoader, useMMKVStorage } from "react-native-mmkv-storage";
import {
AccountAbstractionProvider,
BiconomySmartAccount,
Expand All @@ -17,6 +10,13 @@ import {
SafeSmartAccount,
TrustSmartAccount,
} from "@web3auth/account-abstraction-provider";
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
import Web3Auth, { AUTH_CONNECTION, ChainNamespace, WEB3AUTH_NETWORK } from "@web3auth/react-native-sdk";
import { ethers } from "ethers";
import React, { useEffect, useState } from "react";
import { Button, Dimensions, ScrollView, StyleSheet, Switch, Text, TextInput, View } from "react-native";
import EncryptedStorage from "react-native-encrypted-storage";
import { MMKVLoader, useMMKVStorage } from "react-native-mmkv-storage";
// IMP END - Quick Start

const scheme = "web3authrnexample"; // Or your desired app redirection scheme
Expand All @@ -32,7 +32,7 @@ const clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw
const chainConfig = {
chainNamespace: ChainNamespace.EIP155,
chainId: "0xaa36a7",
rpcTarget: "https://rpc.ankr.com/eth_sepolia",
rpcTarget: "https://1rpc.io/sepolia",
// Avoid using public rpcTarget in production.
// Use services like Infura, Quicknode etc
displayName: "Ethereum Sepolia Testnet",
Expand Down Expand Up @@ -167,7 +167,7 @@ export default function App() {
setConsole("Logging in");
// IMP START - Login
await web3auth.login({
loginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS,
authConnection: AUTH_CONNECTION.EMAIL_PASSWORDLESS,
extraLoginOptions: {
login_hint: email,
},
Expand Down Expand Up @@ -280,7 +280,7 @@ export default function App() {
}

setConsole("Launch Wallet Services");
await web3auth.launchWalletServices(chainConfig);
await web3auth.launchWalletServices();
};

const uiConsole = (...args: unknown[]) => {
Expand Down
4 changes: 2 additions & 2 deletions demo/rn-bare-example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1470,8 +1470,8 @@ SPEC CHECKSUMS:
React-utils: 4476b7fcbbd95cfd002f3e778616155241d86e31
ReactCommon: ecad995f26e0d1e24061f60f4e5d74782f003f12
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 2f71ecf38d934aecb366e686278102a51679c308
Yoga: ae3c32c514802d30f687a04a6a35b348506d411f

PODFILE CHECKSUM: 3dac9911479fab8b2375358eac35d220bf61e989

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
Loading