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:
parent
de92f2dcd8
commit
2afb2244ff
|
@ -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
|
||||||
|
|
|
@ -25,3 +25,9 @@ struct Curve25519 {
|
||||||
return publicKey
|
return publicKey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension InterfaceConfiguration {
|
||||||
|
var publicKey: Data {
|
||||||
|
return Curve25519.generatePublicKey(fromPrivateKey: privateKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue