From 9da6b6c31f71c4777f9969ee4562ac3c3ad2c1a7 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 1 Apr 2021 15:17:57 +1100 Subject: [PATCH 1/9] Add certificates --- Session.xcodeproj/project.pbxproj | 18 ++++++++++++++ .../Meta/public-loki-foundation.crt | 24 +++++++++++++++++++ SessionMessagingKit/Meta/storage-seed-1.crt | 24 +++++++++++++++++++ SessionMessagingKit/Meta/storage-seed-3.crt | 24 +++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 SessionMessagingKit/Meta/public-loki-foundation.crt create mode 100644 SessionMessagingKit/Meta/storage-seed-1.crt create mode 100644 SessionMessagingKit/Meta/storage-seed-3.crt diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 305be9540..4b3f63942 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -186,6 +186,12 @@ B8041A9525C8FA1D003C2166 /* MediaLoaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8041A9425C8FA1D003C2166 /* MediaLoaderView.swift */; }; B8041AA725C90927003C2166 /* TypingIndicatorCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8041AA625C90927003C2166 /* TypingIndicatorCell.swift */; }; B80A579F23DFF1F300876683 /* NewClosedGroupVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80A579E23DFF1F300876683 /* NewClosedGroupVC.swift */; }; + B81D25BA26157F20004D1FE1 /* storage-seed-1.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B726157F20004D1FE1 /* storage-seed-1.crt */; }; + B81D25BB26157F20004D1FE1 /* public-loki-foundation.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */; }; + B81D25BC26157F20004D1FE1 /* storage-seed-3.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B926157F20004D1FE1 /* storage-seed-3.crt */; }; + B81D25C426157F40004D1FE1 /* storage-seed-3.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B926157F20004D1FE1 /* storage-seed-3.crt */; }; + B81D25C526157F40004D1FE1 /* storage-seed-1.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B726157F20004D1FE1 /* storage-seed-1.crt */; }; + B81D25C626157F40004D1FE1 /* public-loki-foundation.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */; }; B821494625D4D6FF009C0F2A /* URLModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821494525D4D6FF009C0F2A /* URLModal.swift */; }; B821494F25D4E163009C0F2A /* BodyTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821494E25D4E163009C0F2A /* BodyTextView.swift */; }; B82149B825D60393009C0F2A /* BlockedModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B82149B725D60393009C0F2A /* BlockedModal.swift */; }; @@ -1198,6 +1204,9 @@ B8041A9425C8FA1D003C2166 /* MediaLoaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaLoaderView.swift; sourceTree = ""; }; B8041AA625C90927003C2166 /* TypingIndicatorCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypingIndicatorCell.swift; sourceTree = ""; }; B80A579E23DFF1F300876683 /* NewClosedGroupVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewClosedGroupVC.swift; sourceTree = ""; }; + B81D25B726157F20004D1FE1 /* storage-seed-1.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "storage-seed-1.crt"; sourceTree = ""; }; + B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "public-loki-foundation.crt"; sourceTree = ""; }; + B81D25B926157F20004D1FE1 /* storage-seed-3.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "storage-seed-3.crt"; sourceTree = ""; }; B821494525D4D6FF009C0F2A /* URLModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLModal.swift; sourceTree = ""; }; B821494E25D4E163009C0F2A /* BodyTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BodyTextView.swift; sourceTree = ""; }; B82149B725D60393009C0F2A /* BlockedModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockedModal.swift; sourceTree = ""; }; @@ -3360,6 +3369,9 @@ C3C2A70A25539DF900C340D1 /* Meta */ = { isa = PBXGroup; children = ( + B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */, + B81D25B726157F20004D1FE1 /* storage-seed-1.crt */, + B81D25B926157F20004D1FE1 /* storage-seed-3.crt */, C3C2A6F225539DE700C340D1 /* SessionMessagingKit.h */, C3C2A6F325539DE700C340D1 /* Info.plist */, ); @@ -4170,6 +4182,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + B81D25BB26157F20004D1FE1 /* public-loki-foundation.crt in Resources */, + B81D25BC26157F20004D1FE1 /* storage-seed-3.crt in Resources */, + B81D25BA26157F20004D1FE1 /* storage-seed-1.crt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4202,10 +4217,12 @@ 34661FB820C1C0D60056EDD6 /* message_sent.aiff in Resources */, 45CB2FA81CB7146C00E1B343 /* Launch Screen.storyboard in Resources */, B633C5C31A1D190B0059AC12 /* mute_off@2x.png in Resources */, + B81D25C626157F40004D1FE1 /* public-loki-foundation.crt in Resources */, AD83FF411A73426500B5C81A /* audio_play_button_blue@2x.png in Resources */, 34C3C78D20409F320000134C /* Opening.m4r in Resources */, FC5CDF3A1A3393DD00B47253 /* warning_white@2x.png in Resources */, B633C58D1A1D190B0059AC12 /* contact_default_feed.png in Resources */, + B81D25C426157F40004D1FE1 /* storage-seed-3.crt in Resources */, C3CA3AB4255CDAE600F4C6D4 /* japanese.txt in Resources */, B10C9B621A7049EC00ECA2BF /* play_icon@2x.png in Resources */, B633C5861A1D190B0059AC12 /* call@2x.png in Resources */, @@ -4236,6 +4253,7 @@ 45B74A872044AAB600CD42F8 /* complete-quiet.aifc in Resources */, 45B74A772044AAB600CD42F8 /* hello.aifc in Resources */, 4C61819F219E1796009BD6B5 /* typing-animation-dark.gif in Resources */, + B81D25C526157F40004D1FE1 /* storage-seed-1.crt in Resources */, 45B74A7C2044AAB600CD42F8 /* hello-quiet.aifc in Resources */, 45B74A792044AAB600CD42F8 /* input.aifc in Resources */, C3CA3ABE255CDB0D00F4C6D4 /* portuguese.txt in Resources */, diff --git a/SessionMessagingKit/Meta/public-loki-foundation.crt b/SessionMessagingKit/Meta/public-loki-foundation.crt new file mode 100644 index 000000000..1500497d8 --- /dev/null +++ b/SessionMessagingKit/Meta/public-loki-foundation.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEFzCCAv+gAwIBAgIUHsrOj+bkbwe+j/etfYUm8nuDv/0wDQYJKoZIhvcNAQEL +BQAwgZoxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJ +TWVsYm91cm5lMSUwIwYDVQQKDBxPeGVuIFByaXZhY3kgVGVjaCBGb3VuZGF0aW9u +MR8wHQYDVQQDDBZwdWJsaWMubG9raS5mb3VuZGF0aW9uMRwwGgYJKoZIhvcNAQkB +Fg1qYXNvbkBveGVuLmlvMB4XDTIxMDQwMTAwMzk1N1oXDTIzMDQwMTAwMzk1N1ow +gZoxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJTWVs +Ym91cm5lMSUwIwYDVQQKDBxPeGVuIFByaXZhY3kgVGVjaCBGb3VuZGF0aW9uMR8w +HQYDVQQDDBZwdWJsaWMubG9raS5mb3VuZGF0aW9uMRwwGgYJKoZIhvcNAQkBFg1q +YXNvbkBveGVuLmlvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA19gW +hE/zAboA7GKLsWeClfR5OQeQ5AyZLw1OsFlz+niVpo8yjImdkiPkHVs1jhXVcwJy +iCUjAVw9r7Jlzdjoly32X1c92KW5yUrTtDjyySZX5rXUkrczKzQEE8RP6Wz+Re7/ +fXvqUD84wudpEhxk4Pgbhy0iEmGyMsWH4aipH3Jg2pgWfdVxCRrQY1NRGHhcg0bi +ziy19Rm4+RfesLRNtSd9/v8NMGj3EkyMzqOorkZwb/dZYBA421BtAPEnvPYrcZ7E +Jv8teLYC4hc3GFf4MnZKK5N4BGN33d/7U62CiiK3xWjNJiF3qUJIzT1i5kYbAH6l +yy9qiAxLm3bIK7zfdwIDAQABo1MwUTAdBgNVHQ4EFgQUr76UyP7smu1jeBeH4luz +4UXaFUkwHwYDVR0jBBgwFoAUr76UyP7smu1jeBeH4luz4UXaFUkwDwYDVR0TAQH/ +BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEACy8vA/fGPc1vb+ZcT/aHC/tJOUa2 +7mfOR3ANvAL4Klo7Gj2I/Dofk7EODPnk1DEHEJBLU+xh5ShbRdRqrQP+3u094xkA +D9fee4gM+X2fNms/vO2u1EtoLCkkTQZYzI+O73MO5D4SAtQ3zo/lfHyk/L8dZ6tc +NLCVcF+lf82nOvBl4hD3+WGuHDpjOnBiOCv1W7tdN8dT0tsGrzXKrIAayvr9YKoJ +HTFDryDUX9nAqrnGPsJ8bB1qul/TgeliSqGgoN90t9RkQ3/7aaqaAS8IkQBie57X +sgVl0RL9+uaty/Wr2WBE1v/4qXUSbaQK2zWOA9rvrtScbjVB1J9PABYheA== +-----END CERTIFICATE----- diff --git a/SessionMessagingKit/Meta/storage-seed-1.crt b/SessionMessagingKit/Meta/storage-seed-1.crt new file mode 100644 index 000000000..4a554e476 --- /dev/null +++ b/SessionMessagingKit/Meta/storage-seed-1.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIID8TCCAtmgAwIBAgIUFABTr4FKSbmN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7kCH +AbI4/G+Wamqh1dz7CwitS6j9RLKvMqA4x9abs97xxIh17FD5VGysgwOz9JatmkFn +eeBhO6O1xF2z1VKUUe0jn/HRgoYK9Lvv7J+LgwQRmERl4/vrpVHcQObC1h2DuwPx +C9qrQY2yyrYLYfkh+f6Mh5K8i6ln8wbo1WdEMK93uf7EqHKX74lLQslokqy/Biov +CjDxRPUcGp2Jbs33t44C3S/PJ7hlNTy6qK0polwquxiEIDuD5QPx5wIYSZVRUvJD +Oy17c4Q= +-----END CERTIFICATE----- diff --git a/SessionMessagingKit/Meta/storage-seed-3.crt b/SessionMessagingKit/Meta/storage-seed-3.crt new file mode 100644 index 000000000..e872a0ed4 --- /dev/null +++ b/SessionMessagingKit/Meta/storage-seed-3.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIID8TCCAtmgAwIBAgIUSBKbYheHOBeL/hz2QWEjag093cEwDQYJKoZIhvcNAQEL +BQAwgYcxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJ +TWxlYm91cm5lMRAwDgYDVQQKDAdTZXNzaW9uMSMwIQYDVQQDDBpzdG9yYWdlLnNl +ZWQzLmxva2kubmV0d29yazEaMBgGCSqGSIb3DQEJARYLa2VlQG94ZW4uaW8wHhcN +MjEwNDAxMDIzMzA4WhcNMjMwMzE0MDIzMzA4WjCBhzELMAkGA1UEBhMCQVUxETAP +BgNVBAgMCFZpY3RvcmlhMRIwEAYDVQQHDAlNbGVib3VybmUxEDAOBgNVBAoMB1Nl +c3Npb24xIzAhBgNVBAMMGnN0b3JhZ2Uuc2VlZDMubG9raS5uZXR3b3JrMRowGAYJ +KoZIhvcNAQkBFgtrZWVAb3hlbi5pbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAMJzm7p+HZmhgFo4s2xjwD5YatI2j363z0PxUZy8S1XS4TcCXQ8NNDHF +38IRhx67wI4lW4Y66JDpATtPh+FQv5TBkugKIFwTNqfCYcB7a+on4K2/rU9/CL8O +V3voh7DQs6kMijKG1JMR1A1Y1Qzyzo3SRupbGwuFOQCrcWUv+YvU8EffQDPR0vqN +Be1okHR2L3Dg556Zwx2mljgLq528qNAoqfkyrbV7NJzetVA43FKm4jfHN9tlkH4R +GP691rfs4MSVxVG5Sj2N7B93CD4gd3sIg2/Gxq04BYSNOQLro2a6zim3Uk3oU5W/ +k5YDq4/VrM4+09ZJNS3LXSBxrsadNGkCAwEAAaNTMFEwHQYDVR0OBBYEFKppE5WH +aQqhNGU8AOyaQ27MReAqMB8GA1UdIwQYMBaAFKppE5WHaQqhNGU8AOyaQ27MReAq +MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJSMnGDQ6U+F0Ete +Jx8mHxvQy8/uZ1YhN2VR1w9vDNhOLaaqDx0Mx2DDpSOm06uVU3vltRX+jSgdjg2u +n8uLQfj/E/d8cnNjv1lnkVsvUvlOyMuYSNc0e69rAhQ++o8ll+zy4OLWAv4Z4GnH +VGX9oRWl3JOfE8BRKni+WcdXpR6xstASg0npR2jmcPMKLljHC/FVwK5cMWY7klZu +ZIfRzyWJofO9YQr0w9NLa3TH7O6C9PwDS0GKUZLESjmz0EnKMU9957K5Y8QpnU4R +VXsnny+FCPSQtCynUGUYtibl3g3c1fMswr0yyG1T5p4s0BB1y8TaLnxmrn9DvN3X +CQ5Rsx4= +-----END CERTIFICATE----- From 58748471a4f89d803563a518f9524f04a3ddb7cd Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 1 Apr 2021 15:27:44 +1100 Subject: [PATCH 2/9] Set up skeleton code --- SessionSnodeKit/SnodeAPI.swift | 2 +- SessionUtilitiesKit/Networking/HTTP.swift | 37 +++++++++++++++-------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/SessionSnodeKit/SnodeAPI.swift b/SessionSnodeKit/SnodeAPI.swift index 2e76d8c05..f7f596646 100644 --- a/SessionSnodeKit/SnodeAPI.swift +++ b/SessionSnodeKit/SnodeAPI.swift @@ -154,7 +154,7 @@ public final class SnodeAPI : NSObject { let (promise, seal) = Promise.pending() Threading.workQueue.async { attempt(maxRetryCount: 4, recoveringOn: Threading.workQueue) { - HTTP.execute(.post, url, parameters: parameters, useSSLURLSession: true).map2 { json -> Snode in + HTTP.execute(.post, url, parameters: parameters, useSeedNodeURLSession: true).map2 { json -> Snode in guard let intermediate = json["result"] as? JSON, let rawSnodes = intermediate["service_node_states"] as? [JSON] else { throw Error.snodePoolUpdatingFailed } let snodePool: Set = Set(rawSnodes.compactMap { rawSnode in guard let address = rawSnode["public_ip"] as? String, let port = rawSnode["storage_port"] as? Int, diff --git a/SessionUtilitiesKit/Networking/HTTP.swift b/SessionUtilitiesKit/Networking/HTTP.swift index cf4ab2d94..6c4d74205 100644 --- a/SessionUtilitiesKit/Networking/HTTP.swift +++ b/SessionUtilitiesKit/Networking/HTTP.swift @@ -2,15 +2,28 @@ import Foundation import PromiseKit public enum HTTP { - private static let sslURLSession = URLSession(configuration: .ephemeral) - private static let defaultURLSession = URLSession(configuration: .ephemeral, delegate: defaultURLSessionDelegate, delegateQueue: nil) - private static let defaultURLSessionDelegate = DefaultURLSessionDelegateImplementation() + private static let seedNodeURLSession = URLSession(configuration: .ephemeral, delegate: seedNodeURLSessionDelegate, delegateQueue: nil) + private static let seedNodeURLSessionDelegate = SeedNodeURLSessionDelegateImplementation() + private static let snodeURLSession = URLSession(configuration: .ephemeral, delegate: snodeURLSessionDelegate, delegateQueue: nil) + private static let snodeURLSessionDelegate = SnodeURLSessionDelegateImplementation() // MARK: Settings public static let timeout: TimeInterval = 10 - // MARK: URL Session Delegate Implementation - private final class DefaultURLSessionDelegateImplementation : NSObject, URLSessionDelegate { + // MARK: Seed Node URL Session Delegate Implementation + private final class SeedNodeURLSessionDelegateImplementation : NSObject, URLSessionDelegate { + + func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { + + // TODO: Implement + + // Snode to snode communication uses self-signed certificates but clients can safely ignore this + completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!)) + } + } + + // MARK: Snode URL Session Delegate Implementation + private final class SnodeURLSessionDelegateImplementation : NSObject, URLSessionDelegate { func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { // Snode to snode communication uses self-signed certificates but clients can safely ignore this @@ -42,32 +55,32 @@ public enum HTTP { } // MARK: Main - public static func execute(_ verb: Verb, _ url: String, timeout: TimeInterval = HTTP.timeout, useSSLURLSession: Bool = false) -> Promise { - return execute(verb, url, body: nil, timeout: timeout, useSSLURLSession: useSSLURLSession) + public static func execute(_ verb: Verb, _ url: String, timeout: TimeInterval = HTTP.timeout, useSeedNodeURLSession: Bool = false) -> Promise { + return execute(verb, url, body: nil, timeout: timeout, useSeedNodeURLSession: useSeedNodeURLSession) } - public static func execute(_ verb: Verb, _ url: String, parameters: JSON?, timeout: TimeInterval = HTTP.timeout, useSSLURLSession: Bool = false) -> Promise { + public static func execute(_ verb: Verb, _ url: String, parameters: JSON?, timeout: TimeInterval = HTTP.timeout, useSeedNodeURLSession: Bool = false) -> Promise { if let parameters = parameters { do { guard JSONSerialization.isValidJSONObject(parameters) else { return Promise(error: Error.invalidJSON) } let body = try JSONSerialization.data(withJSONObject: parameters, options: [ .fragmentsAllowed ]) - return execute(verb, url, body: body, timeout: timeout, useSSLURLSession: useSSLURLSession) + return execute(verb, url, body: body, timeout: timeout, useSeedNodeURLSession: useSeedNodeURLSession) } catch (let error) { return Promise(error: error) } } else { - return execute(verb, url, body: nil, timeout: timeout, useSSLURLSession: useSSLURLSession) + return execute(verb, url, body: nil, timeout: timeout, useSeedNodeURLSession: useSeedNodeURLSession) } } - public static func execute(_ verb: Verb, _ url: String, body: Data?, timeout: TimeInterval = HTTP.timeout, useSSLURLSession: Bool = false) -> Promise { + public static func execute(_ verb: Verb, _ url: String, body: Data?, timeout: TimeInterval = HTTP.timeout, useSeedNodeURLSession: Bool = false) -> Promise { var request = URLRequest(url: URL(string: url)!) request.httpMethod = verb.rawValue request.httpBody = body request.timeoutInterval = timeout request.allHTTPHeaderFields?.removeValue(forKey: "User-Agent") let (promise, seal) = Promise.pending() - let urlSession = useSSLURLSession ? sslURLSession : defaultURLSession + let urlSession = useSeedNodeURLSession ? seedNodeURLSession : snodeURLSession let task = urlSession.dataTask(with: request) { data, response, error in guard let data = data, let response = response as? HTTPURLResponse else { if let error = error { From edc4a7a71bf58ea6c7c13a591ab40ec83f9c6357 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 1 Apr 2021 15:28:52 +1100 Subject: [PATCH 3/9] Move files --- Session.xcodeproj/project.pbxproj | 18 +++++++++--------- .../Meta/public-loki-foundation.crt | 0 .../Meta/storage-seed-1.crt | 0 .../Meta/storage-seed-3.crt | 0 4 files changed, 9 insertions(+), 9 deletions(-) rename {SessionMessagingKit => SessionUtilitiesKit}/Meta/public-loki-foundation.crt (100%) rename {SessionMessagingKit => SessionUtilitiesKit}/Meta/storage-seed-1.crt (100%) rename {SessionMessagingKit => SessionUtilitiesKit}/Meta/storage-seed-3.crt (100%) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 4b3f63942..5b7ac9d7e 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -186,12 +186,12 @@ B8041A9525C8FA1D003C2166 /* MediaLoaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8041A9425C8FA1D003C2166 /* MediaLoaderView.swift */; }; B8041AA725C90927003C2166 /* TypingIndicatorCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8041AA625C90927003C2166 /* TypingIndicatorCell.swift */; }; B80A579F23DFF1F300876683 /* NewClosedGroupVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B80A579E23DFF1F300876683 /* NewClosedGroupVC.swift */; }; - B81D25BA26157F20004D1FE1 /* storage-seed-1.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B726157F20004D1FE1 /* storage-seed-1.crt */; }; - B81D25BB26157F20004D1FE1 /* public-loki-foundation.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */; }; - B81D25BC26157F20004D1FE1 /* storage-seed-3.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B926157F20004D1FE1 /* storage-seed-3.crt */; }; B81D25C426157F40004D1FE1 /* storage-seed-3.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B926157F20004D1FE1 /* storage-seed-3.crt */; }; B81D25C526157F40004D1FE1 /* storage-seed-1.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B726157F20004D1FE1 /* storage-seed-1.crt */; }; B81D25C626157F40004D1FE1 /* public-loki-foundation.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */; }; + B81D25EA2615836C004D1FE1 /* public-loki-foundation.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */; }; + B81D25EB2615836C004D1FE1 /* storage-seed-1.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B726157F20004D1FE1 /* storage-seed-1.crt */; }; + B81D25EC2615836C004D1FE1 /* storage-seed-3.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B926157F20004D1FE1 /* storage-seed-3.crt */; }; B821494625D4D6FF009C0F2A /* URLModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821494525D4D6FF009C0F2A /* URLModal.swift */; }; B821494F25D4E163009C0F2A /* BodyTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821494E25D4E163009C0F2A /* BodyTextView.swift */; }; B82149B825D60393009C0F2A /* BlockedModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B82149B725D60393009C0F2A /* BlockedModal.swift */; }; @@ -3339,6 +3339,9 @@ C3C2A68B255388D500C340D1 /* Meta */ = { isa = PBXGroup; children = ( + B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */, + B81D25B726157F20004D1FE1 /* storage-seed-1.crt */, + B81D25B926157F20004D1FE1 /* storage-seed-3.crt */, C3C2A67B255388CC00C340D1 /* SessionUtilitiesKit.h */, C3C2A67C255388CC00C340D1 /* Info.plist */, ); @@ -3369,9 +3372,6 @@ C3C2A70A25539DF900C340D1 /* Meta */ = { isa = PBXGroup; children = ( - B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */, - B81D25B726157F20004D1FE1 /* storage-seed-1.crt */, - B81D25B926157F20004D1FE1 /* storage-seed-3.crt */, C3C2A6F225539DE700C340D1 /* SessionMessagingKit.h */, C3C2A6F325539DE700C340D1 /* Info.plist */, ); @@ -4175,6 +4175,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + B81D25EB2615836C004D1FE1 /* storage-seed-1.crt in Resources */, + B81D25EC2615836C004D1FE1 /* storage-seed-3.crt in Resources */, + B81D25EA2615836C004D1FE1 /* public-loki-foundation.crt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4182,9 +4185,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - B81D25BB26157F20004D1FE1 /* public-loki-foundation.crt in Resources */, - B81D25BC26157F20004D1FE1 /* storage-seed-3.crt in Resources */, - B81D25BA26157F20004D1FE1 /* storage-seed-1.crt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/SessionMessagingKit/Meta/public-loki-foundation.crt b/SessionUtilitiesKit/Meta/public-loki-foundation.crt similarity index 100% rename from SessionMessagingKit/Meta/public-loki-foundation.crt rename to SessionUtilitiesKit/Meta/public-loki-foundation.crt diff --git a/SessionMessagingKit/Meta/storage-seed-1.crt b/SessionUtilitiesKit/Meta/storage-seed-1.crt similarity index 100% rename from SessionMessagingKit/Meta/storage-seed-1.crt rename to SessionUtilitiesKit/Meta/storage-seed-1.crt diff --git a/SessionMessagingKit/Meta/storage-seed-3.crt b/SessionUtilitiesKit/Meta/storage-seed-3.crt similarity index 100% rename from SessionMessagingKit/Meta/storage-seed-3.crt rename to SessionUtilitiesKit/Meta/storage-seed-3.crt From 8d2e81ddde33572f969dd60caaca125bf1f722d2 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 1 Apr 2021 15:51:14 +1100 Subject: [PATCH 4/9] Trust only self-signed seed node certificates --- SessionUtilitiesKit/Networking/HTTP.swift | 27 ++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/SessionUtilitiesKit/Networking/HTTP.swift b/SessionUtilitiesKit/Networking/HTTP.swift index 6c4d74205..ddabe8f9d 100644 --- a/SessionUtilitiesKit/Networking/HTTP.swift +++ b/SessionUtilitiesKit/Networking/HTTP.swift @@ -7,6 +7,22 @@ public enum HTTP { private static let snodeURLSession = URLSession(configuration: .ephemeral, delegate: snodeURLSessionDelegate, delegateQueue: nil) private static let snodeURLSessionDelegate = SnodeURLSessionDelegateImplementation() + // MARK: Certificates + private static let storageSeed1Cert: Data = { + let path = Bundle.main.path(forResource: "storage-seed-1", ofType: "crt")! + return try! Data(contentsOf: URL(string: path)!) + }() + + private static let storageSeed3Cert: Data = { + let path = Bundle.main.path(forResource: "storage-seed-3", ofType: "crt")! + return try! Data(contentsOf: URL(string: path)!) + }() + + private static let publicLokiFoundationCert: Data = { + let path = Bundle.main.path(forResource: "public-loki-foundation", ofType: "crt")! + return try! Data(contentsOf: URL(string: path)!) + }() + // MARK: Settings public static let timeout: TimeInterval = 10 @@ -14,11 +30,12 @@ public enum HTTP { private final class SeedNodeURLSessionDelegateImplementation : NSObject, URLSessionDelegate { func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { - - // TODO: Implement - - // Snode to snode communication uses self-signed certificates but clients can safely ignore this - completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!)) + guard let trust = challenge.protectionSpace.serverTrust, let certificate = SecTrustGetCertificateAtIndex(trust, 0) else { return completionHandler(.cancelAuthenticationChallenge, nil) } + let data = SecCertificateCopyData(certificate) as Data + if storageSeed1Cert == data { return completionHandler(.useCredential, URLCredential(trust: trust)) } + if storageSeed3Cert == data { return completionHandler(.useCredential, URLCredential(trust: trust)) } + if publicLokiFoundationCert == data { return completionHandler(.useCredential, URLCredential(trust: trust)) } + return completionHandler(.cancelAuthenticationChallenge, nil) } } From 2687d9c96831687ab077d14551cce8d8180bd182 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 1 Apr 2021 16:31:17 +1100 Subject: [PATCH 5/9] Use proper API --- Session.xcodeproj/project.pbxproj | 26 +++++++------ .../Certificates}/public-loki-foundation.crt | 0 .../Meta/Certificates}/storage-seed-1.crt | 0 .../Meta/Certificates}/storage-seed-3.crt | 0 SessionUtilitiesKit/Networking/HTTP.swift | 38 +++++++++++++------ 5 files changed, 40 insertions(+), 24 deletions(-) rename {SessionUtilitiesKit/Meta => Session/Meta/Certificates}/public-loki-foundation.crt (100%) rename {SessionUtilitiesKit/Meta => Session/Meta/Certificates}/storage-seed-1.crt (100%) rename {SessionUtilitiesKit/Meta => Session/Meta/Certificates}/storage-seed-3.crt (100%) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 5b7ac9d7e..b074e7c2a 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -189,9 +189,6 @@ B81D25C426157F40004D1FE1 /* storage-seed-3.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B926157F20004D1FE1 /* storage-seed-3.crt */; }; B81D25C526157F40004D1FE1 /* storage-seed-1.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B726157F20004D1FE1 /* storage-seed-1.crt */; }; B81D25C626157F40004D1FE1 /* public-loki-foundation.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */; }; - B81D25EA2615836C004D1FE1 /* public-loki-foundation.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */; }; - B81D25EB2615836C004D1FE1 /* storage-seed-1.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B726157F20004D1FE1 /* storage-seed-1.crt */; }; - B81D25EC2615836C004D1FE1 /* storage-seed-3.crt in Resources */ = {isa = PBXBuildFile; fileRef = B81D25B926157F20004D1FE1 /* storage-seed-3.crt */; }; B821494625D4D6FF009C0F2A /* URLModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821494525D4D6FF009C0F2A /* URLModal.swift */; }; B821494F25D4E163009C0F2A /* BodyTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821494E25D4E163009C0F2A /* BodyTextView.swift */; }; B82149B825D60393009C0F2A /* BlockedModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = B82149B725D60393009C0F2A /* BlockedModal.swift */; }; @@ -2193,6 +2190,16 @@ path = "Content Views"; sourceTree = ""; }; + B81D260326158DF5004D1FE1 /* Certificates */ = { + isa = PBXGroup; + children = ( + B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */, + B81D25B726157F20004D1FE1 /* storage-seed-1.crt */, + B81D25B926157F20004D1FE1 /* storage-seed-3.crt */, + ); + path = Certificates; + sourceTree = ""; + }; B821493625D4D6A7009C0F2A /* Views & Modals */ = { isa = PBXGroup; children = ( @@ -3339,9 +3346,6 @@ C3C2A68B255388D500C340D1 /* Meta */ = { isa = PBXGroup; children = ( - B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */, - B81D25B726157F20004D1FE1 /* storage-seed-1.crt */, - B81D25B926157F20004D1FE1 /* storage-seed-3.crt */, C3C2A67B255388CC00C340D1 /* SessionUtilitiesKit.h */, C3C2A67C255388CC00C340D1 /* Info.plist */, ); @@ -3514,6 +3518,7 @@ C3F0A58F255C8E3D007BE2A3 /* Meta */ = { isa = PBXGroup; children = ( + B81D260326158DF5004D1FE1 /* Certificates */, 76EB03C218170B33006006FC /* AppDelegate.h */, 76EB03C318170B33006006FC /* AppDelegate.m */, C3AAFFF125AE99710089E6DD /* AppDelegate.swift */, @@ -4175,9 +4180,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - B81D25EB2615836C004D1FE1 /* storage-seed-1.crt in Resources */, - B81D25EC2615836C004D1FE1 /* storage-seed-3.crt in Resources */, - B81D25EA2615836C004D1FE1 /* public-loki-foundation.crt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4192,6 +4194,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + B81D25C526157F40004D1FE1 /* storage-seed-1.crt in Resources */, + B81D25C426157F40004D1FE1 /* storage-seed-3.crt in Resources */, + B81D25C626157F40004D1FE1 /* public-loki-foundation.crt in Resources */, 4C63CC00210A620B003AE45C /* SignalTSan.supp in Resources */, 4C6F527C20FFE8400097DEEE /* SignalUBSan.supp in Resources */, 34CF078A203E6B78005C4D61 /* end_call_tone_cept.caf in Resources */, @@ -4217,12 +4222,10 @@ 34661FB820C1C0D60056EDD6 /* message_sent.aiff in Resources */, 45CB2FA81CB7146C00E1B343 /* Launch Screen.storyboard in Resources */, B633C5C31A1D190B0059AC12 /* mute_off@2x.png in Resources */, - B81D25C626157F40004D1FE1 /* public-loki-foundation.crt in Resources */, AD83FF411A73426500B5C81A /* audio_play_button_blue@2x.png in Resources */, 34C3C78D20409F320000134C /* Opening.m4r in Resources */, FC5CDF3A1A3393DD00B47253 /* warning_white@2x.png in Resources */, B633C58D1A1D190B0059AC12 /* contact_default_feed.png in Resources */, - B81D25C426157F40004D1FE1 /* storage-seed-3.crt in Resources */, C3CA3AB4255CDAE600F4C6D4 /* japanese.txt in Resources */, B10C9B621A7049EC00ECA2BF /* play_icon@2x.png in Resources */, B633C5861A1D190B0059AC12 /* call@2x.png in Resources */, @@ -4253,7 +4256,6 @@ 45B74A872044AAB600CD42F8 /* complete-quiet.aifc in Resources */, 45B74A772044AAB600CD42F8 /* hello.aifc in Resources */, 4C61819F219E1796009BD6B5 /* typing-animation-dark.gif in Resources */, - B81D25C526157F40004D1FE1 /* storage-seed-1.crt in Resources */, 45B74A7C2044AAB600CD42F8 /* hello-quiet.aifc in Resources */, 45B74A792044AAB600CD42F8 /* input.aifc in Resources */, C3CA3ABE255CDB0D00F4C6D4 /* portuguese.txt in Resources */, diff --git a/SessionUtilitiesKit/Meta/public-loki-foundation.crt b/Session/Meta/Certificates/public-loki-foundation.crt similarity index 100% rename from SessionUtilitiesKit/Meta/public-loki-foundation.crt rename to Session/Meta/Certificates/public-loki-foundation.crt diff --git a/SessionUtilitiesKit/Meta/storage-seed-1.crt b/Session/Meta/Certificates/storage-seed-1.crt similarity index 100% rename from SessionUtilitiesKit/Meta/storage-seed-1.crt rename to Session/Meta/Certificates/storage-seed-1.crt diff --git a/SessionUtilitiesKit/Meta/storage-seed-3.crt b/Session/Meta/Certificates/storage-seed-3.crt similarity index 100% rename from SessionUtilitiesKit/Meta/storage-seed-3.crt rename to Session/Meta/Certificates/storage-seed-3.crt diff --git a/SessionUtilitiesKit/Networking/HTTP.swift b/SessionUtilitiesKit/Networking/HTTP.swift index ddabe8f9d..793b298b4 100644 --- a/SessionUtilitiesKit/Networking/HTTP.swift +++ b/SessionUtilitiesKit/Networking/HTTP.swift @@ -8,19 +8,22 @@ public enum HTTP { private static let snodeURLSessionDelegate = SnodeURLSessionDelegateImplementation() // MARK: Certificates - private static let storageSeed1Cert: Data = { + private static let storageSeed1Cert: SecCertificate = { let path = Bundle.main.path(forResource: "storage-seed-1", ofType: "crt")! - return try! Data(contentsOf: URL(string: path)!) + let data = try! Data(contentsOf: URL(fileURLWithPath: path)) + return SecCertificateCreateWithData(nil, data as CFData)! }() - private static let storageSeed3Cert: Data = { + private static let storageSeed3Cert: SecCertificate = { let path = Bundle.main.path(forResource: "storage-seed-3", ofType: "crt")! - return try! Data(contentsOf: URL(string: path)!) + let data = try! Data(contentsOf: URL(fileURLWithPath: path)) + return SecCertificateCreateWithData(nil, data as CFData)! }() - private static let publicLokiFoundationCert: Data = { + private static let publicLokiFoundationCert: SecCertificate = { let path = Bundle.main.path(forResource: "public-loki-foundation", ofType: "crt")! - return try! Data(contentsOf: URL(string: path)!) + let data = try! Data(contentsOf: URL(fileURLWithPath: path)) + return SecCertificateCreateWithData(nil, data as CFData)! }() // MARK: Settings @@ -30,12 +33,23 @@ public enum HTTP { private final class SeedNodeURLSessionDelegateImplementation : NSObject, URLSessionDelegate { func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { - guard let trust = challenge.protectionSpace.serverTrust, let certificate = SecTrustGetCertificateAtIndex(trust, 0) else { return completionHandler(.cancelAuthenticationChallenge, nil) } - let data = SecCertificateCopyData(certificate) as Data - if storageSeed1Cert == data { return completionHandler(.useCredential, URLCredential(trust: trust)) } - if storageSeed3Cert == data { return completionHandler(.useCredential, URLCredential(trust: trust)) } - if publicLokiFoundationCert == data { return completionHandler(.useCredential, URLCredential(trust: trust)) } - return completionHandler(.cancelAuthenticationChallenge, nil) + guard let trust = challenge.protectionSpace.serverTrust else { + return completionHandler(.cancelAuthenticationChallenge, nil) + } + // Mark the seed node certificates as trusted + let certificates = [ storageSeed1Cert, storageSeed3Cert, publicLokiFoundationCert ] + guard SecTrustSetAnchorCertificates(trust, certificates as CFArray) == errSecSuccess else { + return completionHandler(.cancelAuthenticationChallenge, nil) + } + // Check that the presented certificate is one of the trusted seed node certificates + var result: SecTrustResultType = .invalid + guard SecTrustEvaluate(trust, &result) == errSecSuccess else { + return completionHandler(.cancelAuthenticationChallenge, nil) + } + switch result { + case .proceed: return completionHandler(.useCredential, URLCredential(trust: trust)) + default: return completionHandler(.cancelAuthenticationChallenge, nil) + } } } From 75f5591fe05bdf7ea95cfb4c53f323f42f73e4d9 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 7 Apr 2021 09:25:45 +1000 Subject: [PATCH 6/9] Store certificates in DER format --- Session.xcodeproj/project.pbxproj | 12 ++++++++++++ .../Meta/Certificates/public-loki-foundation.der | Bin 0 -> 1051 bytes Session/Meta/Certificates/storage-seed-1.der | Bin 0 -> 1013 bytes Session/Meta/Certificates/storage-seed-3.der | Bin 0 -> 1013 bytes SessionSnodeKit/SnodeAPI.swift | 2 +- SessionUtilitiesKit/Networking/HTTP.swift | 6 +++--- 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 Session/Meta/Certificates/public-loki-foundation.der create mode 100644 Session/Meta/Certificates/storage-seed-1.der create mode 100644 Session/Meta/Certificates/storage-seed-3.der diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index b074e7c2a..917bce74b 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -676,6 +676,9 @@ C38EF40B255B6DF7007E1867 /* TappableStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3ED255B6DF6007E1867 /* TappableStackView.swift */; }; C38EF40C255B6DF7007E1867 /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3EE255B6DF6007E1867 /* GradientView.swift */; }; C38EF48A255B7E3F007E1867 /* SessionUIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C331FF1B2558F9D300070591 /* SessionUIKit.framework */; }; + C3A01E05261D24C400290BEB /* public-loki-foundation.der in Resources */ = {isa = PBXBuildFile; fileRef = C3A01E02261D24C400290BEB /* public-loki-foundation.der */; }; + C3A01E06261D24C400290BEB /* storage-seed-1.der in Resources */ = {isa = PBXBuildFile; fileRef = C3A01E03261D24C400290BEB /* storage-seed-1.der */; }; + C3A01E07261D24C400290BEB /* storage-seed-3.der in Resources */ = {isa = PBXBuildFile; fileRef = C3A01E04261D24C400290BEB /* storage-seed-3.der */; }; C3A3A08F256E1728004D228D /* FullTextSearchFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB7F255A581100E217F9 /* FullTextSearchFinder.swift */; }; C3A3A0EC256E1949004D228D /* OWSRecipientIdentity.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBEC255A581B00E217F9 /* OWSRecipientIdentity.m */; }; C3A3A0F5256E194C004D228D /* OWSRecipientIdentity.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDAA0255A57FF00E217F9 /* OWSRecipientIdentity.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -1712,6 +1715,9 @@ C396469E2509D40400B0B9F5 /* vi-VN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "vi-VN"; path = "vi-VN.lproj/Localizable.strings"; sourceTree = ""; }; C396469F2509D41100B0B9F5 /* id-ID */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "id-ID"; path = "id-ID.lproj/Localizable.strings"; sourceTree = ""; }; C39DD28724F3318C008590FC /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; + C3A01E02261D24C400290BEB /* public-loki-foundation.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "public-loki-foundation.der"; sourceTree = ""; }; + C3A01E03261D24C400290BEB /* storage-seed-1.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "storage-seed-1.der"; sourceTree = ""; }; + C3A01E04261D24C400290BEB /* storage-seed-3.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "storage-seed-3.der"; sourceTree = ""; }; C3A3A170256E1D25004D228D /* SSKReachabilityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSKReachabilityManager.swift; sourceTree = ""; }; C3A71D0A2558989C0043A11F /* MessageWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageWrapper.swift; sourceTree = ""; }; C3A71D1C25589AC30043A11F /* WebSocketProto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocketProto.swift; sourceTree = ""; }; @@ -2194,8 +2200,11 @@ isa = PBXGroup; children = ( B81D25B826157F20004D1FE1 /* public-loki-foundation.crt */, + C3A01E02261D24C400290BEB /* public-loki-foundation.der */, B81D25B726157F20004D1FE1 /* storage-seed-1.crt */, + C3A01E03261D24C400290BEB /* storage-seed-1.der */, B81D25B926157F20004D1FE1 /* storage-seed-3.crt */, + C3A01E04261D24C400290BEB /* storage-seed-3.der */, ); path = Certificates; sourceTree = ""; @@ -4212,6 +4221,7 @@ B6F509971AA53F760068F56A /* Localizable.strings in Resources */, B633C59D1A1D190B0059AC12 /* endcall@2x.png in Resources */, FC5CDF391A3393DD00B47253 /* error_white@2x.png in Resources */, + C3A01E05261D24C400290BEB /* public-loki-foundation.der in Resources */, B633C5D21A1D190B0059AC12 /* savephoto@2x.png in Resources */, B10C9B611A7049EC00ECA2BF /* play_icon.png in Resources */, AD83FF401A73426500B5C81A /* audio_pause_button_blue@2x.png in Resources */, @@ -4241,6 +4251,7 @@ 45B74A882044AAB600CD42F8 /* aurora.aifc in Resources */, 45B74A742044AAB600CD42F8 /* aurora-quiet.aifc in Resources */, 45B74A852044AAB600CD42F8 /* bamboo.aifc in Resources */, + C3A01E06261D24C400290BEB /* storage-seed-1.der in Resources */, 45B74A782044AAB600CD42F8 /* bamboo-quiet.aifc in Resources */, 45B74A7B2044AAB600CD42F8 /* chord.aifc in Resources */, C33FD4E9255A149100E217F9 /* Colors.xcassets in Resources */, @@ -4270,6 +4281,7 @@ C3CA3AC8255CDB2900F4C6D4 /* spanish.txt in Resources */, 34B6A90B218BA1D1007C4606 /* typing-animation.gif in Resources */, B8FF8E6225C10DA5004D1F22 /* GeoLite2-Country-Blocks-IPv4 in Resources */, + C3A01E07261D24C400290BEB /* storage-seed-3.der in Resources */, 45B74A802044AAB600CD42F8 /* pulse-quiet.aifc in Resources */, 45B74A8B2044AAB600CD42F8 /* synth.aifc in Resources */, 45B74A752044AAB600CD42F8 /* synth-quiet.aifc in Resources */, diff --git a/Session/Meta/Certificates/public-loki-foundation.der b/Session/Meta/Certificates/public-loki-foundation.der new file mode 100644 index 0000000000000000000000000000000000000000..bf277ea9ac906538ec5ef0788f7dde65b980a993 GIT binary patch literal 1051 zcmXqLVi7lJV*0;;nTe5!Nks0{x&CKQ^4a(Ge_vbMs`jb6dH-JnUN%mxHjlRNyo`+8 ztPBQ?vkbWnIN6v(S=fY`977ES4fsJE4jzuM%;b{%qRd1?Ap-%B5IYa2Z)#3berZu& zs-dcZGDwVzN5;P*HBTX+D6=dvxl$n{H914UEx$A`C9xzkKhIF!Ko+EonMbUkG$|)D zSuZC)J5w(Wp+Lq!3ho|GMls&3#NzxshkT%!dYSnKa^k#3h6W}Eh6V=4mZs)WK&~+o zcW^ttiBSnTuo+nyn41{+84Q{jxtN+585yqM5Nq-O%(#o;O;Y#9^rop_DlOS3JmHzC z&+E4#viMiU)MfofJ)LtWDL;{oHtiF=TFg|`p{mRnW4nG+>e(AFrt5x-54XLsbmvL0 z%Udiyom2~dw)M)S?Z(e=a!OrD4i1#4h-r3vbWUgMSIHee#qVv{;=5J7_TPVAgN*M&K0W6a zuUO|+kpDe0LBQg6KrX{a^*!IT3+EkC`>$KEjp>oNxkUI6qcSh;$rUWg<#+G@4qn^T zrL_HM##uGR@|8{=XKj<7xk)qBEj_KD)xqOEyX=Jap8MrY%!~|-i-QdU!D&R6k420{ zWc|J=C;q*e^)|Uey!}!1=7+AgL_H1Ufk{YKnMJ}ttO2_MP>PimW@P-&!fL<_q>zIh zn8ty@&d9*6uh0DbnC;p8{AV%#-`crDKfB!OL+T@e?>`gQ$yg;@6(m_` ze~sQ9YkoZV(rvc&rl;04NS*riH(?d0tfBLIg)8wl53JgG%u`rnzWW-;n>Ok_x^o_Bo{YwAUzzrUWXJ^gj{%>vGZ{HrsgE&mloxv z8VVTjfyB6Y*n?Axi!<}{43!NOK_bjNQpG@RiRr0&#i^+&hI%>q*_nEIsU_w4McIZ@ z1`=@VIT^*cvr|(Y@+(sF^fL1eS3=ND-EDX$|fLvn(V?z@tcM!R>iBSnT z7#Ud^n41{+84Q{jxtN+585v$WzqRI1u30PDC@Ru)eZ7~x6yx<~tvwwzxowk}M0g8& z>lP+-Y~=qrOLN8g*|XHum+_zaY#BA&nnuoXUpnJ*QKWgcHfqjWnyMzU|bw*5NIF^OcJtuEMhDo8Z9k% z!zAAw`hAe~XJx6iL$G?+9|L)iv@(l?fmj1}1)#JjE6m9FpM}+c8Au@qJ23SEgPoBf zH$X#dR{690=Y3k|&k8i2%K1WCu2eze#VSRXRf*>7L>GOWCeF&z(v@)VHRIxDua}6H%>tru@S61(|o(3HTp%JV;7Y-;2Bvitp;`Q6Pdf-_uFAOC*6H1LkY zvqRTpn|CvRf#mvcqxIt literal 0 HcmV?d00001 diff --git a/Session/Meta/Certificates/storage-seed-3.der b/Session/Meta/Certificates/storage-seed-3.der new file mode 100644 index 0000000000000000000000000000000000000000..3f50854a558e2efc6d4e6f12b3e9ee36c9ebcff4 GIT binary patch literal 1013 zcmXqLV*Y5*#B_53GZP~dlZc1V>?HAa3-RuMGT$5%m9uzl?;bSZW#iOp^Jx3d%gD&h z%3#pgZpdxG$;KSY!Y0h*7-}eJzz^bZ@Nk4>CYR(FWhNR583=%c*m*d8b5fJ?ON;VS z4FwGNKw?}x?7^wU#hLkehROztAQ5IBsbZkE#Pn3X;?&d>W4)aG>`cA9)ROZ2qHIGc z0|~hGoQz`J*{P`x`4y>odYSnKa^k#3h6W}Eh6YB)#s(HqK(4WYv7rf+JBVD`#HfTE zjEt-d%uS5^3c=e0+4Hq`Ai(;1&e>hQ=4q;XI#!`@-LbhQnM}-#42+9|4FU~hfk{G^k420{WL2i{ z)b>oSg(j&s3~y#R=bdqVpk*Krl2&GsFc53Nt^kx4WrZ0T|Ff_fFas&%Ujm#Pb$K;;=?kaNze^8OG*1n@&Y#b7!%uhFDt=j>;|YhCDlfaddTMa> z)2*WadNpMGc-PH8-R=0}zwq~(qT=NJk?9ko^@D!;oj5(i4H$R=S%mDX9b_R^dgRPe+)ga zF2*p;dQw`$cFFNK@0z~+VfJ?H3Y>Jr%X0Gt&r^o}wa+*0 zOg^GH*H19CT7ABLE60}!TXdEOq)Kd4dwP%e&ehL4hxQts$PIorPv?R_>FFc4^lH-9 P)jRLGd!3UnaI+i$gMEHx literal 0 HcmV?d00001 diff --git a/SessionSnodeKit/SnodeAPI.swift b/SessionSnodeKit/SnodeAPI.swift index f7f596646..8712ccaea 100644 --- a/SessionSnodeKit/SnodeAPI.swift +++ b/SessionSnodeKit/SnodeAPI.swift @@ -18,7 +18,7 @@ public final class SnodeAPI : NSObject { // MARK: Settings private static let maxRetryCount: UInt = 8 private static let minimumSwarmSnodeCount = 3 - private static let seedNodePool: Set = [ "https://storage.seed1.loki.network", "https://storage.seed3.loki.network", "https://public.loki.foundation" ] + private static let seedNodePool: Set = [ "https://storage.seed1.loki.network:4433", "https://storage.seed3.loki.network:4433", "https://public.loki.foundation:4433" ] private static let snodeFailureThreshold = 3 private static let targetSwarmSnodeCount = 2 diff --git a/SessionUtilitiesKit/Networking/HTTP.swift b/SessionUtilitiesKit/Networking/HTTP.swift index 793b298b4..78c7f1960 100644 --- a/SessionUtilitiesKit/Networking/HTTP.swift +++ b/SessionUtilitiesKit/Networking/HTTP.swift @@ -9,19 +9,19 @@ public enum HTTP { // MARK: Certificates private static let storageSeed1Cert: SecCertificate = { - let path = Bundle.main.path(forResource: "storage-seed-1", ofType: "crt")! + let path = Bundle.main.path(forResource: "storage-seed-1", ofType: "der")! let data = try! Data(contentsOf: URL(fileURLWithPath: path)) return SecCertificateCreateWithData(nil, data as CFData)! }() private static let storageSeed3Cert: SecCertificate = { - let path = Bundle.main.path(forResource: "storage-seed-3", ofType: "crt")! + let path = Bundle.main.path(forResource: "storage-seed-3", ofType: "der")! let data = try! Data(contentsOf: URL(fileURLWithPath: path)) return SecCertificateCreateWithData(nil, data as CFData)! }() private static let publicLokiFoundationCert: SecCertificate = { - let path = Bundle.main.path(forResource: "public-loki-foundation", ofType: "crt")! + let path = Bundle.main.path(forResource: "public-loki-foundation", ofType: "der")! let data = try! Data(contentsOf: URL(fileURLWithPath: path)) return SecCertificateCreateWithData(nil, data as CFData)! }() From f7a75a1b8021efb738f386012f36fa757159ae89 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 7 Apr 2021 11:34:28 +1000 Subject: [PATCH 7/9] Debug --- .../Certificates/public-loki-foundation.crt | 44 ++++++++--------- .../Certificates/public-loki-foundation.der | Bin 1051 -> 1047 bytes Session/Meta/Certificates/storage-seed-1.crt | 45 +++++++++--------- Session/Meta/Certificates/storage-seed-1.der | Bin 1013 -> 1061 bytes Session/Meta/Certificates/storage-seed-3.crt | 45 +++++++++--------- Session/Meta/Certificates/storage-seed-3.der | Bin 1013 -> 1061 bytes SessionUtilitiesKit/Networking/HTTP.swift | 9 +++- 7 files changed, 75 insertions(+), 68 deletions(-) diff --git a/Session/Meta/Certificates/public-loki-foundation.crt b/Session/Meta/Certificates/public-loki-foundation.crt index 1500497d8..344a05543 100644 --- a/Session/Meta/Certificates/public-loki-foundation.crt +++ b/Session/Meta/Certificates/public-loki-foundation.crt @@ -1,24 +1,24 @@ -----BEGIN CERTIFICATE----- -MIIEFzCCAv+gAwIBAgIUHsrOj+bkbwe+j/etfYUm8nuDv/0wDQYJKoZIhvcNAQEL -BQAwgZoxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJ -TWVsYm91cm5lMSUwIwYDVQQKDBxPeGVuIFByaXZhY3kgVGVjaCBGb3VuZGF0aW9u -MR8wHQYDVQQDDBZwdWJsaWMubG9raS5mb3VuZGF0aW9uMRwwGgYJKoZIhvcNAQkB -Fg1qYXNvbkBveGVuLmlvMB4XDTIxMDQwMTAwMzk1N1oXDTIzMDQwMTAwMzk1N1ow -gZoxCzAJBgNVBAYTAkFVMREwDwYDVQQID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BCwUAA4IBAQBql+JvoqpaYrFFTOuDn08U+pdcd3GM7tbI +zRH5LU+YnIpp9aRheek+2COW8DXsIy/kUngETCMLmX6ZaUj/WdHnTDkB0KTgxSHv +ad3ZznKPKZ26qJOklr+0ZWj4J3jHbisSzql6mqq7R2Kp4ESwzwqxvkbykM5RUnmz +Go/3Ol7bpN/ZVwwEkGfD/5rRHf57E/gZn2pBO+zotlQgr7HKRsIXQ2hIXVQqWmPQ +lvfIwrwAZlfES7BARFnHOpyVQxV8uNcV5K5eXzuVFjHBqvq+BtyGhWkP9yKJCHS9 +OUXxch0rzRsH2C/kRVVhEk0pI3qlFiRC8pCJs98SNE9l69EQtG7I -----END CERTIFICATE----- diff --git a/Session/Meta/Certificates/public-loki-foundation.der b/Session/Meta/Certificates/public-loki-foundation.der index bf277ea9ac906538ec5ef0788f7dde65b980a993..698980d78d9fa965243b5f6ded8748ba1a93b67e 100644 GIT binary patch delta 788 zcmbQuF`dK2povA;po!`C0%j&gCMJ>OD*-EaJlx2rQu<^;_@yt4&KIU{FyLk5)N1o+ z`_9YA$j!=NP&3iAM#(@amfO`j4(@q= zUN%|HbL7OGi4rODg@er{0`0u~aQM%+$!WH14S#!{IgJp$5{$AK#qR z`*Z2SL&=lzJQW#penc)yIWSkP{=UJJeXO6Cv)n#>^mfK2*Th$T>1#4m{2Q63buX1Q zVZ9Z@dBLv3>h@oTS*f-+tTv}xl=j`-wR!Hoy=P6s-_M_Xxl;PJz^~0|uYN?jaw&Xv z+r4szy^z|wjgxSj1f4>vP#yfIp$$ zNsx(|k%4h>V~;^&r-3XRbEqsIix`W@f3t;)e7yI43|YGK%xn9X2X(zR{V|XSNh`BR z7>G4sSHKTaAk4`4pM}+c8Aur@f&>IvqzojQ#0pB2ax#V*-L+zJ{gP?>x1?tLP_HhaoNei1!8um&oH*bEZ0r*6g@0`ea>Py!BKu!-K1S?PI&s)|$z$`(3G%qhzn8 s>&GHl?X%MCH}s#lh9(O6YARPP6;pBgG@*0zeIXP7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YKmJU36 z{|JAZnP7`rC1-e>#qK$K`E^5M1om*%pBL$5T<>xGo8i?)(H7-oIpxBf;KaXo?1XDF z)6H9!%}~F=wq`-*GRG(oZ2ju I!!-K^06le9`2YX_ delta 811 zcmZ3=@s-`wpo#gTK@-!>1a7??!?xyA;@h9*!hPE%#@nL0UwQL+A|^IL2F&?R17MQJYKqV|=C^eb9G$ zZo_+yB*SC(0zb_-d3%ds{If?)!F=C83Np?zX=P#X*PeM7+F~+ zW=00a#lZ%F2C~37k>z6%V-eA4X}KFF`R>r~gRDO*ORXJ()w})}$b+PnStJa^8n7$i z2PqI{Wc<&-<@P##1?8NXwNfXuMdZ$g(QYe4Xf` zkJH3iSz5Xh4!&kw-0bzzbKW}UwFaS_?;P40H(C72pO%%i@amo4+#GAYSNwI^wBBfe z#qn#iH{bhsq@(mrz|WAJHO->;Vj-f?(#=$dTvZsw2Nw^lp$ZaTG%JMpLD&woAbllFA4O#jUG z;%d5!!TR!@|BkFEn*P4i+v#M+q&555wDh?QKDvCBk(%3?clP`CKBl|+=hb(ln%eAI ju~u_YjMi?676t3(r_3LpGf8+(4Gj9^Y^__(RNMjprR7!` diff --git a/Session/Meta/Certificates/storage-seed-3.crt b/Session/Meta/Certificates/storage-seed-3.crt index e872a0ed4..92574b769 100644 --- a/Session/Meta/Certificates/storage-seed-3.crt +++ b/Session/Meta/Certificates/storage-seed-3.crt @@ -1,24 +1,25 @@ -----BEGIN CERTIFICATE----- -MIID8TCCAtmgAwIBAgIUSBKbYheHOBeL/hz2QWEjag093cEwDQYJKoZIhvcNAQEL -BQAwgYcxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJ -TWxlYm91cm5lMRAwDgYDVQQKDAdTZXNzaW9uMSMwIQYDVQQDDBpzdG9yYWdlLnNl -ZWQzLmxva2kubmV0d29yazEaMBgGCSqGSIb3DQEJARYLa2VlQG94ZW4uaW8wHhcN -MjEwNDAxMDIzMzA4WhcNMjMwM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wCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggEBAAYxmhhkcKE1n6g1 +JqOa3UCBo4EfbqY5+FDZ0FVqv/cwemwVpKLbe6luRIS8poomdPCyMOS45V7wN3H9 +cFpfJ1TW19ydPVKmCXrl29ngmnY1q7YDwE/4qi3VK/UiqDkTHMKWjVPkenOyi8u6 +VVQANXSnKrn6GtigNFjGyD38O+j7AUSXBtXOJczaoF6r6BWgwQZ2WmgjuwvKTWSN +4r8uObERoAQYVaeXfgdr4e9X/JdskBDaLFfoW/rrSozHB4FqVNFW96k+aIUgRa5p +9kv115QcBPCSh9qOyTHij4tswS6SyOFaiKrNC4hgHQXP4QgioKmtsR/2Y+qJ6ddH +6oo+4QU= -----END CERTIFICATE----- diff --git a/Session/Meta/Certificates/storage-seed-3.der b/Session/Meta/Certificates/storage-seed-3.der index 3f50854a558e2efc6d4e6f12b3e9ee36c9ebcff4..13239eb1a80faa56e529d33297af679e9f927e8b 100644 GIT binary patch delta 852 zcmey$zLdk%povA%poy7t0W%XL6O%}BzZJiJ#AUZDq95)hC3!Te>^v%Hz{|#|)#lOm zotKf3o0Y+!v0>tU9i7yir2NvNyi`L~17$YmP!=v88UKpZJcWRw%(BGfN`;Wr8p;N8;=D$N1||mP28Kokrbbaft}zmqJYy%PF)G%tUF58~A?E%vH93Aq zQ8P`RQ$L<=n^;xrC|iBmFKo+OQxoA=p3IZqf02pvPGY{5b^F);?JolvA5G|yeG$v; zD>yI0Fm~h8p0b;P*XoZQ+5Fm4c#ZJ!7`=OKx~tFE-#VPRLqGfOvp*Al#pd@`Kjs(a zn)LC4nn*@uxrg%Z1-cqhLiKV*^3SGBFkgNt)v;cc+g&#*n_5U>@|=D#)d2(ix`W@`B1NQn$qgYTkFeMUoU<9a%qpyS_65Iv@(l?fmj1} z1^gfd!iP3NyLRa-pku0!MEM)|yDmOlb+UI@+F|J|S}M|8=e+tn-cTw3-l>ryNE zu*u-bj;C=S%nSb(M8&IzT)Tc}u5HjV&Z?)kZ$6k+X1aPC^8x=Kt8}kwe^pvxDJ*kn zT5s@^s^U%Er+0;hFqoDs*V_3@>c#?-h+`*g|5(4M|IO$!o$cy5)ibvi#I1fIy5JyN zSyYDdZthdQDZP*O>sf9TT)-j`x_o*ad-lWk;eV#*Oc1!G6aFIl*K4nyN{!psJ}bspx&et52HF(o#pOGkYzppkV9#~%C#Hi Sza_uwe0kmdRhJ#pLskGxA delta 829 zcmZ3=@s-`wpo#gTK@-!>1^+bzVq|H*uFOjOR|wY_`LfR~L^tIebB zJ1-+6H!FidWBbG#I^sF0N%^Hkd8vj127GMHp)6cH?7^wU#gh#fHS7(g3?$%sI2pyb zvr|(Y@+(sF^fL1eS3=NEojSVcKfLvn(V?z@tm$30N_>7+%!Khe&sCf3S zI@y^E8=@>W=OiDni^#fU)?c^%yz|GvIeWZAFFiD8isk1uF+6(zkYKyq?gM?Q(QQ^Q zCcI>{_HTa}uz$+INiVn*Vua0>A4)t>o&8Gv!P@<6{p&gQ^MzNxXy0&Q^GcpBqqZxP z1+VZ%T;=(6uJ@ALt7vKNR!fG}g{k^KyX&ufaKGo66H3bT3m!b5H}kOU zvS}9FtLN@naY19{PouS4t4-$I+ZteTCurFt^W)~XQzz63O8nbWrAkaV-7&)?hEMhDot1^YBwr6rJG)c8#cr(j6?~LmMEdzOw zv@(l?fmj1}1^gfd!i`;>0yfI zse#w|^LcLg=`LHvFUxa0;qX%BWtUe^4X%E=RrFu4hHM}2y7{NO9e?~6{$5j5oV-6W zePXnJ&`-Y;r)PLvH>qBq%_L&?t6z2cn@ASS#G}IdCJhg_W7or$wxHj`U!?stIyYO<@hpTi_Y?ZREceB sPw(;Gx%ye>&|aexxxvro>0A&fJ$>YsUQOD%dgncNuXFMRGHsRv06V~0*8l(j diff --git a/SessionUtilitiesKit/Networking/HTTP.swift b/SessionUtilitiesKit/Networking/HTTP.swift index 78c7f1960..b2b1bdd7c 100644 --- a/SessionUtilitiesKit/Networking/HTTP.swift +++ b/SessionUtilitiesKit/Networking/HTTP.swift @@ -41,13 +41,18 @@ public enum HTTP { guard SecTrustSetAnchorCertificates(trust, certificates as CFArray) == errSecSuccess else { return completionHandler(.cancelAuthenticationChallenge, nil) } - // Check that the presented certificate is one of the trusted seed node certificates + // Check that the presented certificate is one of the seed node certificates var result: SecTrustResultType = .invalid guard SecTrustEvaluate(trust, &result) == errSecSuccess else { return completionHandler(.cancelAuthenticationChallenge, nil) } switch result { - case .proceed: return completionHandler(.useCredential, URLCredential(trust: trust)) + case .proceed, .unspecified: + // Unspecified indicates that evaluation reached an (implicitly trusted) anchor certificate without + // any evaluation failures, but never encountered any explicitly stated user-trust preference. This + // is the most common return value. The Keychain Access utility refers to this value as the "Use System + // Policy," which is the default user setting. + return completionHandler(.useCredential, URLCredential(trust: trust)) default: return completionHandler(.cancelAuthenticationChallenge, nil) } } From 57848d67016087c9c6d7bdc3da65ffa120f9e71c Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 7 Apr 2021 13:13:09 +1000 Subject: [PATCH 8/9] Fix info.plist --- Session/Meta/Session-Info.plist | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Session/Meta/Session-Info.plist b/Session/Meta/Session-Info.plist index e05788065..727fb665f 100644 --- a/Session/Meta/Session-Info.plist +++ b/Session/Meta/Session-Info.plist @@ -9,6 +9,27 @@ OSXVersion 10.15.6 + NSAppTransportSecurity + + NSExceptionDomains + + public.loki.foundation + + NSExceptionRequiresForwardSecrecy + + + storage.seed1.loki.network + + NSExceptionRequiresForwardSecrecy + + + storage.seed3.loki.network + + NSExceptionRequiresForwardSecrecy + + + + CFBundleDevelopmentRegion en CFBundleDisplayName From 330e4ce8adc9204d42d4e65cd0bc960e00528f18 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 7 Apr 2021 13:18:24 +1000 Subject: [PATCH 9/9] Fix unnecessary V2 open group requests --- Session/Home/HomeVC.swift | 4 +++- Session/Meta/AppDelegate.m | 2 +- SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Session/Home/HomeVC.swift b/Session/Home/HomeVC.swift index 13f962a83..6d573b4fc 100644 --- a/Session/Home/HomeVC.swift +++ b/Session/Home/HomeVC.swift @@ -154,7 +154,9 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv let _ = IP2Country.shared.populateCacheIfNeeded() } // Get default open group rooms if needed - OpenGroupAPIV2.getDefaultRoomsIfNeeded() + if OpenGroupManagerV2.useV2OpenGroups { + OpenGroupAPIV2.getDefaultRoomsIfNeeded() + } } override func viewDidAppear(_ animated: Bool) { diff --git a/Session/Meta/AppDelegate.m b/Session/Meta/AppDelegate.m index 4666e3a6c..458fca1a5 100644 --- a/Session/Meta/AppDelegate.m +++ b/Session/Meta/AppDelegate.m @@ -411,7 +411,7 @@ static NSTimeInterval launchStartedAt; } requiresSync:YES]; } - if (CurrentAppContext().isMainApp) { + if (CurrentAppContext().isMainApp && SNOpenGroupManagerV2.useV2OpenGroups) { [SNOpenGroupAPIV2 getDefaultRoomsIfNeeded]; } diff --git a/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift b/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift index 9efcff9a1..69e7a2c66 100644 --- a/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift +++ b/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift @@ -5,7 +5,7 @@ public final class OpenGroupManagerV2 : NSObject { private var pollers: [String:OpenGroupPollerV2] = [:] private var isPolling = false - public static var useV2OpenGroups = false + @objc public static var useV2OpenGroups = false // MARK: Initialization @objc public static let shared = OpenGroupManagerV2()