mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Clean
This commit is contained in:
parent
d58bc697b2
commit
8fb5e7102f
|
@ -16,18 +16,16 @@ public class LokiSessionResetImplementation : NSObject, SessionResetProtocol {
|
||||||
|
|
||||||
public func validatePreKeyForFriendRequestAcceptance(for recipientID: String, whisperMessage: CipherMessage, protocolContext: Any?) throws {
|
public func validatePreKeyForFriendRequestAcceptance(for recipientID: String, whisperMessage: CipherMessage, protocolContext: Any?) throws {
|
||||||
guard let transaction = protocolContext as? YapDatabaseReadTransaction else {
|
guard let transaction = protocolContext as? YapDatabaseReadTransaction else {
|
||||||
print("[Loki] Couldn't verify friend request acceptance pre key because an invalid transaction was provided.")
|
print("[Loki] Couldn't verify friend request accepted message because an invalid transaction was provided.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard let preKeyMessage = whisperMessage as? PreKeyWhisperMessage else { return }
|
guard let preKeyMessage = whisperMessage as? PreKeyWhisperMessage else { return }
|
||||||
guard let storedPreKey = storage.getPreKeyRecord(forContact: recipientID, transaction: transaction) else {
|
guard let storedPreKey = storage.getPreKeyRecord(forContact: recipientID, transaction: transaction) else {
|
||||||
print("[Loki] Received a friend request accepted message from a public key for which no pre key bundle was created.")
|
print("[Loki] Received a friend request accepted message from a public key for which no pre key bundle was created.")
|
||||||
// FIXME: Don't throw an error for now as a way to de-bork some existing clients. For example, Simon's Android device was
|
throw Errors.invalidPreKey
|
||||||
// somehow triggering this and causing iOS to discard all messages received from him.
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
guard storedPreKey.id == preKeyMessage.prekeyID else {
|
guard storedPreKey.id == preKeyMessage.prekeyID else {
|
||||||
print("[Loki] Received a `PreKeyWhisperMessage` (friend request acceptance) from an unknown source.")
|
print("[Loki] Received a `PreKeyWhisperMessage` (friend request accepted message) from an unknown source.")
|
||||||
throw Errors.preKeyIDsDontMatch
|
throw Errors.preKeyIDsDontMatch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue