]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
Model: Move InterfaceConfiguration.publicKey to Curve25519.swift
authorRoopesh Chander <roop@roopc.net>
Thu, 8 Nov 2018 09:18:16 +0000 (14:48 +0530)
committerRoopesh Chander <roop@roopc.net>
Thu, 8 Nov 2018 09:18:25 +0000 (14:48 +0530)
The code for public key calculation need not be shared with the extension

Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/Shared/Model/Configuration.swift
WireGuard/WireGuard/Crypto/Curve25519.swift

index 2df363b2d2befa9df62e2d8d2927d4acc5be0807..cbe42712448bc6865994995f4b68ab6d957d6220 100644 (file)
@@ -21,10 +21,6 @@ struct InterfaceConfiguration: Codable {
     var mtu: UInt16?
     var dns: [DNSServer] = []
 
-    var publicKey: Data {
-        return Curve25519.generatePublicKey(fromPrivateKey: privateKey)
-    }
-
     init(name: String, privateKey: Data) {
         self.name = name
         self.privateKey = privateKey
index e0f9c0fd88fc341e089a1465140e53183803163d..84c35d3b2c8e1906986f53cd797d4b2879164fde 100644 (file)
@@ -25,3 +25,9 @@ struct Curve25519 {
         return publicKey
     }
 }
+
+extension InterfaceConfiguration {
+    var publicKey: Data {
+        return Curve25519.generatePublicKey(fromPrivateKey: privateKey)
+    }
+}