aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-10-24 12:22:48 +0530
committerRoopesh Chander <roop@roopc.net>2018-10-27 15:13:01 +0530
commitb6d41ec9de7c9d3d4a5eba053b1751acebb3224b (patch)
treeb1b69d45320c04eccb3a01dfb551d19153f8cce3
parentCrypto: Swift wrapper for the Curve25519 C code (diff)
downloadwireguard-apple-b6d41ec9de7c9d3d4a5eba053b1751acebb3224b.tar.xz
wireguard-apple-b6d41ec9de7c9d3d4a5eba053b1751acebb3224b.zip
Model: Interface: Add a public key computed property
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r--WireGuard/WireGuard/Model/Configuration.swift4
1 files changed, 4 insertions, 0 deletions
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