Add replayable error for signed key failure

Disable message sending if signed key updates fail too many times, but
allow the user to retry sending.

// FREEBIE
This commit is contained in:
lilia 2017-02-15 18:27:06 -08:00
parent e0fd188d42
commit cd0fe7037b
5 changed files with 77 additions and 7 deletions

View file

@ -10,6 +10,7 @@
INIT_SESSION: 2,
TRANSMIT_MESSAGE: 3,
REBUILD_MESSAGE: 4,
RETRY_SEND_MESSAGE_PROTO: 5
};
window.textsecure = window.textsecure || {};
window.textsecure.replay = {
@ -88,6 +89,17 @@
SendMessageNetworkError.prototype = new ReplayableError();
SendMessageNetworkError.prototype.constructor = SendMessageNetworkError;
function SignedPreKeyRotationError(numbers, message, timestamp) {
ReplayableError.call(this, {
functionCode : Type.RETRY_SEND_MESSAGE_PROTO,
args : [numbers, message, timestamp]
});
this.name = 'SignedPreKeyRotationError';
this.message = "Too many signed prekey rotation failures";
}
SignedPreKeyRotationError.prototype = new ReplayableError();
SignedPreKeyRotationError.prototype.constructor = SignedPreKeyRotationError;
function MessageError(message, httpError) {
ReplayableError.call(this, {
functionCode : Type.REBUILD_MESSAGE,
@ -118,5 +130,6 @@
window.textsecure.ReplayableError = ReplayableError;
window.textsecure.OutgoingMessageError = OutgoingMessageError;
window.textsecure.MessageError = MessageError;
window.textsecure.SignedPreKeyRotationError = SignedPreKeyRotationError;
})();