little-bear-labs / ipfs-chromium

19 stars 1 forks source link

Consider implementing part of that as a reusable library #2

Closed fabricedesre closed 3 months ago

fabricedesre commented 1 year ago

Hi,

I think it would be valuable to implement the chromium support in 2 components:

  1. A libipfsclient library that deals with IPFS specific bits, and exposes hooks to the host using the library. That would likely cover:
    • Low level CID / multihash bits.
    • The UnixFS state machine to decode and verify blocks (DAG, HAMT).
    • The block store.
    • IPNS resolution.
  2. The chromium glue code.

The host (here chromium) would provide http networking, low level DNS, heuristic for gateway scoring, etc.

This would make it possible to share the IPFS specific bits among web runtimes (and other targets) more easily. I would be interested to re-use that for a Gecko and Servo implementations for instance.

John-LittleBearLabs commented 1 year ago

Agreed that code sharing would be desirable if it works out. Organizing in 2 components rather than 1 seems pretty low-cost from my end, so definitely will take this into consideration.

fabricedesre commented 1 year ago

Cool! One other thing to consider is the implementation language for the shared component. Rust would be my #1 choice since it's a good fit for all my use cases (and has better IPFS ecosystem use than c++).