Goals
Building on #193 , add verification of CAR blocks as we download.
Implementation
My recommendation for implementation:
- open a linear reader on the incoming CAR file from the response body
- start a selector traversal based on the parameters of the request
- for the block read opener:
- each time it is called, read the next block from the CARv1 stream (obviously a blocking read if not data is not yet available from the HTTP response)
- hash it, verify the bytes match the CID passed to the block read opener
- if matched, write the block in the into the outgoing HTTP CarV1 from Lassie and return the bytes as a reader to the selector traversal (TeeReader probably works well here)
- if not matched, error
Goals
Building on #193 , add verification of CAR blocks as we download.
Implementation
My recommendation for implementation: