webcrypto-example
webcrypto-example copied to clipboard
encrypting more than ~50kb text fails
If you input more than ~50kb of text into the input box, it fails with the error message "Error - RangeError: Maximum call stack size exceeded". Sorry, I'm not sure if this is a bug, setting, or a limitation of web crypto API
I found a solution that fixes this size limit issue, and everything seems to work with this. But I don't know if this would have any unintended consequences.
const buff_to_base64 = function(buff) {
return btoa(new Uint8Array(buff).reduce(function (data, byte) {
return data + String.fromCharCode(byte);
}, ''));
}