From b6d41ec9de7c9d3d4a5eba053b1751acebb3224b Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 24 Oct 2018 12:22:48 +0530 Subject: [PATCH] Model: Interface: Add a public key computed property Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/Model/Configuration.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/WireGuard/WireGuard/Model/Configuration.swift b/WireGuard/WireGuard/Model/Configuration.swift index b430c8f..3cc59af 100644 --- a/WireGuard/WireGuard/Model/Configuration.swift +++ b/WireGuard/WireGuard/Model/Configuration.swift @@ -21,6 +21,10 @@ struct InterfaceConfiguration: Codable { var mtu: UInt64? = nil var dns: [DNSServer] = [] + var publicKey: Data { + return Curve25519.generatePublicKey(fromPrivateKey: privateKey) + } + init(name: String, privateKey: Data) { self.name = name self.privateKey = privateKey