Skip to content

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

Merged
turkycat merged 1 commit intomasterfrom
jdf/remove-tinysecp-from-lib
Apr 3, 2025
Merged

remove tiny-secp256k1 from xpub-lib dependencies, add initEccLib function, require for taproot#67
turkycat merged 1 commit intomasterfrom
jdf/remove-tinysecp-from-lib

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 a team, bertonjulian and Copilot April 3, 2025 00:44
@turkycat turkycat self-assigned this Apr 3, 2025
Copy link

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.

4 participants