Secure enclave implementation

This commit is contained in:
Max Goedjen
2020-03-03 23:14:38 -08:00
parent de2082f70e
commit 5965859d4a
38 changed files with 2718 additions and 608 deletions

View File

@@ -0,0 +1 @@
public enum SmartCard {}

View File

@@ -0,0 +1,14 @@
import Foundation
import Combine
extension SmartCard {
public struct Secret: SecretKit.Secret {
public let id: Data
public let name: String
public let publicKey: Data
}
}

View File

@@ -0,0 +1,29 @@
import Foundation
import Security
import CryptoTokenKit
extension SmartCard {
public class Store: SecretStore {
// TODO: Read actual smart card name, eg "YubiKey 5c"
public let name = NSLocalizedString("Smart Card", comment: "Smart Card")
@Published public fileprivate(set) var secrets: [Secret] = []
fileprivate let watcher = TKTokenWatcher()
public init() {
watcher.setInsertionHandler { (string) in
print(string)
}
print(watcher.tokenIDs)
}
public func sign(data: Data, with secret: SmartCard.Secret) throws -> Data {
fatalError()
}
public func delete(secret: SmartCard.Secret) throws {
}
}
}