Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

License

NotificationsYou must be signed in to change notification settings

MetaMask/single-factor-auth-react-native

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.

📖 Documentation

Checkout the officialWeb3Auth Documentation andSDK Reference to get started!

💡 Features

  • 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

⏪ Requirements

  • For iOS, only iOS 12+ supported since we requires ASWebAuthenticationSession.

  • For Android, Custom Tab support is required.

⚡ Installation

npm install @web3auth/single-factor-auth-react-native

🌟 Configuration

Configure your Web3Auth project

Hop on to theWeb3Auth Dashboard and create a new project. Use the Client ID of the project to start your integration.

Web3Auth Dashboard

  • Add{YOUR_APP_PACKAGE_NAME}://auth toWhitelist URLs.

  • Copy the Project ID for usage later.

💥 Initialization & Usage

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);};}

🩹 Examples

Checkout the examples for your preferred blockchain and platform in ourexamples

🌐 Demo

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.

💬 Troubleshooting and Support

  • 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

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    Contributors5


    [8]ページ先頭

    ©2009-2025 Movatter.jp