I'm using EvaporateJS in a react project which uses webpack.
As described in the documentation I used the following:
(I don't want to use the aws-sdk because of the package size which btw works properly)
cryptoMd5Method: function (data) {
return crypto.createHash('md5').update(data).digest('base64');
}
But 'data' is type of ArrayBuffer. So I tried converting it to string.
cryptoMd5Method: function (data) {
var enc = new TextDecoder();
var dataString = enc.decode(data);
var computed = crypto.createHash('md5').update(dataString).digest('base64');
return computed ;
}
But that doesn't compute the digest correctly.
So, what should be the solution for this (considering the nodejs crypto option)?
Also alternatively, how to import just AWS.util.crypto
module without referencing the whole aws-sdk
? This will help me keep the bundle small.