Introduce CryptographicKey protocol
This commit is contained in:
parent
d43a3be6f6
commit
6b95e60ea1
6 changed files with 30 additions and 24 deletions
|
|
@ -9,18 +9,18 @@
|
|||
public class KeyFileManager {
|
||||
public typealias KeyHandler = (Data, String) -> ()
|
||||
|
||||
public static let PublicPgp = KeyFileManager(keyType: PgpKeyType.PUBLIC)
|
||||
public static let PrivatePgp = KeyFileManager(keyType: PgpKeyType.PRIVATE)
|
||||
public static let PublicPgp = KeyFileManager(keyType: PgpKey.PUBLIC)
|
||||
public static let PrivatePgp = KeyFileManager(keyType: PgpKey.PRIVATE)
|
||||
|
||||
private let keyType: PgpKeyType
|
||||
private let keyType: CryptographicKey
|
||||
private let keyPath: String
|
||||
private let keyHandler: KeyHandler
|
||||
|
||||
private convenience init(keyType: PgpKeyType) {
|
||||
private convenience init(keyType: CryptographicKey) {
|
||||
self.init(keyType: keyType, keyPath: keyType.getFileSharingPath())
|
||||
}
|
||||
|
||||
public init(keyType: PgpKeyType, keyPath: String, keyHandler: @escaping KeyHandler = AppKeychain.add) {
|
||||
public init(keyType: CryptographicKey, keyPath: String, keyHandler: @escaping KeyHandler = AppKeychain.add) {
|
||||
self.keyType = keyType
|
||||
self.keyPath = keyPath
|
||||
self.keyHandler = keyHandler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue