Repository navigation
chore: upgrade web3auth to v11 - #47
Conversation
Web3Auth (MetaMask Embedded Wallets) v9 SDKs have been discontinued and can no longer authenticate through the Web3Auth Network. Migrate the social wallet provider to @web3auth/no-modal v11.
There was a problem hiding this comment.
Request changes: the migrated initializer rejects non-hex Gno chain IDs before social login can start. Independently reproduced the existing inline finding: #47 (comment).
On the pinned @web3auth/no-modal@11.4.3, executing both actual initialization validators with chainNamespace: 'other' and defaultChainId: 'gnoland-1' fails with WalletInitializationError 5011 (Please provide a valid defaultChainId in constructor). The OTHER exemption in initChainsConfig() does not apply to the subsequent initCachedConnectorAndChainId() guard. Omitting defaultChainId passes that guard and selects chains[0].chainId. Remove the explicit default and add coverage that reaches both initialization steps; do not replace the real Gno chain ID with a hex alias.
Validation on 55bfcc0d17ca5ce194ab33f899a7a9b0e28aaef8 (local Node 22.23.1): immutable install, 38 Jest suites / 146 tests, build, lint, diff checks and CJS/ESM import smoke passed. Eight focused boundary probes also passed for login parameters, synthetic-key derivation, restored-session handling and fail-closed behavior, but they stubbed initialization and therefore did not establish that init() succeeds. The subsequent real-validator probe reproduced the blocker above. No full dashboard/OAuth login or existing-account address-continuity check was executed; those remain release verification requirements.
- Drop defaultChainId: v11 requires it to be a hex string, so init() threw for Gno chain IDs. Pin the chain list to the Gno chain instead, so dashboard-configured chains cannot become the initial chain and swap the AUTH connector away from the private key provider. - Treat a getUserInfo() failure on a restored session as stale and log in again instead of aborting connect().
…params
- Split web3auth construction from init() and run the real upstream
initChainsConfig() + initCachedConnectorAndChainId() in Jest, with
and without dashboard chains, plus a guard for the non-hex
defaultChainId rejection.
- Send the v9 Auth0 jwtParameters.connection ('twitter') again for
Twitter login so the same identity provider is used.
There was a problem hiding this comment.
Approved on 47a57cb0be1ec2edbf0cbc0743057f3aaae48af3; this supersedes my earlier REQUEST_CHANGES review (5889132593).
The non-hex defaultChainId blocker is fixed. I ran the same offline harness against the built old and new SDKs, retaining the actual SDK factory and pinned upstream chain validators. The old head rejects gnoland-1; the new head omits the default and selects only the Gno other chain with no dashboard chains, an EVM dashboard chain, and a cached EVM chain. The synthetic restored-session failure also changes from aborting login to logout, reinitialization and fresh login. Reviewed the subclass filtering, restored-session fallback, Twitter parameters and both added regression suites; no remaining merge-blocking defect identified.
Validation on this head (Node 22.23.1): immutable install, both affected Jest suites (9 tests), build, lint, diff check and built CJS/ESM imports passed. The complete local Jest run timed out at 120 seconds and its retry timed out at 200 seconds; neither is a full-suite pass. The current GitHub build, lint and unit-test checks were observed successful. Prior source-review evidence was reused only for unchanged paths and dependency inputs.
Limits: the offline harness replaces init transport, OAuth and RPC boundaries; it does not establish full dashboard login or existing-user address continuity. Those remain the documented release checks. This approval is a code-review judgment, not confirmation that social login is deployed or those checks are complete.
Summary
MetaMask Embedded Wallets (Web3Auth) v9 Web SDKs reached end-of-life and have been permanently discontinued. Apps on v9 can no longer authenticate through the Web3Auth Network, so social login via
GnoSocialWalletProvideris currently broken. This PR migrates the SDK to@web3auth/no-modalv11 (the supported Web version), following the migration guide.Changes
Dependencies (
packages/sdk/package.json)@web3auth/no-modal:9.5.3→11.4.3@web3auth/auth-adapter,@web3auth/base,@web3auth/base-provider(merged into@web3auth/no-modalin v10+).viemand@babel/runtime@^7. Both are required (non-optional) peer dependencies of@web3auth/no-modal@11, andviemis imported statically from its main entry.GnoSocialWalletProviderAuthAdapter/configureAdapter/ code-sideloginConfig. In v11 the AUTH connector is registered automatically from the auth connections configured on the dashboard.chains(namespaceother) instead of a hand-builtCommonPrivateKeyProvider. For theothernamespace, v11 creates aCommonPrivateKeyProviderinternally, soprivate_keyexport keeps working.defaultChainIdis not used because v11 requires it to be a hex string, which Gno chain IDs are not.GnoWeb3AuthNoModalsubclass overridesinitChainsConfig()to narrow the list to the Gno chain only.connectTo(WALLET_ADAPTERS.AUTH, { loginProvider })→connectTo(WALLET_CONNECTORS.AUTH, { authConnection, authConnectionId })authConnection:google/twitter/email_passwordlessauthConnectionId: the existingverifierconfig value (v9 verifiers map to dashboard auth connections)connection: 'twitter',domain) throughextraLoginOptions. Email passwordless keepslogin_hint.web3auth.connection.ethereumProvider, becauseweb3auth.provideris write-only in v11.authConnection+authConnectionIdfromgetUserInfo().typeOfLoginno longer exists in v11.getUserInfo()also fetches linked accounts over the network and can throw on a restored session. A failure is treated as a stale session: logout, re-initialize, and log in again.Public types
SocialGoogleConfigure/SocialTwitterConfigure/SocialEmailPasswordlessConfigure: no shape changes (non-breaking).verifieris documented as the dashboard Auth Connection ID.authClientId/googleClientIdare marked@deprecatedbecause they are now configured on the dashboard.SocialUserInfo(getSocialUserProfileresponse): added the v11 fieldsauthConnection,authConnectionId,groupedAuthConnectionId,userId. The v9-only fields (typeOfLogin,verifier,verifierId,aggregateVerifier) are kept as optional and@deprecated.Tests
@web3auth/no-modal@11transitively loads ESM-only packages (@metamask/connect-evmships.mjseven for therequirecondition), and Jest's CJS runtime cannot parse them. Added a Jest-onlymoduleNameMapperstub (src/__stubs__/web3auth-no-modal.ts). Unit tests never call Web3Auth.Required dashboard setup (before release)
v11 resolves login configuration from the Embedded Wallets dashboard instead of code:
verifiervalue passed to the SDK.Verification
yarn lintyarn test: 40 suites / 155 tests passed. Adds restored-session coverage forconnect(), login params, and the real upstreaminitChainsConfig()+initCachedConnectorAndChainId()steps.yarn build. The CJS (bin/index.js) and ESM (bin/index.mjs) bundles both load in Node 24.connectToparams for Google / Twitter / Email passwordless.init()in Node with jsdom. OnlyfetchProjectConfigwas patched, and it returned an EVM dashboard chain. Result:init()succeeds, the current chain is the Gno chain, and the AUTH connector usesCommonPrivateKeyProvider.Notes
@web3auth/no-modal@11declaresengines.node >= 22. The repo already uses Node 24 (.nvmrc).