mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-05 09:24:49 +01:00
Secure enclave implementation
This commit is contained in:
1
SecretKit/SmartCard/SmartCard.swift
Normal file
1
SecretKit/SmartCard/SmartCard.swift
Normal file
@@ -0,0 +1 @@
|
||||
public enum SmartCard {}
|
||||
14
SecretKit/SmartCard/SmartCardSecret.swift
Normal file
14
SecretKit/SmartCard/SmartCardSecret.swift
Normal 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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
29
SecretKit/SmartCard/SmartCardStore.swift
Normal file
29
SecretKit/SmartCard/SmartCardStore.swift
Normal 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 {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user