Skip to content

remove tiny-secp256k1 from xpub-lib dependencies, add initEccLib function, require for taproot #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2025

Conversation

turkycat
Copy link
Contributor

@turkycat turkycat commented Apr 3, 2025

Some projects, like vite-based web applications, have issues with tiny-secp256k1 v2 and up being included in the dependency tree since this relies on web assembly (wasm) dependencies. Wasm dependencies must be imported asynchronously which makes use of xpub-lib difficult in these environments.

This change models bitcoinjs-lib and requires the ECC library to be initialized before use.

@turkycat turkycat requested review from bertonjulian, a team and Copilot April 3, 2025 00:44
@turkycat turkycat self-assigned this Apr 3, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the direct dependency on tiny‑secp256k1 from xpub‑lib and introduces an explicit initialization function for the ECC library to support asynchronous WASM import environments, similar to bitcoinjs‑lib’s handling.

  • Removed the direct import and initialization of tiny‑secp256k1 from xpub‑lib.
  • Added an initEccLib function in xpub‑lib to allow consumers to initialize the ECC library as needed.
  • Updated xpub‑cli to import and initialize the ECC library before using taproot functionality.

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/xpub-lib/src/derivation.js Removed direct dependency on tiny‑secp256k1 and added initEccLib.
packages/xpub-cli/src/xpub.js Updated to call initEccLib with an imported instance of tiny‑secp256k1.
Files not reviewed (2)
  • packages/xpub-cli/package.json: Language not supported
  • packages/xpub-lib/package.json: Language not supported

@turkycat turkycat force-pushed the jdf/remove-tinysecp-from-lib branch 2 times, most recently from bca7b11 to f5b55eb Compare April 3, 2025 00:48
@turkycat turkycat force-pushed the jdf/remove-tinysecp-from-lib branch from f5b55eb to 62d0f19 Compare April 3, 2025 01:16
@turkycat turkycat force-pushed the jdf/remove-tinysecp-from-lib branch from 62d0f19 to af494b3 Compare April 3, 2025 01:38
@turkycat turkycat merged commit dad4dfc into master Apr 3, 2025
1 check passed
@turkycat turkycat deleted the jdf/remove-tinysecp-from-lib branch April 3, 2025 13:28
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