Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.validateS3ObjectChecksum = async ({
algorithm,
bucket,
key,
expectedSum,
options
}) => {
const fileStream = exports.getS3ObjectReadStream(bucket, key);
if (await validateChecksumFromStream(algorithm, fileStream, expectedSum, options)) {
return true;
}
const msg = `Invalid checksum for S3 object s3://${bucket}/${key} with type ${algorithm} and expected sum ${expectedSum}`;
throw new errors.InvalidChecksum(msg);
};
exports.validateS3ObjectChecksum = async ({
algorithm,
bucket,
key,
expectedSum,
options
}) => {
const fileStream = exports.getS3ObjectReadStream(bucket, key);
if (await validateChecksumFromStream(algorithm, fileStream, expectedSum, options)) {
return true;
}
const msg = `Invalid checksum for S3 object s3://${bucket}/${key} with type ${algorithm} and expected sum ${expectedSum}`;
throw new InvalidChecksum(msg);
};