AWS S3's object integrity just says it needs a checksum, but not the format. We were using sha256::digest(), which returned a hex string. Digging around in docs, finally revealed that it needs to be Base64-encoded.
So replace the sha256 crate with sha2 from the RustCrypto project, which provides a binary representation of a hash digest, and encode it as appropriate with the base64 and hex crates for S3 validation and Trunk download validation, respectively.
Also pass the digest around as a byte slice and let the uploader code handle encoding it into Base64 for the upload request.
AWS S3's object integrity just says it needs a checksum, but not the format. We were using
sha256::digest()
, which returned a hex string. Digging around in docs, finally revealed that it needs to be Base64-encoded.So replace the
sha256
crate withsha2
from the RustCrypto project, which provides a binary representation of a hash digest, and encode it as appropriate with thebase64
andhex
crates for S3 validation and Trunk download validation, respectively.Also pass the digest around as a byte slice and let the uploader code handle encoding it into Base64 for the upload request.
Resolves TEM-2861.