From 0eeee6c8a177227cf04795cbe727b12b211cfdf2 Mon Sep 17 00:00:00 2001 From: nielsandriesse <andriesseniels@gmail.com> Date: Thu, 1 Oct 2020 15:22:35 +1000 Subject: [PATCH] Generate own ratchet if needed --- .../Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift b/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift index 8d6275da6..b959d17c1 100644 --- a/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift +++ b/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift @@ -411,9 +411,8 @@ public final class ClosedGroupsProtocol : NSObject { // Respond to the request print("[Loki] Responding to sender key request from: \(senderPublicKey).") SessionManagementProtocol.sendSessionRequestIfNeeded(to: senderPublicKey, using: transaction) // This internally takes care of multi device - guard let userRatchet = Storage.getClosedGroupRatchet(for: groupPublicKey, senderPublicKey: userPublicKey) else { - return print("[Loki] Missing own ratchet.") - } + let userRatchet = Storage.getClosedGroupRatchet(for: groupPublicKey, senderPublicKey: userPublicKey) + ?? SharedSenderKeysImplementation.shared.generateRatchet(for: groupPublicKey, senderPublicKey: userPublicKey, using: transaction) let userSenderKey = ClosedGroupSenderKey(chainKey: Data(hex: userRatchet.chainKey), keyIndex: userRatchet.keyIndex, publicKey: Data(hex: userPublicKey)) let thread = TSContactThread.getOrCreateThread(withContactId: senderPublicKey, transaction: transaction) thread.save(with: transaction)