Model: Move InterfaceConfiguration.publicKey to Curve25519.swift

The code for public key calculation need not be shared with the extension

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2018-11-08 14:48:16 +05:30
parent fb6a7f6007
commit a473dfe4f8
2 changed files with 6 additions and 4 deletions
@@ -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
@@ -25,3 +25,9 @@ struct Curve25519 {
return publicKey
}
}
extension InterfaceConfiguration {
var publicKey: Data {
return Curve25519.generatePublicKey(fromPrivateKey: privateKey)
}
}