Fetch content and verify it from IPFS gateway

Hi there!

I have written some code to fetch and verify the content from an IPFS gateway by hashing the content and comparing it to the original CID hash. Check it out DNP_DAPPMANAGER/getContentFromGateway.ts at master · dappnode/DNP_DAPPMANAGER · GitHub

I am not sure if this verification is already done by the IPFS-CAR library, can anybody clarify it?

Also, I was trying to create a “fake” ipfs gateway to expose the /dag/export endpoint and serve a modified CAR content to check that my code works propertly. I am having troubles how to serve CAR content through an API, can anyone help me please?

Thank u in advanced!

Hi
Just wanted to comment that a lightweight lib which does just that - verify the integrity of files downloaded via gateway - would imho be super useful. Without it, the convenience of using public gateways comes at the price of losing the main benefit of IPFS - guaranteed integrity.