-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Getting js-ipfs to load in browser #509
Comments
Hi @nikuda thanks for digging deap into the roots of the problem, really nice sum up, looking forward to see you tinkering with the code too :D
Solved - #508
We are working on it, however there is one more change that needs to happen, which is changing libp2p-ipfs to libp2p-ipfs-browser, they offer the same API, but need to be replace for in browser used, this is currently achieved through the build process.
We are working on stop using node-forge, although we hoped it became CommonJS -- libp2p/js-peer-id#5 -- Follow - #485 |
Not a problem
Are there any issues/PRs open that relate to changes that need to happen here?
Have you considered any alternatives? Maybe native browser WebCrypto API could do the job? https://diafygi.github.io/webcrypto-examples/ These two libraries also look good. They both seem to be under 10Kb minified which is a lot better than |
That is just how it works, libp2p-ipfs is the libp2p build that has the transports for Node.js (TCP, WebSockets, UTP, libp2p-ipfs-browser is the build with the transports for Browser (WebRTC + WebSockets). In the near future, Routing will be added (DHT) and that will behave interally different in the browser and in Node.js.
If you go through #485, you'll see that is what we are doing :)
We have had some discussions (daviddias/webcrypto#1), but we ended up picking node-forge in the beginning because it had the primitives we needed. |
@nikuda all of this work is pretty much done, it was one of the things I have been working on in the last weeks, see #485 for a list of PRs that
|
Ah the ref to #485 was missing before. Thanks!
Great! 🏆 It seems libp2p/js-libp2p-crypto#10 has been supplanted by libp2p/js-libp2p-crypto#12 which most of the other PRs rely on. I noticed that the PR has the backlog tag, is there anything I can help with it to get it merged in sooner? |
The If you want to help out, I've added a |
Yes, just updated the reference. |
These seem to be the only libs from #485 that use |
Thanks @nikuda, most of these pull it in as an indirect dependency. I just updated the issue with a better overview table of ALL THE PRs 😉 |
Good stuff @diasdavid! Will try it soon :) |
also, check out the examples folder: https://github.com/ipfs/js-ipfs/tree/master/examples |
All working @diasdavid. 👍 |
Spoke too soon. In |
Fixed the issue in libp2p/js-libp2p-crypto#47. Now the node in |
thank you @nikuda !! :) |
test: add test for add files to dir non sequentially
Issues I've found (so far) that prevent js-ipfs from loading in the browser.
package.json
attributemain
pointing to a non-existing pathFixed in Fixed path for module importing #508
Use of
fs.readFileSync
with.proto
files.Proposed solution No more fs.readFileSync and different hash functions js-ipfs-merkle-dag#50 would need to be applied to the following libraries:
node-forge
library uses AMD modules which doesn't work withbrowserify
Most severe of the issues, more detail:
Affected libraries:
The text was updated successfully, but these errors were encountered: