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

Closed
wants to merge 4 commits into from

Conversation

haardikk21
Copy link
Contributor

@haardikk21 haardikk21 commented Jul 11, 2020

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 for bbs-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 using ts-node. For simplicity, I have added the command to the test script in package.json so it runs right after the jest tests.

Adds conditional function calls to BbsBlsSignatureProof2020 to use the asm.js fallback version in bbs-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 if global.WebAssembly is missing - which is not true for browsers, but will work in non-WASM environments.

Description

Instead of importing blsCreateProof and blsVerifyProof from node-bbs-signatures, it imports both node-bbs-signatures and bbs-signatures (which includes asm.js fallback) and chooses to use whichever one is appropriate based on the environment.

  • Tests for the changes have been added (for bug fixes / features)
  • The commit message(s) follow conventional commits
  • Documentation has been added / updated (for bug fixes / features)
  • Changes follow the contributing document.

Motivation and Context

To be able to utilize this library in React Native

Does this PR introduce a breaking change?

  • Yes
  • No
  • Squash
  • Rebase (REVIEW COMMITS)

@haardikk21
Copy link
Contributor Author

Closing in favour of mattrglobal/bbs-signatures#33

@haardikk21 haardikk21 closed this Jul 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant