Giter VIP home page Giter VIP logo

web3auth-web's Introduction

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 Modal SDK @web3auth/modal: 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 NoModal SDK @web3auth/no-modal: The nomodal module implementing all the Web3Auth features you need and giving you the flexibility of using your own UI with the Web3Auth SDK working in the backend.

โšก Quick Start

Installation (Web3Auth Plug and Play Modal)

npm install --save @web3auth/modal

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/modal";

//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
๐Ÿ  No-Modal
@web3auth/no-modal 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/modal npm version minzip Provides the main class for using default web3auth modal. It inherits @web3auth/no-modal package. So you can still call all the functions available in the @web3auth/no-modal 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-v2-adapter npm version minzip Adds wallet connect v2 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/wallet-services-plugin npm version minzip Allows to inject your web3auth scoped private key into Wallet Services UI
@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 18+

๐Ÿงณ 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 Support

  • Have a look at our Community Portal to see if anyone has any questions or issues you might be having. Feel free to create new topics and we'll help you out as soon as possible.
  • Checkout our Troubleshooting Documentation Page to know the common issues and solutions.
  • For Priority Support, please have a look at our Pricing Page for the plan that suits your needs.

TODO:

  • add default adapter modules
  • whitelabel only at one place

web3auth-web's People

Contributors

arch1995 avatar bboystatix avatar cacampbell avatar chaitanyapotti avatar dependabot[bot] avatar himanshuchawla009 avatar ieow avatar ihsraham avatar lionellbriones avatar metallicalfa2 avatar motxx avatar pgbrandao avatar phuctm97 avatar rinzler99 avatar rtomas avatar sarimarcus avatar saviour1001 avatar shahbaz17 avatar shuoer86 avatar smgv avatar snigdha920 avatar snyk-bot avatar tainguyentt avatar taylorbeeston avatar yashovardhan avatar yeecai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

web3auth-web's Issues

Restrict social logins

Hi guys! I'm struggling to do pretty basic thing - allow only few social media for log in and hide other ones in modal window.
I didn't found any recipe either in documentation nor articles on it.
So I'm modifying react-app example with latest @Web3Auth packages (0.9.3). Here all 14 loginMethods are set for adapter OpenLogin, and this cannot be avoided.
Adding code like this doesn't affect, as well as passing similar config to initModal:

          web3AuthInstance.loginModal.addSocialLogins(EVM_ADAPTERS.OPENLOGIN, {
            google: {
              name: "google",
              showOnModal: true,
              showOnDesktop: true,
              showOnMobile: true,
            },
            facebook: {
              name: "facebook",
              showOnModal: true,
              showOnDesktop: false,
              showOnMobile: true,
              mainOption: true,
              description: "facebook social login",
            },
          }, ['google', 'facebook'])

The reason (according to my debug) is wrong functioning of lodash.deepmerge, it doesn't override existing loginMethods. It happens in @web3auth/ui/src/components/Modal.tsx:62.

Any ideas on how to implement this must-be-simple thing or pointing, what I'm doing wrong, will be quite helpful

Hide all Social login elements.

/packages/ui/src/components/SocialLogins.tsx

In this file, could you please add logic for empty social logins, just hide all of the elements, include "CONTINUE WITH".

openlogin adapter disconnected on hard refresh

Hi,

When logging in with Metamask, hard refreshing doesn't disconnect. Whilst using social login or email link (openlogin), when refreshing the adapter disconnects: i.e. web3auth.connectedAdapterName: null and web3auth.status: ready, instead of openlogin and connected respectively.

Thanks in advance.

@babel/runtime issue

Hi,

Sorry if this is not the right place but I'm not really sure where to report this issue. I'm creating a Next.js app using yarn PnP workspaces (monorepo) and as soon as I try to import @web3auth/web3auth build process fails with this error message:

