vechain-sdk-js
vechain-sdk-js copied to clipboard
Browser compatibility
Improve browser compatibility.
As a user I want to create browser app that use SDK as dependency.
Issues:
- Issues with webassembly for solc compiler
- Some libraries issues (fs,...) -> Proper configure web pack or remove exporting of this libraries
Evaluate https://github.com/browserslist/browserslist
Dependency on #331 and findings of #634
Defining as
- pure : the code agnostic if running in nodejs or in a browser without additional component to adapt runtime to nodejs.
- secure : the code we can demonstrate algorithms are cryptographically secure and libraries passed a secure audit.
The code in the repo https://github.com/vechain/vechain-sdk-js/tree/712-derive-public-key-from-wallet-extended-public-key-without-elliptic-library is pure and secure for
- packages/core/src/bloom/bloom.ts
- packages/core/src/hash/blake2b256.ts
- packages/core/src/hash/keccak256.ts
- packages/core/src/hash/sha256.ts
The code at https://github.com/vechain/vechain-sdk-js/tree/666-address-pure-and-secure is pure and secure for
- packages/core/src/address/address.ts
The code at https://github.com/vechain/vechain-sdk-js/tree/666-pure-and-secure-bip32-hdnode is pure and secure for
- packages/core/src/hdnode/hdnode.ts
- packages/core/src/mnemonic/mnemonic.ts
The code at https://github.com/vechain/vechain-sdk-js/tree/666-pure-and-secure-utils-data is pure and secure for
- packages/core/src/utils/data/data.ts
The code in packages/core/src/utils/const/data.ts
substitute ZERO_BUFFER
based on NodeJS Buffer
with ZERO_BYTES
based on pure JS Uint8Array
.
Link to polyfills potential solution https://github.com/paulmillr/noble-hashes/issues/48
@rodolfopietro97 what are the problems you still see with NextJS?
cc @Valazan
Seems that compatibility was achieved, there are residual issues to be analysed more in depth but related to the test environment (jest).
Relates to : #978
Evaluate browser list in a second moment (not HP) @victhorbi