service-worker-gateway icon indicating copy to clipboard operation
service-worker-gateway copied to clipboard

Support blake3 CIDs

Open lidel opened this issue 1 year ago • 1 comments

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).

lidel avatar May 16 '24 17:05 lidel

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
    • you can see an example of blake3 hasher at https://github.com/ipfs/ipld-explorer-components/blob/7748e75f8fa7af52347518510f1e7caea2dbfb2d/src/lib/hash-importer.ts#L61-L72

SgtPooki avatar Oct 03 '24 15:10 SgtPooki

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

SgtPooki avatar Nov 07 '24 15:11 SgtPooki