From 5d9b26c16391fbe62b16e04bbf0677d2d6d65f88 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 27 Jul 2020 14:52:13 +1000 Subject: [PATCH] Clean --- .../Loki/API/Onion Requests/OnionRequestAPI+Encryption.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SignalServiceKit/src/Loki/API/Onion Requests/OnionRequestAPI+Encryption.swift b/SignalServiceKit/src/Loki/API/Onion Requests/OnionRequestAPI+Encryption.swift index b3bc3cc25..234915ff1 100644 --- a/SignalServiceKit/src/Loki/API/Onion Requests/OnionRequestAPI+Encryption.swift +++ b/SignalServiceKit/src/Loki/API/Onion Requests/OnionRequestAPI+Encryption.swift @@ -18,9 +18,8 @@ extension OnionRequestAPI { } /// - Note: Sync. Don't call from the main thread. - private static func encrypt(_ plaintext: Data, using hexEncodedX25519PublicKey: String?) throws -> EncryptionResult { + private static func encrypt(_ plaintext: Data, using hexEncodedX25519PublicKey: String) throws -> EncryptionResult { guard !Thread.isMainThread else { preconditionFailure("It's illegal to call encrypt(_:forSnode:) from the main thread.") } - guard let hexEncodedX25519PublicKey = hexEncodedX25519PublicKey else { throw Error.snodePublicKeySetMissing } let x25519PublicKey = Data(hex: hexEncodedX25519PublicKey) let ephemeralKeyPair = Curve25519.generateKeyPair() let ephemeralSharedSecret = try Curve25519.generateSharedSecret(fromPublicKey: x25519PublicKey, privateKey: ephemeralKeyPair.privateKey)