Skip to content

Simple infrastructure that enables Web3 wallets and applications to provide seamless user logins for both mainstream and Web3.0 users.

Notifications You must be signed in to change notification settings

amirsaran3/Web3Auth

Β 
Β 

Repository files navigation

Web3Auth

lerna code style: prettier npm GitHub Workflow Status

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.

πŸ“– Documentation

Checkout the official Web3Auth Documentation and SDK Reference to get started!

πŸ’‘ Features

  • Plug and Play, OAuth 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

...and a lot more

πŸ’­ Choosing Between SDKs

For using Web3Auth in the web, you have two choices of SDKs to get started with.

Web3Auth Plug and Play UI SDK @web3auth/web3auth: A simple and easy to use SDK that will give you a simple modular way of implementing Web3Auth directly within your application. You can use the pre-configured Web3Auth Modal UI and whitelabel it according to your needs.

Web3Auth Plug and Play Core SDK @web3auth/core: The core module implemeting all the Web3Auth features you need and giving you the flexibilty of using your own UI with the Web3Auth SDK working in the backend.

⚑ Quick Start

Installation (Web3Auth Plug and Play UI)

npm install --save @web3auth/web3auth

Get your Client ID from Web3Auth Dashboard

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

Web3Auth Dashboard

Initialize Web3Auth for your preferred blockchain

Web3Auth needs to initialise as soon as your app loads up to enable the user to log in. Preferably done within a constructor, initialisation is the step where you can pass on all the configurations for Web3Auth you want. A simple integration for Ethereum blockchain will look like this:

import { Web3Auth } from "@web3auth/web3auth";

//Initialize within your constructor
const web3auth = new Web3Auth({
  clientId: "", // Get your Client ID from Web3Auth Dashboard
  chainConfig: {
    chainNamespace: "eip155",
    chainId: "0x1",
  },
});

await web3auth.initModal();

Login your User

Once you're done initialising, just create a button that triggers to open the login modal for the user on their request. Logging in is as easy as:

await web3auth.connect();

πŸ“¦ Packages within this repository

Packages @latest Version Size Description
🏠 Core
@web3auth/core npm version minzip Provides the core logic for handling adapters within web3auth. This package acts as a manager for all the adapters. You should use this package to build your custom login UI on top of web3auth.
@web3auth/web3auth npm version minzip Provides the main class for using default web3auth modal. It inherits @web3auth/core package. So you can still call all the functions available in the @web3auth/core api reference. The package includes all of our packages and gives you a simple way of implementing Web3Auth within your interface.
πŸ”Œ Adapters
@web3auth/coinbase-adapter npm version minzip Adds coinbase login functionality
@web3auth/metamask-adapter npm version minzip Adds metamask chrome extension login functionality
@web3auth/openlogin-adapter npm version minzip Adds social logins with MFA functionality
@web3auth/phantom-adapter npm version minzip Adds phantom chrome extension login functionality
@web3auth/torus-evm-adapter npm version minzip Adds Torus Wallet login functionality (https://app.tor.us)
@web3auth/torus-solana-adapter npm version minzip Adds Solana Torus Wallet login functionality (https://solana.tor.us)
@web3auth/wallet-connect-v1-adapter npm version minzip Adds wallet connect v1 login functionality + all supported adapters (eg: Metamask mobile, rainbow etc.)
πŸ‰ Providers
@web3auth/base-provider npm version minzip Base implementation of JRPC provider
@web3auth/ethereum-provider npm version minzip EIP-1193 compatible JRPC provider
@web3auth/solana-provider npm version minzip Solana chain compatible JRPC provider
πŸ‰ Plugins
@web3auth/base-plugin npm version minzip Base implementation of plugin
@web3auth/torus-wallet-connector-plugin npm version minzip Allows to inject your web3auth scoped private key into torus wallet UI (https://app.tor.us)
@web3auth/solana-wallet-connector-plugin npm version minzip Allows to inject your web3auth scoped private key into torus solana wallet UI (https://solana.tor.us)
πŸ‰ Low-Level
@web3auth/base npm version minzip Base reusable functionalities for creating a web3auth instance
@web3auth/ui npm version minzip Provides the UI used for creating the modal

βͺ Requirements

  • All packages require a peer dependency of @babel/runtime
  • Node 14+

🧳 Bundling

This module is distributed in 4 formats

  • esm build dist/package.esm.js in es6 format
  • commonjs build dist/package.cjs.js in es5 format
  • umd build dist/package.umd.min.js in es5 format without polyfilling corejs minified

By default, the appropriate format is used for your specified usecase You can use a different format (if you know what you're doing) by referencing the correct file

The cjs build is not polyfilled with core-js. It is upto the user to polyfill based on the browserlist they target

Directly in Browser

CDN's serve the non-core-js polyfilled version by default. You can use a different

Please replace package and version with the appropriate package name

jsdeliver

<script src="https://cdn.jsdelivr.net/npm/@web3auth/PACKAGE@VERSION"></script>

unpkg

<script src="https://unpkg.com/@web3auth/PACKAGE@VERSION"></script>

🩹 Examples

Checkout the examples for your preferred blockchain and platform in our examples repository

🌐 Demo

Checkout the Web3Auth Demo to see how Web3Auth can be used in your application.

Further checkout the demo folder within this repository, which contains other hosted demos for different usecases.

πŸ’¬ Troubleshooting and Discussions

  • Have a look at our GitHub Discussions to see if anyone has any questions or issues you might be having.
  • Checkout our Troubleshooting Documentation Page to know the common issues and solutions
  • Join our Discord to join our community and get private integration support or help with your integration.

About

Simple infrastructure that enables Web3 wallets and applications to provide seamless user logins for both mainstream and Web3.0 users.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 88.6%
  • CSS 5.6%
  • JavaScript 3.4%
  • HTML 2.4%