Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

crypto dependency breaks react native #9

Closed
madc opened this issue Jul 6, 2017 · 12 comments · Fixed by #11
Closed

crypto dependency breaks react native #9

madc opened this issue Jul 6, 2017 · 12 comments · Fixed by #11
Labels

Comments

@madc
Copy link

madc commented Jul 6, 2017

With feathers-offline-realtime version 0.1.1 the crypto node module was added as a dependency, what breaks react native compatibility. The result is more or less this error.

Version 0.1.0 works fine with React Native.

@eddyystop eddyystop added the bug label Jul 6, 2017
@eddyystop
Copy link
Member

npm i --save crypto should solve the issue for the moment. Thanks for the catch.

@madc
Copy link
Author

madc commented Jul 6, 2017

I'll have to check tomorrow, but I have a feeling, this could be a bit more complicated. See Please remove this module from npm

@eddyystop
Copy link
Member

The issue you linked to only complains about the npm name being used.

Could you please see if feathers-offline-realtime works after npm i --save crypto?

If not, you can remove the hash and hashOfRecords functions from src/commons/utils/crypotographic.js . This allows the import to be dropped.

A good and cross-platform hash function is needed to implement optimistic mutation while disconnected.

@madc
Copy link
Author

madc commented Jul 7, 2017

What I was trying to point out with that link is, that this module is not a replacement/polyfill for the native node module. Installing crypto does not solve this issue.
As far as i can see, the hash functions are not used yet, would it be possible to move it to a develop branch and release a new version including the changes regarding uuid and optimistic mutation?

@eddyystop
Copy link
Member

I am not looking for a pollyfill for the native Node module. I just want a SHA1 hash.

I am still unclear from your answer if you did try the npm cypto module or not.

This repo will need a cross-platform SHA1 hash within days, so I'd be grateful if you tried npm i --save crypto as I can't work with React Native the next few days.

@madc
Copy link
Author

madc commented Jul 7, 2017

Ok, sorry. I did try and it did not work.

@madc
Copy link
Author

madc commented Jul 7, 2017

Could brix/crypto-js be a solution? Haven't used it yet, but it seems to work with react native too.

@eddyystop
Copy link
Member

i should have been explicit that npm i --save crypto should be run inside the feathers-offline-realtime folder. i hope that's what you tried.

i won't be able to type with more than 1 finger for 5 days or more.

perhaps you can try in the right folder if you didn't for knowledge sake. i'll look at your suggestion. thanks.

@eddyystop
Copy link
Member

eddyystop commented Jul 9, 2017

i may be wrong, but as far as i can see brix/crypto-js creates and depends on global variables. i hope there's something that follows node standards better and has a good number of github stars.

the error issue you mention getting mentions using rn-nodeify, i keep running across comments saying to try that while looking into this issue. have you tried that?

@eddyystop
Copy link
Member

this repo states it works on node & browser. a feathere core member has used in in react native.

@eddyystop
Copy link
Member

I expect this is fixed with #11 . It'll be published as 0.1.2.

@madc
Copy link
Author

madc commented Jul 10, 2017

Perfect, works like a charm!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants