Update libsignal-protocol
// FREEBIE
This commit is contained in:
parent
6fd438951c
commit
519d3ec31b
2 changed files with 16 additions and 48 deletions
|
@ -34608,7 +34608,7 @@ window.libsignal.protocol = function(storage_interface) {
|
||||||
throw new Error("Expected plaintext to be an ArrayBuffer");
|
throw new Error("Expected plaintext to be an ArrayBuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
var ourIdentityKey, myRegistrationId, record, session, hadSession;
|
var ourIdentityKey, myRegistrationId, record, session;
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
storage_interface.getIdentityKeyPair(),
|
storage_interface.getIdentityKeyPair(),
|
||||||
storage_interface.getLocalRegistrationId(),
|
storage_interface.getLocalRegistrationId(),
|
||||||
|
@ -34617,29 +34617,13 @@ window.libsignal.protocol = function(storage_interface) {
|
||||||
ourIdentityKey = results[0];
|
ourIdentityKey = results[0];
|
||||||
myRegistrationId = results[1];
|
myRegistrationId = results[1];
|
||||||
record = results[2];
|
record = results[2];
|
||||||
if (record) {
|
if (!record) {
|
||||||
session = record.getOpenSession();
|
throw new Error("No record for " + deviceObject.encodedNumber);
|
||||||
}
|
}
|
||||||
|
session = record.getOpenSession();
|
||||||
hadSession = session !== undefined;
|
if (!session) {
|
||||||
|
throw new Error("No session to encrypt message for " + deviceObject.encodedNumber);
|
||||||
if (session === undefined) {
|
|
||||||
var address = SignalProtocolAddress.fromString(deviceObject.encodedNumber);
|
|
||||||
var builder = new SessionBuilder(storage_interface, address);
|
|
||||||
|
|
||||||
return builder.processPreKey(deviceObject);
|
|
||||||
}
|
}
|
||||||
}).then(function() {
|
|
||||||
return getRecord(deviceObject.encodedNumber).then(function(refreshed) {
|
|
||||||
record = refreshed;
|
|
||||||
if (!record) {
|
|
||||||
throw new Error("No record for " + deviceObject.encodedNumber);
|
|
||||||
}
|
|
||||||
session = record.getOpenSession();
|
|
||||||
if (!session) {
|
|
||||||
throw new Error("No session to encrypt message for " + deviceObject.encodedNumber);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).then(function doEncryptPushMessageContent() {
|
}).then(function doEncryptPushMessageContent() {
|
||||||
var msg = new Internal.protobuf.WhisperMessage();
|
var msg = new Internal.protobuf.WhisperMessage();
|
||||||
|
|
||||||
|
@ -35208,7 +35192,7 @@ SessionBuilder.prototype = {
|
||||||
record.updateSessionState(session, device.registrationId);
|
record.updateSessionState(session, device.registrationId);
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
this.storage.storeSession(address, record.serialize()),
|
this.storage.storeSession(address, record.serialize()),
|
||||||
this.storage.putIdentityKey(address, record.identityKey)
|
this.storage.putIdentityKey(this.remoteAddress.getName(), record.identityKey)
|
||||||
]);
|
]);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -35268,7 +35252,7 @@ SessionBuilder.prototype = {
|
||||||
// end of decryptWhisperMessage ... to ensure that the sender
|
// end of decryptWhisperMessage ... to ensure that the sender
|
||||||
// actually holds the private keys for all reported pubkeys
|
// actually holds the private keys for all reported pubkeys
|
||||||
record.updateSessionState(new_session, message.registrationId);
|
record.updateSessionState(new_session, message.registrationId);
|
||||||
return this.storage.putIdentityKey(this.remoteAddress.toString(), message.identityKey.toArrayBuffer()).then(function() {
|
return this.storage.putIdentityKey(this.remoteAddress.getName(), message.identityKey.toArrayBuffer()).then(function() {
|
||||||
return message.preKeyId;
|
return message.preKeyId;
|
||||||
});
|
});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
|
@ -34494,7 +34494,7 @@ window.libsignal.protocol = function(storage_interface) {
|
||||||
throw new Error("Expected plaintext to be an ArrayBuffer");
|
throw new Error("Expected plaintext to be an ArrayBuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
var ourIdentityKey, myRegistrationId, record, session, hadSession;
|
var ourIdentityKey, myRegistrationId, record, session;
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
storage_interface.getIdentityKeyPair(),
|
storage_interface.getIdentityKeyPair(),
|
||||||
storage_interface.getLocalRegistrationId(),
|
storage_interface.getLocalRegistrationId(),
|
||||||
|
@ -34503,29 +34503,13 @@ window.libsignal.protocol = function(storage_interface) {
|
||||||
ourIdentityKey = results[0];
|
ourIdentityKey = results[0];
|
||||||
myRegistrationId = results[1];
|
myRegistrationId = results[1];
|
||||||
record = results[2];
|
record = results[2];
|
||||||
if (record) {
|
if (!record) {
|
||||||
session = record.getOpenSession();
|
throw new Error("No record for " + deviceObject.encodedNumber);
|
||||||
}
|
}
|
||||||
|
session = record.getOpenSession();
|
||||||
hadSession = session !== undefined;
|
if (!session) {
|
||||||
|
throw new Error("No session to encrypt message for " + deviceObject.encodedNumber);
|
||||||
if (session === undefined) {
|
|
||||||
var address = SignalProtocolAddress.fromString(deviceObject.encodedNumber);
|
|
||||||
var builder = new SessionBuilder(storage_interface, address);
|
|
||||||
|
|
||||||
return builder.processPreKey(deviceObject);
|
|
||||||
}
|
}
|
||||||
}).then(function() {
|
|
||||||
return getRecord(deviceObject.encodedNumber).then(function(refreshed) {
|
|
||||||
record = refreshed;
|
|
||||||
if (!record) {
|
|
||||||
throw new Error("No record for " + deviceObject.encodedNumber);
|
|
||||||
}
|
|
||||||
session = record.getOpenSession();
|
|
||||||
if (!session) {
|
|
||||||
throw new Error("No session to encrypt message for " + deviceObject.encodedNumber);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).then(function doEncryptPushMessageContent() {
|
}).then(function doEncryptPushMessageContent() {
|
||||||
var msg = new Internal.protobuf.WhisperMessage();
|
var msg = new Internal.protobuf.WhisperMessage();
|
||||||
|
|
||||||
|
@ -35094,7 +35078,7 @@ SessionBuilder.prototype = {
|
||||||
record.updateSessionState(session, device.registrationId);
|
record.updateSessionState(session, device.registrationId);
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
this.storage.storeSession(address, record.serialize()),
|
this.storage.storeSession(address, record.serialize()),
|
||||||
this.storage.putIdentityKey(address, record.identityKey)
|
this.storage.putIdentityKey(this.remoteAddress.getName(), record.identityKey)
|
||||||
]);
|
]);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -35154,7 +35138,7 @@ SessionBuilder.prototype = {
|
||||||
// end of decryptWhisperMessage ... to ensure that the sender
|
// end of decryptWhisperMessage ... to ensure that the sender
|
||||||
// actually holds the private keys for all reported pubkeys
|
// actually holds the private keys for all reported pubkeys
|
||||||
record.updateSessionState(new_session, message.registrationId);
|
record.updateSessionState(new_session, message.registrationId);
|
||||||
return this.storage.putIdentityKey(this.remoteAddress.toString(), message.identityKey.toArrayBuffer()).then(function() {
|
return this.storage.putIdentityKey(this.remoteAddress.getName(), message.identityKey.toArrayBuffer()).then(function() {
|
||||||
return message.preKeyId;
|
return message.preKeyId;
|
||||||
});
|
});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue