Skip to content

chore: stack upgrade#29

Open
hieu-w wants to merge 15 commits intomainfrom
chore/stack-upgrade
Open

chore: stack upgrade#29
hieu-w wants to merge 15 commits intomainfrom
chore/stack-upgrade

Conversation

@hieu-w
Copy link
Copy Markdown
Member

@hieu-w hieu-w commented Mar 9, 2026

Motivation and Context

Modernize the web3auth-backend Node SDK by upgrading dependencies, migrating the test framework, replacing ethers with viem, removing Node.js Buffer polyfills, and adding CI and code ownership configuration.

Jira Link:
https://consensyssoftware.atlassian.net/browse/EMBED-29

Description

Test framework migration: Mocha + Chai → Vitest

  • Removed .mocharc.json, babel.config.js, and test/setup.mjs
  • Added vitest.config.mts with verbose reporter and istanbul coverage
  • Rewrote test assertions from Chai (expect(...).to.equal(...)) to Vitest (expect(...).toBe(...))

ethers → viem

  • Replaced ethers (Wallet, JsonRpcProvider) with viem (createWalletClient, privateKeyToAccount, http)
  • Updated WalletResult EIP155 signer type from Wallet to WalletClient

Buffer polyfill removal

  • Buffer.from(..., "base64")Uint8Array.from(atob(...), (c) => c.charCodeAt(0))
  • Buffer.from(..., "utf8")new TextEncoder().encode(...)

Utility update

  • safeatobbase64toJSON from @web3auth/auth

Dependency version bumps

  • Bumped all @toruslabs/*, @web3auth/*, @solana/*, @segment/* to latest majors
  • Removed Babel-related packages, mocha, chai, tsx, tsconfig-paths
  • Added vitest, @toruslabs/torus-scripts
  • Node engine: >=20.x>=22.x; npm: >=9.x>=10.x
  • Build script: rimraf dist/ && tsctorus-scripts build
  • Lint script: eslint --fix 'src/**/*.ts'torus-scripts lint src test

CI & CODEOWNERS

  • Added .github/workflows/ci.yml (Build, Test & Lint on push, Node 24.x)
  • Added .github/CODEOWNERS with @torusresearch/Admins fallback and @torusresearch/Web3Auth-Product for source/test

ESLint config

  • Removed mocha/no-setup-in-describe rule
  • Added import/no-extraneous-dependencies: off for test and config files

How has this been tested?

  • Migrated existing integration tests to Vitest and verified they pass against live Torus nodes
  • Tests cover: EIP155 wallet creation with signer, aggregate login with signer, and Solana login with TransactionSigner
  • Build and lint verified locally via npm run build and npm run lint

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code requires a db migration.

Note

Medium Risk
Moderate risk due to CI/build pipeline and Node version baseline changes, which can surface environment-specific failures across packages. No runtime/auth logic is changed in this diff, but the new JWT_PRIVATE_KEY secret requirement can break tests if not configured.

Overview
Adds repo-level automation and ownership controls. Introduces .github/workflows/ci.yml to run build, lint, and test on push using Node 24.x, passing JWT_PRIVATE_KEY from GitHub secrets, and adds a CODEOWNERS policy with admin/product ownership.

Updates local/tooling configs. Adds .env.example for test setup, bumps .nvmrc to >=24.x, removes legacy .mocharc.json and babel.config.js, tweaks eslint.config.mjs to drop Mocha-specific rules and disable import/no-extraneous-dependencies for tests/config, and slightly tightens .gitignore/.npmignore cache entries.

Written by Cursor Bugbot for commit de003e6. This will update automatically on new commits. Configure here.

@hieu-w hieu-w force-pushed the chore/stack-upgrade branch from cf9bd85 to d960dd3 Compare March 9, 2026 17:22
@hieu-w
Copy link
Copy Markdown
Member Author

hieu-w commented Mar 9, 2026

* @torusresearch/Admins

# Product code
**/src/ @torusresearch/Web3Auth-Product
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be web3auth

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fix this, however team @Web3auth/Web3Auth-Admins not existed in Web3auth org, so we need create it.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

* @Web3auth/Web3Auth-Admins

# Product code
src/ @Web3auth/Web3Auth-Product
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to use the lerna based folder structure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants