Model: Move InterfaceConfiguration.publicKey to Curve25519.swift

The code for public key calculation need not be shared with the extension
This commit is contained in:
Roopesh Chander 2018-11-08 14:48:16 +05:30
parent de92f2dcd8
commit 2afb2244ff
2 changed files with 6 additions and 4 deletions

View File

@ -21,10 +21,6 @@ struct InterfaceConfiguration: Codable {
var mtu: UInt16? var mtu: UInt16?
var dns: [DNSServer] = [] var dns: [DNSServer] = []
var publicKey: Data {
return Curve25519.generatePublicKey(fromPrivateKey: privateKey)
}
init(name: String, privateKey: Data) { init(name: String, privateKey: Data) {
self.name = name self.name = name
self.privateKey = privateKey self.privateKey = privateKey

View File

@ -25,3 +25,9 @@ struct Curve25519 {
return publicKey return publicKey
} }
} }
extension InterfaceConfiguration {
var publicKey: Data {
return Curve25519.generatePublicKey(fromPrivateKey: privateKey)
}
}