ipfs / service-worker-gateway

IPFS Gateway implemented in Service Worker
https://inbrowser.link
Other
32 stars 8 forks source link

Support blake3 CIDs #260

Closed lidel closed 3 weeks ago

lidel commented 6 months ago

bafkr4ihkr4ld3m4gqkjf4reryxsy2s5tkbxprqkow6fin2iiyvreuzzab4 is blake3 and https://inbrowser.dev/ipfs/bafkr4ihkr4ld3m4gqkjf4reryxsy2s5tkbxprqkow6fin2iiyvreuzzab4 fails atm.

Spec-wise, we have blake3 listed as part of Web Pathing spec draft here, and to be production relady drop-in replacement for dweb.link, inbrowser.link should support the same hash functions (as brave/rainbow/kubo-based gateway).

SgtPooki commented 2 months ago

The work required to do this is a little more involved than just adding a hasher:

  1. you would need to update the createVerifiedFetch call to pass a helia instance (a @helia/http instance for now) here: https://github.com/ipfs/service-worker-gateway/blob/3c9b300f4446da1f801d663ac39012287b87574d/src/sw.ts#L251-L257
  2. you need to instantiate a @helia/http instance, passing the gateway/routers config, adding the hashers configuration that includes blake3
SgtPooki commented 3 weeks ago

this was done in https://github.com/ipfs/service-worker-gateway/pull/421