Introduce CryptographicKey protocol

This commit is contained in:
Danny Moesch 2019-07-02 20:20:56 +02:00 committed by Mingshen Sun
parent d43a3be6f6
commit 6b95e60ea1
6 changed files with 30 additions and 24 deletions

View 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
}
}
}