This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
WIP Draft: support asm.js fallback for non-native non-WASM environments #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note - Not ready for merging yet - still need to translate a bunch of tests for the asm.js version.
Bug? - Unable to write tests for the asm fallback using
jest
. We faced a similar issue trying to write asm.js tests forbbs-signatures
repo - something about jest doesn't load the WASM properly and tests always crash with vague error messages. The tests I'm adding need to be run usingts-node
. For simplicity, I have added the command to thetest
script inpackage.json
so it runs right after thejest
tests.Adds conditional function calls to
BbsBlsSignatureProof2020
to use theasm.js
fallback version inbbs-signatures
repo when being used in react-native (or other non-native non-WASM platforms)Partially solves #57 - Based on the description of #57 - the goal is to have this library work in the browser as well. This PR does not solve that, as it falls back to
bbs-signatures
only ifglobal.WebAssembly
is missing - which is not true for browsers, but will work in non-WASM environments.Description
Instead of importing
blsCreateProof
andblsVerifyProof
fromnode-bbs-signatures
, it imports bothnode-bbs-signatures
andbbs-signatures
(which includes asm.js fallback) and chooses to use whichever one is appropriate based on the environment.Motivation and Context
To be able to utilize this library in React Native
Does this PR introduce a breaking change?