Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit a80285c

Browse files
Remove 1000 messageKey limit entirely, along with custom limits (#42)
1 parent d087053 commit a80285c

File tree

2 files changed

+6
-30
lines changed

2 files changed

+6
-30
lines changed

dist/libsignal-protocol.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -36014,14 +36014,7 @@ libsignal.SessionBuilder = function (storage, remoteAddress) {
3601436014
this.processV3 = builder.processV3.bind(builder);
3601536015
};
3601636016

36017-
function SessionCipher(storage, remoteAddress, options) {
36018-
options = options || {};
36019-
36020-
if (typeof options.messageKeysLimit === 'undefined') {
36021-
options.messageKeysLimit = 1000;
36022-
}
36023-
36024-
this.messageKeysLimit = options.messageKeysLimit;
36017+
function SessionCipher(storage, remoteAddress) {
3602536018
this.remoteAddress = remoteAddress;
3602636019
this.storage = storage;
3602736020
}
@@ -36294,11 +36287,6 @@ SessionCipher.prototype = {
3629436287
});
3629536288
},
3629636289
fillMessageKeys: function(chain, counter) {
36297-
if (this.messageKeysLimit && Object.keys(chain.messageKeys).length >= this.messageKeysLimit) {
36298-
console.log("Too many message keys for chain");
36299-
return Promise.resolve(); // Stalker, much?
36300-
}
36301-
3630236290
if (chain.chainKey.counter >= counter) {
3630336291
return Promise.resolve(); // Already calculated
3630436292
}
@@ -36435,8 +36423,8 @@ SessionCipher.prototype = {
3643536423
}
3643636424
};
3643736425

36438-
libsignal.SessionCipher = function(storage, remoteAddress, options) {
36439-
var cipher = new SessionCipher(storage, remoteAddress, options);
36426+
libsignal.SessionCipher = function(storage, remoteAddress) {
36427+
var cipher = new SessionCipher(storage, remoteAddress);
3644036428

3644136429
// returns a Promise that resolves to a ciphertext object
3644236430
this.encrypt = cipher.encrypt.bind(cipher);

src/SessionCipher.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
function SessionCipher(storage, remoteAddress, options) {
2-
options = options || {};
3-
4-
if (typeof options.messageKeysLimit === 'undefined') {
5-
options.messageKeysLimit = 1000;
6-
}
7-
8-
this.messageKeysLimit = options.messageKeysLimit;
1+
function SessionCipher(storage, remoteAddress) {
92
this.remoteAddress = remoteAddress;
103
this.storage = storage;
114
}
@@ -278,11 +271,6 @@ SessionCipher.prototype = {
278271
});
279272
},
280273
fillMessageKeys: function(chain, counter) {
281-
if (this.messageKeysLimit && Object.keys(chain.messageKeys).length >= this.messageKeysLimit) {
282-
console.log("Too many message keys for chain");
283-
return Promise.resolve(); // Stalker, much?
284-
}
285-
286274
if (chain.chainKey.counter >= counter) {
287275
return Promise.resolve(); // Already calculated
288276
}
@@ -419,8 +407,8 @@ SessionCipher.prototype = {
419407
}
420408
};
421409

422-
libsignal.SessionCipher = function(storage, remoteAddress, options) {
423-
var cipher = new SessionCipher(storage, remoteAddress, options);
410+
libsignal.SessionCipher = function(storage, remoteAddress) {
411+
var cipher = new SessionCipher(storage, remoteAddress);
424412

425413
// returns a Promise that resolves to a ciphertext object
426414
this.encrypt = cipher.encrypt.bind(cipher);

0 commit comments

Comments
 (0)