dfinity / certified-assets

A certified assets canister written in Rust.
Apache License 2.0
39 stars 15 forks source link

feat: update did for passing chunks tree and sha256 #25

Open 3cL1p5e7 opened 2 years ago

3cL1p5e7 commented 2 years ago

That is a part of proposal about chunks certification (with backward compatibility).

These improvements are a proposal to improve the certification infrastructure around IC and might be considered as a recommendation for dfinity-team.

Goal

Make it possible to certify asset chunks. Validate chunk certificates on the service-worker and icx-proxy.

Why

At the moment, the service-worker and icx-proxy does not support the certification of chunkified files. Moreover, right now it is not possible to correctly stream chunkified and large audio and video files to the front-end. This problems could be solved independently if it would be possible to install an additional service-worker in the certified zone of the domain ic0.app (for 206 partial http-request handling). But is is impossible because there is unable to place custom worker on ic0.app domain. Making your own custom player for audio and video is extremely difficult due to the large number of formats and non-native implementation.

Details

To make this possible, support for HTTP-range requests for http_request query method has been added. This is done to support native html audio/video element (which uses 206 partial http-request) and to determine the index of the chunk throught 206 partial http-request. Using 206 partial http-requests allows you to focus only on certification in the worker and icx-proxy.

Steps

  1. It all starts with PR for certified-assets-canister in cdk-rs
  2. (Here) Did file was updated here
  3. Service-worker started supporting chunk_tree certificate verification in PR for ic
  4. icx-proxy started supporting chunk_tree certificate verification in PR for icx-proxy
  5. Added support for new certified-assets-canister did in PR for agent-rs