Skip to content
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

Use Buffer polyfill for the browser #87

Open
Janaka-Steph opened this issue Nov 28, 2022 · 4 comments
Open

Use Buffer polyfill for the browser #87

Janaka-Steph opened this issue Nov 28, 2022 · 4 comments

Comments

@Janaka-Steph
Copy link

Node Buffer only works in the browser with a polyfill, it is not good practice to expect the client to have it. Also it should fix an issue we have with Cypress on tdex-app.
From my research we can use this one for browser https://github.com/feross/buffer. We check the environment and use this lib or Node Buffer accordingly.

@tiero @louisinger

@tiero
Copy link
Member

tiero commented Nov 28, 2022

We follow BitcoinJs here, so not sure if makes sense to diverge.

I guess the rationale behind is that BitcoinJS maintainers do not need to be responsible for polyfills of others and let users do the appropriate due diligence?

@Janaka-Steph
Copy link
Author

I think it's also that JS developers took the bad habit to rely on Webpack polyfills

@tiero
Copy link
Member

tiero commented Dec 15, 2022

The "modern" way would be to move to Uint8Array, where Buffer is a superset now. I am a bit afraid to diverge from bitcoinJS

@bordalix
Copy link

bordalix commented Mar 2, 2023

It's not working with React Native due to this.

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

No branches or pull requests

3 participants