Skip to content

Support react-native (it's working, it just needs to be merged in) #48

@RangerMauve

Description

@RangerMauve

Hey friends,

We've been working on getting sodium-javascript working in React-Native at @consento-org and we've got some stuff together to make it happen.

The main piece that was breaking was the randombytes implementation only working in Node and the web.

To fix that @martinheidegger put together get-random-values-polypony which supports most JS environments and has tests passing across them.

We also needed to change up memory.js to use the old version which didn't use the worker_threads module since that isn't available in react-native. I'm not sure if this is the best approach, however, and I'd be happy to adjust code to account for this. For example, I'd love to fix #47 at the same time.

Right now all the work we've done is here: master...consento-org:rn-tape

The other useful bit that was added was running tests on Android/iOS with react-native and Expo via Browserstack. This is encapsulated in our rn-tape module. I think it'd be nice to add it to the CI to cover tests for these environments as well. Main thing that would need to be done is setting up environment variables for a BrowserStack account for the sodium-friends org. I'm pretty sure there's an open source tier we could use and I'd be happy to help set that up if needed.

All that to say, I'd like to do any of the following:

  • Submit a PR to replace the code in randombytes.js with get-random-values-polypony
  • Figure out what to do about the worker_threads dependency in memory.js
  • Get rn-tape integrated into the CI to make sure react-native doesn't break in the future

I wanted to put this out there and ask if there are any maintainers that have bandwidth to review and merge these changes as I submit them.

I think sodium-javascript is a super useful tool, and lots of people could benefit from it being available in React-Native out of the box (we're going to be using it for hypercore stuff).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions