Skip to content

chore: update metadata helpers#311

Merged
chaitanyapotti merged 17 commits intomasterfrom
chore/update-metadata-helpers
Mar 5, 2026
Merged

chore: update metadata helpers#311
chaitanyapotti merged 17 commits intomasterfrom
chore/update-metadata-helpers

Conversation

@lwin-kyaw
Copy link
Contributor

@lwin-kyaw lwin-kyaw commented Mar 5, 2026

Jira Link

Description

Update @toruslabs/metadata-helpers to v8.2.0 and consolidate crypto utilities

Summary

Upgrade @toruslabs/metadata-helpers from ^8.1.0 to ^8.2.0 across all packages and consolidate cryptographic utility imports to use it as the single source of truth. This also bumps @toruslabs/customauth to ^22.2.0.

Motivation

Several crypto utility functions (hexToBigInt, secp256k1, keccak256, bytesToNumberBE, concatBytes, numberToBytesBE, mod, etc.) were previously imported from multiple sources — @noble/curves, @toruslabs/torus.js, or defined locally. The new @toruslabs/metadata-helpers@^8.2.0 re-exports all of these, allowing us to remove redundant direct dependencies and local utility definitions.

Changes

Dependency cleanup — removed direct dependencies where no longer needed:

  • @noble/curves removed from common-types, core, security-questions, seed-phrase, share-transfer
  • @toruslabs/torus.js removed from common-types, core, storage-layer-torus
  • @toruslabs/metadata-helpers added to private-keys, seed-phrase, service-provider-torus (previously only used transitively)

Source code consolidation:

  • Replaced all @noble/curves/utils.js and @noble/curves/secp256k1.js imports with @toruslabs/metadata-helpers
  • Replaced keccak256 / toChecksumAddress imports from @toruslabs/torus.js with keccak256 / getChecksumAddress / keccak256Bytes from @toruslabs/metadata-helpers
  • Removed locally defined hexToBigInt from Point.ts — now exported from @toruslabs/metadata-helpers
  • Removed locally defined stripHexPrefix from utils.ts — replaced with add0x or direct usage from @toruslabs/metadata-helpers
  • Removed re-export of secp256k1 from common-types/src/utils.ts
  • Updated concatBytes call sites to use the new array signature: concatBytes([a, b, c])
  • Replaced BigInt(0x${...}) patterns with hexToBigInt(...) throughout

Tests:

  • Updated all test imports to use @toruslabs/metadata-helpers
  • Expanded common-types test coverage with new tests for utility functions (encrypt/decrypt, generateAddressFromPublicKey, bigIntReplacer, isEmptyObject, isErrorObj, etc.)
  • Fixed type annotations (e.g., shareCommitment: Point[])

Packages affected

common-types, core, default, private-keys, security-questions, seed-phrase, service-provider-base, service-provider-sfa, service-provider-torus, share-serialization, share-transfer, storage-layer-torus

How has this been tested?

Screenshots (if appropriate)

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.

@socket-security
Copy link

socket-security bot commented Mar 5, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • @toruslabs/torus.js@17.1.0

View full report

@lwin-kyaw
Copy link
Contributor Author

lwin-kyaw commented Mar 5, 2026

@SocketSecurity ignore npm/@toruslabs/torus.js@17.1.0

@toruslabs/torus.js provide functions to integrate with the torus backend servers.

@lwin-kyaw lwin-kyaw force-pushed the chore/update-metadata-helpers branch from f3ecd38 to 5c67fc2 Compare March 5, 2026 11:15
Copy link
Contributor

@arch1995 arch1995 left a comment

Choose a reason for hiding this comment

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

lgtm

@chaitanyapotti chaitanyapotti merged commit 1331798 into master Mar 5, 2026
3 of 7 checks passed
@chaitanyapotti chaitanyapotti deleted the chore/update-metadata-helpers branch March 5, 2026 11:21
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.

3 participants