Introduce CryptographicKey protocol
This commit is contained in:
parent
d43a3be6f6
commit
6b95e60ea1
6 changed files with 30 additions and 24 deletions
36
passKit/Helpers/CryptographicKeys.swift
Normal file
36
passKit/Helpers/CryptographicKeys.swift
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// CryptographicKeys.swift
|
||||
// passKit
|
||||
//
|
||||
// Created by Danny Moesch on 29.06.19.
|
||||
// Copyright © 2019 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
public protocol CryptographicKey {
|
||||
func getKeychainKey() -> String
|
||||
func getFileSharingPath() -> String
|
||||
}
|
||||
|
||||
public enum PgpKey: CryptographicKey {
|
||||
case PUBLIC
|
||||
case PRIVATE
|
||||
|
||||
public func getKeychainKey() -> String {
|
||||
switch self {
|
||||
case .PUBLIC:
|
||||
return "pgpPublicKey"
|
||||
case .PRIVATE:
|
||||
return "pgpPrivateKey"
|
||||
}
|
||||
}
|
||||
|
||||
public func getFileSharingPath() -> String {
|
||||
switch self {
|
||||
case .PUBLIC:
|
||||
return Globals.iTunesFileSharingPGPPublic
|
||||
case .PRIVATE:
|
||||
return Globals.iTunesFileSharingPGPPrivate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue