mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-09 11:45:36 +00:00
fixed size limit on server to include crypto overhead
This commit is contained in:
@@ -281,11 +281,6 @@ class StreamSlicer {
|
||||
}
|
||||
}
|
||||
|
||||
export function encryptedSize(size, rs = ECE_RECORD_SIZE) {
|
||||
const chunk_meta = TAG_LENGTH + 1; // Chunk metadata, tag and delimiter
|
||||
return 21 + size + chunk_meta * Math.ceil(size / (rs - chunk_meta));
|
||||
}
|
||||
|
||||
/*
|
||||
input: a ReadableStream containing data to be transformed
|
||||
key: Uint8Array containing key of size KEY_LENGTH
|
||||
|
||||
@@ -3,7 +3,7 @@ import OwnedFile from './ownedFile';
|
||||
import Keychain from './keychain';
|
||||
import { arrayToB64, bytes } from './utils';
|
||||
import { uploadWs } from './api';
|
||||
import { encryptedSize } from './ece';
|
||||
import { encryptedSize } from './utils';
|
||||
|
||||
export default class FileSender extends Nanobus {
|
||||
constructor() {
|
||||
|
||||
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