axman6 / amazonka-s3-streaming

Provides a conduit based interface to uploading data to S3 using the Multipart API
MIT License
20 stars 23 forks source link

Compute hash of input bytestrings and include those in the completed CompleteMultipartUpload #37

Open axman6 opened 1 year ago

axman6 commented 1 year ago

CompleteMultipartUpload has fields to include several hash digests, it wouldn't be hard in streamUpload to compute these from the data coming into the conduit and including that at the end. This should be easy to do efficiently with a combination of cryptonite and some of the modules in amazonka-core.

One big benefit of this is making testing simpler, at the moment I upload a file to S3, download it and check the hash matches; if the hash is computed from the input data and not anything internal to buffers etc, then Amazon will do the work of checking that the hash matches for us, and hopefully return an error if we ever mess up uploading.

axman6 commented 1 year ago

Sadly it looks like this won't work how I hoped, AWS won't compute the checksum of the total object, only the checksum of the concatenated checksums. See https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html