error - ../.yarn/__virtual__/@toruslabs-base-controllers-virtual-3b88d48747/0/cache/@toruslabs-base-controllers-npm-1.6.3-9d8d665e41-654630130b.zip/node_modules/@toruslabs/base-controllers/dist/baseControllers.esm.js:1:0
Module not found: @toruslabs/base-controllers tried to access @babel/runtime (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: @babel/runtime
Required by: @toruslabs/base-controllers@virtual:3a7ee52a0b56322830850ebe6918747c0f3521e5f17b6f8a246dd611d5c20ba079dad34ecc7f48fd5737401f6af51dcf99cda685b477295ae3cd82a6c7d2f706#npm:1.6.3 (via /Users/robert/WebstormProjects/fqx/.yarn/__virtual__/@toruslabs-base-controllers-virtual-3b88d48747/0/cache/@toruslabs-base-controllers-npm-1.6.3-9d8d665e41-654630130b.zip/node_modules/@toruslabs/base-controllers/dist/)

Ancestor breaking the chain: @web3auth/openlogin-adapter@npm:0.3.1
Ancestor breaking the chain: @web3auth/phantom-adapter@npm:0.3.1
Ancestor breaking the chain: @web3auth/torus-solana-adapter@npm:0.3.1
Ancestor breaking the chain: @web3auth/wallet-connect-v1-adapter@npm:0.3.1

Import trace for requested module:
../.yarn/__virtual__/@web3auth-ethereum-provider-virtual-838e20da5e/0/cache/@web3auth-ethereum-provider-npm-0.3.1-61bfc93942-a4837ba2f9.zip/node_modules/@web3auth/ethereum-provider/dist/ethereumProvider.esm.js
../.yarn/cache/@web3auth-openlogin-adapter-npm-0.3.1-37a0171cb7-2547e918fe.zip/node_modules/@web3auth/openlogin-adapter/dist/openloginAdapter.esm.js
../.yarn/__virtual__/@web3auth-web3auth-virtual-59d7e0ed5a/0/cache/@web3auth-web3auth-npm-0.3.2-c02e4b8850-1d1ef366bb.zip/node_modules/@web3auth/web3auth/dist/web3auth.esm.js
./components/Web3/Web3.tsx
./pages/index.tsx

I've installed @babel/runtime but it didn't resolve the issue. However, if I try importing @toruslabs/base-controllers directly instead of @web3auth/web3auth then it works.

Modal UI causes semantic and accessibility issues

We are currently integrating web3auth into our website. However we have come across an issue where due to the modal content being injected onto the page this is causing some semantic issues for our html which could effect SEO rankings.

For example the Header component includes a <h1> element and as our content already has an <h1> element this fails our html validation and accessibility checks when checking the rendered markup for the entire page. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements#multiple_h1_elements_on_one_page

Initially I thought a solution would be to simply change the element to a <h2>. However for a more robust solution would it be possible to wrap the modal content in a <section> element as suggested in the link above as the modal is always likely to be secondary to the main content on the page?

All examples demos are fail to run

all examples next-app, react-app, vue-app are fail when run

ex react-app

cd Web3Auth/examples/react-app
$ npm i
$ npm run start

as a test to play with web3auth I only fix the minor issue in react-app, to fix replace

  return loaded ? user ? renderAuthenticated() : renderUnauthenticated() : <h1>Loading....</h1>;
  return !isLoading
    ? user ? renderAuthenticated() : renderUnauthenticated()
    : <h1>Loading....</h1>;

thanks for this awesome project

Got " 'Window': #<Object> could not be cloned. " at web3auth.initModal()

Hello,

I'm trying to integrate web3Auth Authentication within a VueJS Web App.

I'm using a custom clientId and I whitelisted the URLs that I want to access for the page. (http://localhost:8080 in my case)

Upon calling await this.web3auth.initModal(); I get this error
openloginJrpc.esm.js?fd97:991 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': #<Object> could not be cloned. at PostMessageStream._postMessage (webpack-internal:///./node_modules/@toruslabs/openlogin-jrpc/dist/openloginJrpc.esm.js:1026:24) at PostMessageStream._write (webpack-internal:///./node_modules/@toruslabs/openlogin-jrpc/dist/openloginJrpc.esm.js:165:10) at doWrite (webpack-internal:///./node_modules/@toruslabs/openlogin-jrpc/node_modules/readable-stream/lib/_stream_writable.js:409:139) at clearBuffer (webpack-internal:///./node_modules/@toruslabs/openlogin-jrpc/node_modules/readable-stream/lib/_stream_writable.js:526:7) at PostMessageStream.Writable.uncork (webpack-internal:///./node_modules/@toruslabs/openlogin-jrpc/node_modules/readable-stream/lib/_stream_writable.js:321:94) at PostMessageStream._onData (webpack-internal:///./node_modules/@toruslabs/openlogin-jrpc/dist/openloginJrpc.esm.js:127:14) at PostMessageStream.onMessage (webpack-internal:///./node_modules/@toruslabs/openlogin-jrpc/dist/openloginJrpc.esm.js:157:10)

Do you have an idea on what is causing this issue ?

Thanks a lot!
Alexandru Gherghe

Specified gasPrice Issue

If you connect metamask in openlogin, it works normally with the same settings, but if you use torus wallet, this error appears.

chunk-vendors.92e40d68.js:32 Uncaught (in promise) Error: Invalid transaction params: specified gasPrice but also included maxFeePerGas, these cannot be mixed

The chain setting proceeded as follows.
Network Name: Klaytn Baobab
New RPC URL: https://api.baobab.klaytn.net:8651
Block Explorer URL: https://baobab.scope.klaytn.com/
Chain ID: 1001 (0x3e9)
photo_2022-04-27 14 03 30

update docs and examples to use existing "enums" instead of hardcoded strings

It seems that internally base and core are using constants from here:
https://github.com/Web3Auth/Web3Auth/blob/master/packages/base/src/adapter/IAdapter.ts#L51

I feel that it would be better form to use these constants (or even better, actual ts enums) in the example code and the docs instead of the hardcoded strings:

https://github.com/Web3Auth/Web3Auth/blob/118c0b8d405f2bf8fb1794a8b3221c8a0bf6d42c/examples/getting-started/eth/index.html#L51-L54

could look like:

web3auth.on(ADAPTER_STATUS.CONNECTED, (data) => {
                console.log("Yeah!, you are successfully logged in", data);
});

Hide some more actions in TorusWalletConnectorPlugin

As a developer
I want to custom torus wallet display styles.
So that
Torus wallet can be more uniform and consistent with the website style
Expect
1, Currently wallet icon can be change to another, but the background is always blue (background-color: var(--v-torusBrand1-base)!important;), I need to change change the color to fit my site.
2, Sometimes I donot want user have too many additional actions๏ผŒso, does any way to hide "Transfer", "Topup", "Open Wallet" operations, I my site, user can just got the wallet address and sign message. of curse "topupHide" is working well now.

image

Wrong Re-Hydration of user info when using email as login method

When: After a successful login, using OpenLogin adapter, on a page refresh

What happens: the userInfo object ( obtained by using web3Auth.getUserInfo() ) contains typeOfLogin "google" with any email. The same field value was "jwt" right after the first login.

What is expected: that the userInfo info object is consistent at every web3Auth re-hydration, in this case I alway expect the field typeOfLogin, to be "jwt" (the same value I got at the first login)

Additional data:

  • aggregateVerifier: "tkey-auth0-email-passwordless-lrc"
  • verifier: "torus"
  • browser info: {"browser":{"name":"Chrome","version":"100.0.4896.75"},"os":{"name":"Linux"},"platform":{"type":"desktop"},"engine":{"name":"Blink"}}

Missing provider in mobile browser using OpenLogin adapter

The issue from couple of days ago still persists in mobile browsers. In responsive mode on chrome desktop the provider is now set, but on mobile safari for example it is always null when using OpenLogin adapter (individual buttons for google, apple and email). The same problem appears on your demo page.

Torus Wallet with error "We're sorry but app doesn't work properly without javascript enabled. Please enable it to continue."

Describe the bug

I my site, sometimes when I want to pay with torus wallet, but got a block page.

To Reproduce

Steps to reproduce the behavior:

1, Write code to Send transaction:

     await this.provider.request({
        method: 'eth_sendTransaction',
        params: [{
          from: _from,
          to,
          value: _value,
          data: _data,
          gas: Web3.utils.numberToHex('25000')
        }]
      })

2, click 'Send Transaction'
3, Page redirect success, but without any information.
4, from console page, see the error: We're sorry but app doesn't work properly without javascript enabled. Please enable it to continue.

Expected behavior

Transaction page display.

Screenshots

image
image

Device Info (please complete the following information):

  • Device: Desktop
  • OS: Windows 11
  • Browser: Chrome
  • Version: 100.0.4896.75
  • Web3Auth Version: 1.0.0-alpha.0

On some user devices we see endless loading on a modal

On some user devices, we see endless loading on a modal, If the same user tries using open login in incognito mode of chrome browser. Things work fine. So I am wondering it has something to do with stored information on the device.

Question: Where can I find Web3Auth class implementation

Hi, In example from main README.md file we have:

const web3auth = new Web3Auth({
 chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
 clientId: "localhost-id" // get your clientId from https://developer.web3auth.io
 });

But I couldn't find implementation for Web3Auth constructor in the source code. Can someone point out too the file?
I'm not really sure if it's correct place to ask the question but I would appreciate the help :d

Overlapping feedback components display

Describe the bug

A feedback component is display over wallet icon.

To Reproduce

Steps to reproduce the behavior:

  1. Login to torus
  2. show wallet icon

Expected behavior

there is no feedback component display.

Screenshots

image
image
image

Device Info (please complete the following information):

  • Device: Chrome
  • OS: Windows 10
  • Browser Chrome
  • Version 101.0.4951.67
  • Web3Auth Version 1.0.0

Additional context

after web3auth upgrade from 1.22.6 (https://app.tor.us/v1.22.6) to 1.23.0 (https://app.tor.us/v1.23.0), this issue occured.

Authentication with OpenloginAdapter does not persist across browser tabs

When you login using the popup OpenloginAdapter (be it social login or metamask login) you only remain authenticated as long as you stay inside 1 browser tab. If your application contains target _blank links (within the same domain) you are logged out and you need to login again for that browser tab.

Desired behaviour:
Persist authentication across browser tabs if the application domain is the same.

setup :

const adapter = new OpenloginAdapter({ adapterSettings: { network: process.env['NEXT_PUBLIC_BLOCKCHAIN_NETWORK'] === 'mainnet' ? 'mainnet' : 'testnet', clientId, uxMode: 'popup', }, });

Error: Invalid network, net_version is: '97'

Issue

I'm trying to use the Web3Auth (web) to integrate sign-in in my application. I've connected to the Binance Testnet Chain in the config, but while trying to login with the Magic link and the social logins, I get the following error:
image

Repo for reproduction

Here's a repo I created which reproduces the issues along with how to run the repo and details on the issue I found during my investigation: https://github.com/snigdha920/web3-auth

Torus wallet network with TorusWalletConnectorPlugin has an unexpect performance.

Hello, Web3auth, there is a question about torus wallet network.

when I add TorusWalletConnectorPlugin, the torus wallet network is shown as https://goerli.infura.io/v3/776218ac4734478c90191dde8cae483c, I want to shown as default "Goerli Test Network", so what should I do for this purpose.

const ethChainConfig: Partial<CustomChainConfig> & Pick<CustomChainConfig, "chainNamespace"> = {
  chainNamespace: CHAIN_NAMESPACES.EIP155,
  chainId: "0x5",
  ticker: "ETH",
  tickerName: "Ethereum",
};

image

Mocking private keys for subjects locally

Wasn't able to tunnel my localhost OAuth2 OIDC service correctly, so the Web3Auth verifiers could connect to it. Came up with a stupid simple mock for private keys based on OAuth2 subjects. Feel free to copy it into your code, but never use this in prod.

function mockPrivateKeyForSubject(subject: string) {
  const pkey = localStorage.getItem(`mock:privateKey:${subject}`);
  if (pkey) return pkey;
 
  const account = new Web3().eth.accounts.create();
  localStorage.setItem(`mock:privateKey:${subject}`, account.privateKey);
  return account.privateKey;
}

Usage:

  1. Implement where you handle your OAuth callback
  2. Check environment to be local and continue with Web3Auth if not
  3. In case of local env call mockPrivateKeyForSubject(user.profile.sub) and continue with your pkey as you would with the one from Web3Auth

Can't use method send With Smart Contracts Web3

Hello,

I use web3Auth Authentication and config custom chain can get wallet address.
then i use web3.eth.Contract can get method call but not working method send show error
image

image

What should I do this issue?

Disable logging

The package writes a lot to logs, I should have the option to disable logging or have much less verbose logging when initializing.

Wallet Connect adapter doesn't work with web3auth core sdk

Using wallet connect with web3auth is flawless. Using wallet connect with web3auth core doesn't seem to work. I was expecting the QR code modal to show when I call connectTo function, however, it doesn't show and I see that's because QRCode is set to false in the adapter.

Adapter Phantom: signMessage doesn't work as expected

I've been implementing Web3Auth in my app. All worked smoothly but while I was trying to use Phantom as an external wallet it wasn't working. I've been debugging and I'll show you why and how I manage to 'hack fix' the bug.

When I call signMessage from my UI I'm calling your code inside the solana provider package.

This function from solana-provider/src/solanaWallet:
image

The problem was that when I was calling that method with my Phantom wallet connected I was receiving this output:
image

I wasn't receiving a Uint8Array as expected. So I started to check the code behind window.solana.signMessage which is the code used by the solana-adapter-* sdk. I found this:
image

That code basically first request the user to sign the message and after receiving the signature, it's decoded from base58 to Uint8Array.

So in my code to be able to handle the Phantom response using Web3Auth I've done the following:
image

It seems to be an incompatibility in the interface between phantom and web3auth's wallet.

Error: Cannot find module '@babel/plugin-syntax-bigint' when building project

Steps

  1. Cloned repo
  2. npm run bootstrap
  3. npm run build

First error:

lerna notice cli v4.0.0
lerna info Executing command in 13 packages: "yarn run build"
@web3auth/base: yarn run v1.22.17
@web3auth/base: $ rimraf dist/ && torus-scripts build
@web3auth/base: /bin/sh: torus-scripts: command not found
@web3auth/base: error Command failed with exit code 127.
@web3auth/base: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn run build exited 127 in '@web3auth/base'
  1. npm i -g @toruslabs/torus-scripts
  2. npm run build
$ rimraf dist/ && torus-scripts build
@web3auth/base: /Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/plugins.js:139
@web3auth/base:   throw error;
@web3auth/base:   ^
@web3auth/base: Error: Cannot find module '@babel/plugin-syntax-bigint'
@web3auth/base: Require stack:
@web3auth/base: - /Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/plugins.js
@web3auth/base: - /Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/index.js
@web3auth/base: - /Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/index.js
@web3auth/base: - /Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/config/rollup.config.js
@web3auth/base: - /Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/scripts/build.js
@web3auth/base:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
@web3auth/base:     at resolve (internal/modules/cjs/helpers.js:94:19)
@web3auth/base:     at tryRequireResolve (/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/plugins.js:157:9)
@web3auth/base:     at resolveStandardizedNameForRequrie (/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/plugins.js:195:19)
@web3auth/base:     at sync (/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/plugins.js:224:12)
@web3auth/base:     at sync (/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/gensync/index.js:182:19)
@web3auth/base:     at /Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/gensync/index.js:210:24
@web3auth/base:     at Generator.next (<anonymous>)
@web3auth/base:     at resolvePlugin (/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/plugins.js:83:17)
@web3auth/base:     at resolvePlugin.next (<anonymous>) {
@web3auth/base:   code: 'MODULE_NOT_FOUND',
@web3auth/base:   requireStack: [
@web3auth/base:     '/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/plugins.js',
@web3auth/base:     '/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/config/files/index.js',
@web3auth/base:     '/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/node_modules/@babel/core/lib/index.js',
@web3auth/base:     '/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/config/rollup.config.js',
@web3auth/base:     '/Users/adrienblavier/.nvm/versions/node/v14.17.0/lib/node_modules/@toruslabs/torus-scripts/scripts/build.js'
@web3auth/base:   ]
@web3auth/base: }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn run build exited 1 in '@web3auth/base'

As you can see I run node v14.17.0. Anything obvious I am missing here?

Can't sign transactions with social login wallet

I've integrated web3auth into my Solana web app. I'm able to connect with a social login on the home page of the modal and the Torus Wallet under "External Wallet" via my google login. I'm able to sign transactions with Torus which seems to work great.

However, when I connect using the social login on the home page of the modal, it successfully connects but when I go to sign a transaction with the wallet using signTransaction I get the error: Error: Transaction fee payer required.

Since the Torus integration works, I think I am specifying a fee payer correctly, something isn't getting configured right now the web3auth side.

react examples failed to run

Getting this error when trying to run the react-app and custom-ui-react-app examples

Error: NormalModuleFactory.resolve (NormalModuleFactory) is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created. Returning a Module object will result in this module used as result.

How to disable log?

Hi, I used the web3auth modal, but I don't know how to disable the console log.
web3auth

Vue3 is not compatible for web3auth

just create vue3 project (via Vite) and add following codes.


import { Web3Auth } from "@web3auth/web3auth"
import { CHAIN_NAMESPACES } from "@web3auth/base"

const web3auth = new Web3Auth({
  chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
  clientId: "815138507228-0qmlub6bcdroj6jc7qam40g87gclmohn.apps.googleusercontent.com"
})

await web3auth.initModal();

then, error occured

_stream_readable.js:48 Uncaught ReferenceError: global is not defined
    at node_modules/@toruslabs/openlogin-jrpc/node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:48:21)
    at __require2 (chunk-SULJOONQ.js?v=767cbc63:48:44)
    at node_modules/@toruslabs/openlogin-jrpc/node_modules/readable-stream/readable-browser.js (readable-browser.js:1:28)
    at __require2 (chunk-SULJOONQ.js?v=767cbc63:48:44)
    at defineProperty.js:13:10

Is there any workaround?

OpenLogin "disconnects" when refreshing the page on mobile browser

When we use the OpenLogin adapter on our website after a successful login we get redirected to the next page. When in desktop mode everything works correctly, the connectedAdapterName is shown as 'openlogin' and trying to log the web3Auth.provider in our code prints out Proxy {} in the console.
Screenshot 2022-04-06 at 16 47 06

If we don't change anything, but simply toggle the responsive mode in google chrome and select iPhone XR as the device, upon refreshing the page we can see that the connectedAdapterName becomes null and web3Auth.provider also prints null to the browser console. This happens every single time and if we switch back to the desktop mode (without going through the login process, just switch to desktop and refresh) everything start working again, so it seems like the mobile browser is the issue.
Screenshot 2022-04-06 at 16 46 50

ReferenceError: window is not defined

I have a Next.js project, and I want to integrate web3auth there.
I am having this error when I am trying to initialize from client side of next app.

if (typeof window !== undefined) {
  const web3auth = new Web3Auth({
    chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155, chainId: "0x3" },
    authMode: "DAPP",
    clientId: "example-client-id", // get your client id from developer dashboard
  });

  console.log(web3auth);
}

