mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-07 14:40:55 +03:00
fixed size limit on server to include crypto overhead
This commit is contained in:
10
app/utils.js
10
app/utils.js
@@ -249,6 +249,13 @@ function platform() {
|
||||
return 'web';
|
||||
}
|
||||
|
||||
const ECE_RECORD_SIZE = 1024 * 64;
|
||||
const TAG_LENGTH = 16;
|
||||
function encryptedSize(size, rs = ECE_RECORD_SIZE, tagLength = TAG_LENGTH) {
|
||||
const chunk_meta = tagLength + 1; // Chunk metadata, tag and delimiter
|
||||
return 21 + size + chunk_meta * Math.ceil(size / (rs - chunk_meta));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fadeOut,
|
||||
delay,
|
||||
@@ -267,5 +274,6 @@ module.exports = {
|
||||
list,
|
||||
secondsToL10nId,
|
||||
timeLeft,
|
||||
platform
|
||||
platform,
|
||||
encryptedSize
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user