Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1
License
MetaMask/single-factor-auth-react-native
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Web3Auth is where passwordless auth meets non-custodial key infrastructure for Web3 apps and wallets. By aggregating OAuth (Google, Twitter, Discord) logins, different wallets and innovative Multi Party Computation (MPC) - Web3Auth provides a seamless login experience to every user on your application.
Web3Auth Single Factor Auth is the SDK that gives you the ability to start with just one key (aka, Single Factor) with Web3Auth, giving you the flexibility of implementing your own UI and UX.
Checkout the officialWeb3Auth Documentation andSDK Reference to get started!
- JWT based Web3 Authentication Service
- Fully decentralized, non-custodial key infrastructure
- End to end Whitelabelable solution
- Threshold Cryptography based Key Reconstruction
- Multi Factor Authentication Setup & Recovery (Includes password, backup phrase, device factor editing/deletion etc)
- Support for WebAuthn & Passwordless Login
- Support for connecting to multiple wallets
- DApp Active Session Management
- Support for Expo and Bare React Native Workflows
...and a lot more
For iOS, only iOS 12+ supported since we requires ASWebAuthenticationSession.
For Android, Custom Tab support is required.
npm install @web3auth/single-factor-auth-react-native
Hop on to theWeb3Auth Dashboard and create a new project. Use the Client ID of the project to start your integration.
Add
{YOUR_APP_PACKAGE_NAME}://authtoWhitelist URLs.Copy the Project ID for usage later.
In your sign-in activity', create anWeb3Auth instance with your Web3Auth project's configurations andconfigure it like this:
importEncryptedStoragefrom'react-native-encrypted-storage';importWeb3Authfrom'@web3auth/single-factor-auth-react-native';import{EthereumPrivateKeyProvider}from'@web3auth/ethereum-provider';exportdefaultfunctionApp(){const[web3auth,setWeb3Auth]=useState<Web3Auth|null>(null);const[privateKey,setPrivateKey]=useState<string|null>();useEffect(()=>{asyncfunctioninit(){constauthProvider=newWeb3Auth(EncryptedStorage,{clientId:'YOUR_WEB3AUTH_CLIENT_ID',// Get your Client ID from Web3Auth Dashboardweb3AuthNetwork:'cyan',usePnPKey:false,// By default, this sdk returns CoreKitKey});constprivateKeyProvider=newEthereumPrivateKeyProvider({config:{/* pass the chain config that you want to connect with all chainConfig fields are required. */chainConfig:{chainId:'0x1',rpcTarget:'https://rpc.ankr.com/eth',displayName:'mainnet',blockExplorer:'https://etherscan.io/',ticker:'ETH',tickerName:'Ethereum',},},});setWeb3Auth(authProvider);awaitauthProvider.init(privateKeyProvider);if(authProvider.connected){constfinalPrivateKey=awaitauthProvider.provider!.request({method:'eth_private_key',});setPrivateKey(finalPrivateKeyasstring);console.log('Private Key: '+finalPrivateKey);}}init();},[]);constlogin=async()=>{constloginRes=awaitsignIn();constidToken=awaitloginRes!.user.getIdToken(true);constparsedToken=parseToken(idToken);constverifier='YOUR_WEB3AUTH_VERIFIER';constverifierId=parsedToken.sub;constprovider=awaitweb3auth!.connect({ verifier,// e.g. `web3auth-sfa-verifier` replace with your verifier name, and it has to be on the same network passed in init(). verifierId,// e.g. `Yux1873xnibdui` or `name@email.com` replace with your verifier id(sub or email)'s value. idToken,});constfinalPrivateKey=awaitprovider!.request({method:'eth_private_key',});setPrivateKey(finalPrivateKeyasstring);console.log('Private Key: '+finalPrivateKey);};}
Checkout the examples for your preferred blockchain and platform in ourexamples
Checkout theWeb3Auth Demo to see how Web3Auth can be used in an application.
Further checkout theexample folder within this repository, which contains a sample app.
- Have a look at ourCommunity Portal to see if anyone has any questions or issues you might be having. Feel free to reate new topics and we'll help you out as soon as possible.
- Checkout ourTroubleshooting Documentation Page to know the common issues and solutions.
- For Priority Support, please have a look at ourPricing Page for the plan that suits your needs.
About
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.
