Backwards compatibility updates for libsignal-client
This commit is contained in:
parent
34285054f6
commit
bc0f4387fe
12
preload.js
12
preload.js
|
@ -534,6 +534,18 @@ try {
|
|||
},
|
||||
createKeyPair: incomingKey => {
|
||||
const incomingKeyBuffer = Buffer.from(incomingKey);
|
||||
|
||||
if (incomingKeyBuffer.length !== 32) {
|
||||
throw new Error('key must be 32 bytes long');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-bitwise
|
||||
incomingKeyBuffer[0] &= 248;
|
||||
// eslint-disable-next-line no-bitwise
|
||||
incomingKeyBuffer[31] &= 127;
|
||||
// eslint-disable-next-line no-bitwise
|
||||
incomingKeyBuffer[31] |= 64;
|
||||
|
||||
const privKey = client.PrivateKey.deserialize(incomingKeyBuffer);
|
||||
const pubKey = privKey.getPublicKey();
|
||||
|
||||
|
|
|
@ -4023,6 +4023,12 @@ export class ConversationModel extends window.Backbone.Model<
|
|||
async leaveGroup(): Promise<void> {
|
||||
const now = Date.now();
|
||||
if (this.get('type') === 'group') {
|
||||
const groupId = this.get('groupId');
|
||||
|
||||
if (!groupId) {
|
||||
throw new Error(`leaveGroup/${this.idForLogging()}: No groupId!`);
|
||||
}
|
||||
|
||||
const groupIdentifiers = this.getRecipients();
|
||||
this.set({ left: true });
|
||||
window.Signal.Data.updateConversation(this.attributes);
|
||||
|
@ -4048,7 +4054,7 @@ export class ConversationModel extends window.Backbone.Model<
|
|||
message.send(
|
||||
this.wrapSend(
|
||||
window.textsecure.messaging.leaveGroup(
|
||||
this.id,
|
||||
groupId,
|
||||
groupIdentifiers,
|
||||
options
|
||||
)
|
||||
|
|
|
@ -1470,11 +1470,11 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
|||
|
||||
// General
|
||||
idForLogging(): string {
|
||||
const source = this.getSource();
|
||||
const account = this.getSourceUuid() || this.getSource();
|
||||
const device = this.getSourceDevice();
|
||||
const timestamp = this.get('sent_at');
|
||||
|
||||
return `${source}.${device} ${timestamp}`;
|
||||
return `${account}.${device} ${timestamp}`;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
|
|
|
@ -622,10 +622,14 @@ class MessageReceiverInner extends EventTarget {
|
|||
}
|
||||
|
||||
getEnvelopeId(envelope: EnvelopeClass) {
|
||||
const timestamp =
|
||||
envelope && envelope.timestamp && envelope.timestamp.toNumber
|
||||
? envelope.timestamp.toNumber()
|
||||
: null;
|
||||
|
||||
if (envelope.sourceUuid || envelope.source) {
|
||||
return `${envelope.sourceUuid || envelope.source}.${
|
||||
envelope.sourceDevice
|
||||
} ${envelope.timestamp.toNumber()} (${envelope.id})`;
|
||||
const sender = envelope.sourceUuid || envelope.source;
|
||||
return `${sender}.${envelope.sourceDevice} ${timestamp} (${envelope.id})`;
|
||||
}
|
||||
|
||||
return envelope.id;
|
||||
|
|
Loading…
Reference in New Issue