digitalbazaar / vc

W3C Verifiable Credentials implementation in JavaScript
BSD 3-Clause "New" or "Revised" License
173 stars 49 forks source link

Usage with React Native #109

Open TimoGlastra opened 2 years ago

TimoGlastra commented 2 years ago

We (Animo Solutions) intend to use this library for an Aries framework we're building (https://github.com/hyperledger/aries-framework-javascript). The framework supports React Native as an environment and therefore I'm interested to hear the maintainers point of view of supporting react native in the digital bazaar vc libraries.

I see there are a lot of rn branches across the repos that add initial support for react-native, but it seems they have been stale for a while. I also read a comment in https://github.com/digitalbazaar/jsonld-signatures/pull/142 about being stuck in discussion on support for RN.

There is already a fork available of this library that adds React Native support (https://github.com/Sphereon-Opensource/rn-vc-js), but I'm not sure if using a separate package (while 95% could be shared) is an ideal solution.

What is your stance on supporting React Native for the vc-js libraries, and will PRs to finalize React Native support be welcomed? We'd rather integrate with vc-js directly and not use a fork, but I want to be certain that this is line with the vision of this library.

dmitrizagidulin commented 2 years ago

Hi Timo! Good question -- yes, we're still sorting out Digital Bazaar's policy on React Native.

Meanwhile, feel free to use the MIT Digital Credentials Consortium's fork of vc-js library. It's based on similarly RN-enabled forks of its pre-requisite libraries, and is being actively maintained and synced with Digital Bazaar's versions.

As the maintainer (and the person performing the syncing :) ), I do hope we can eventually sort out the RN issues here on the Digital Bazaar side, and I'll continue to advocate for it.

TimoGlastra commented 2 years ago

Thanks @dmitrizagidulin!

I wasn't aware of the Digital Credentials Consortium fork -- I think that is perfect for our use case (at least for now).

The fact that a maintainer of this library is advocating for RN support, and is also maintaining a fork of this library gives me good hope

nklomp commented 2 years ago

To chime in on the above. We actually have a fork, but it was created under a lot of pressure, so it is not tested against all suites and to be honest we rather have something like the Digital Credentials fork or in this upstream project to begin with. Happy to help, as I believe there are different parties that actually want to use vc-js in RN. I know of at least 3 different parties myself outside of Animo

dmitrizagidulin commented 2 years ago

Thanks @nklomp; let me know if there's further questions.

(I'll keep this issue open, and update it if there's further developments on this library, that enables RN support.)

uocnb commented 2 years ago

Hi @dmitrizagidulin

Any update for RN support?

I've tried rn branch for React Native and browser usage:

Both env run with same node v16.14.0 and npm v8.4.1.

dmitrizagidulin commented 2 years ago

Hi @uocnb. I'm sorry, no updates on this repo. Try the DCC fork https://github.com/digitalcredentials/vc-js, I'm using that one in RN currently.

dlongley commented 1 year ago

My understanding is that this should be fixed now with the move to ESM. I'm closing -- feel free to reopen if there are still issues.

dmitrizagidulin commented 1 year ago

My understanding is that this should be fixed now with the move to ESM. I'm closing -- feel free to reopen if there are still issues.

Not fixed, sadly. Still various RN-related issues that require us to maintain forks.

TimoGlastra commented 1 year ago

Hey @dlongley. As @dmitrizagidulin mentioned, react native support is not fully working yet. Are you willing to accept pull requests for things that do not work well in React Native?

We're running into issues again now because of things fixed in the main digital bazaar libraries, but not in the forks and it's quite a hassle.

dlongley commented 1 year ago

@TimoGlastra,

We don't want react-native-specific code to maintain (as we wouldn't do a good job testing nor maintaining it) -- but we're willing to look into PRs that could better enable you to use a shim library or polyfill to do what you need to do so that you receive updates from this library. Does that make sense?

Of course, bug fixes or adjustments that are generally helpful to all users of the library are also welcome -- so if anything can be reframed in that way, we could also consider it.

nklomp commented 1 year ago

Really interested in this as well, as we also in the same boat as Timo/Animo

In a lot of cases RN support isn't about creating native code for the different platforms, but more in making certain choices in what depencies to use and for instance preferring u8a arrays over direct buffer usage etc, not accessing the FS directly etc.

But probably @dmitrizagidulin can chime in on what the most important changes in the DC fork are

dmitrizagidulin commented 11 months ago

But probably @dmitrizagidulin can chime in on what the most important changes in the DC fork are

The main challenge here is that the DCC fork of the VC library is the top of a pyramid of dependencies, all of which need to be be modified to work with TypeScript, Jest, ReactNative, etc. There isn't really a simple fix.

We're running into issues again now because of things fixed in the main digital bazaar libraries, but not in the forks and it's quite a hassle.

Yeah, we've been behind porting the fixes to the DCC libs, will be focusing on that shortly.

swatigoel commented 4 months ago

We are facing this issue in react native app, https://github.com/digitalcredentials/vc/issues/17 As mentioned in issue, we are able to verify all the VCs by using this library independently.

Does anyone has any solution to suggest?