image

Getting "TypeError: _this.showExternalWallets is not a function" Error

Steps to recreate:

  1. Create a Next js app.
  2. Create a Component to hold all Web3Auth related actions.
    import {useRouter} from "next/router";
    import { Web3Auth } from "@web3auth/web3auth";
    import { ADAPTER_EVENTS, CHAIN_NAMESPACES } from "@web3auth/base";
    import { LOGIN_MODAL_EVENTS } from "@web3auth/ui";
    import React, { useEffect, useState } from "react";

import Button from '@mui/material/Button';
import Image from "next/image";

function Login() {
const [user, setUser] = useState(null);
const [web3auth, setWeb3auth] = useState(null);
const [loaded, setLoaded] = useState(false);
const [subscribed, setSubscribed] = useState(false);
useEffect(() => {
console.log("useEffect");

    const subscribeAuthEvents = (web3auth) => {
        console.log("subscribeAuthEvents ", subscribed);

        if (subscribed) {
            return;
        }
        web3auth.on(ADAPTER_EVENTS.CONNECTED, (data) => {
            debugger;
            console.log("Yeah!, you are successfully logged in", data);
            setUser(data);
        });

        web3auth.on(ADAPTER_EVENTS.CONNECTING, () => {
            debugger;
            console.log("connecting");
        });

        web3auth.on(ADAPTER_EVENTS.DISCONNECTED, () => {
            debugger;
            console.log("disconnected");
            setUser(null);
        });

        web3auth.on(ADAPTER_EVENTS.ERRORED, (error) => {
            debugger;
            console.log("some error or user have cancelled login request", error);
        });

        web3auth.on(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, (isVisible) => {
            debugger;
            console.log("modal visibility", isVisible);
        });

        setSubscribed(true);
    };

    const polygonMumbaiConfig = {
        chainNamespace: CHAIN_NAMESPACES.EIP155,
        rpcTarget: "your rpc target",
        blockExplorer: "https://mumbai-explorer.matic.today",
        chainId: "0x13881",
        displayName: "Polygon Mumbai Testnet",
        ticker: "matic",
        tickerName: "matic",
    };

    const web3auth = new Web3Auth({
        chainConfig: polygonMumbaiConfig,
        clientId: "your client id",
    });

    setWeb3auth(web3auth);

    // โญ๏ธ initialize modal on page mount.
    const initializeModal = async () => {
        console.log("initializeModal");
        subscribeAuthEvents(web3auth);
        await web3auth.initModal();
        setLoaded(true);
    };
    initializeModal();
}, [subscribed]);

const login = async () => {
    debugger;
    if (!web3auth) return;
    const provider = await web3auth.connect();
    // TODO: add this provider to web3/ethers
    debugger;
};
const logout = async () => {
    if (!web3auth) return;
    await web3auth.logout();
};
const getUserInfo = async () => {
    debugger;
    if (!web3auth) return;
    const userInfo = await web3auth.getUserInfo();
    console.log(userInfo);
};

const renderUnauthenticated = () => {
    return (
        <div>
            <Button variant="contained" onClick={login}>
                LOGIN
            </Button>
        </div>
    );
};

const renderAuthenticated = () => {
    return (
        <div className="App">
            <Button variant="contained" onClick={logout}>
                LOG OUT
            </Button>
            <Button variant="contained" onClick={getUserInfo}>
            </Button>
        </div>
    );
};
return loaded && user ? renderAuthenticated() : renderUnauthenticated();

}
export default Login;
3. Create a Home component added the login component as dynamic component
import React, { useEffect } from "react";
import { Box, Button } from "@mui/material";
import { useRouter } from "next/router";
import Image from "next/image";
import dynamic from 'next/dynamic'

const DynamicComponentWithNoSSR = dynamic(
() => import('../components/Login'),
{ ssr: false }
)

function Home() {
useEffect(() => {
window.scrollTo(0, 0);
}, []);

const router = useRouter();

return (
<Box
sx={{
height: "85vh",
opacity: 0.9,
filter: "brightness(0.9)",
position: "relative",
top: 0,
zIndex: 0,
display: "flex",
justifyContent: "center",
alignContent: "center",
alignItems: "center",
bgcolor: "black",
flexDirection: "column",
}}
>

  <Button onClick={() => router.push("/dashboard")}>
    <Image
      src="/images/logo.png"
      width="100%"
      height="100%"
      priority="true"
    />
  </Button>
  <DynamicComponentWithNoSSR />
</Box>

);
}

export default Home;
4. When we run the project and click on login button getting error:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.