Setup
This commit is contained in:
parent
84dd9403c3
commit
747279f837
|
@ -18,6 +18,9 @@ let package = Package(
|
|||
.library(
|
||||
name: "SmartCardSecretKit",
|
||||
targets: ["SmartCardSecretKit"]),
|
||||
.library(
|
||||
name: "ProxyAgentSecretKit",
|
||||
targets: ["ProxyAgentSecretKit"]),
|
||||
.library(
|
||||
name: "SecretAgentKit",
|
||||
targets: ["SecretAgentKit"]),
|
||||
|
@ -47,6 +50,10 @@ let package = Package(
|
|||
name: "SmartCardSecretKit",
|
||||
dependencies: ["SecretKit"]
|
||||
),
|
||||
.target(
|
||||
name: "ProxyAgentSecretKit",
|
||||
dependencies: ["SecretKit", "SecretAgentKit"]
|
||||
),
|
||||
.target(
|
||||
name: "SecretAgentKit",
|
||||
dependencies: ["SecretKit", "SecretAgentKitHeaders"]
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/// Namespace for the Proxy Agent implementations.
|
||||
public enum ProxyAgent {}
|
|
@ -0,0 +1,19 @@
|
|||
import Foundation
|
||||
import Combine
|
||||
import SecretKit
|
||||
|
||||
extension SmartCard {
|
||||
|
||||
/// An implementation of Secret backed by a Smart Card.
|
||||
public struct Secret: SecretKit.Secret {
|
||||
|
||||
public let id: Data
|
||||
public let name: String
|
||||
public let algorithm: Algorithm
|
||||
public let keySize: Int
|
||||
public let requiresAuthentication: Bool = false
|
||||
public let publicKey: Data
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
import Foundation
|
||||
import Security
|
||||
import CryptoTokenKit
|
||||
import LocalAuthentication
|
||||
import SecretKit
|
||||
|
||||
extension ProxyAgent {
|
||||
|
||||
/// An implementation of Store backed by a Proxy Agent.
|
||||
public class Store: SecretStore {
|
||||
|
||||
@Published public var isAvailable: Bool = false
|
||||
public let id = UUID()
|
||||
public private(set) var name = NSLocalizedString("Proxy SSH Agent", comment: "Proxy SSH Agent")
|
||||
@Published public private(set) var secrets: [Secret] = []
|
||||
|
||||
/// Initializes a Store.
|
||||
public init() {
|
||||
}
|
||||
|
||||
// MARK: Public API
|
||||
|
||||
public func create(name: String) throws {
|
||||
fatalError("Keys must be created on the smart card.")
|
||||
}
|
||||
|
||||
public func delete(secret: Secret) throws {
|
||||
fatalError("Keys must be deleted on the smart card.")
|
||||
}
|
||||
|
||||
public func sign(data: Data, with secret: SecretType, for provenance: SigningRequestProvenance) throws -> Data {
|
||||
}
|
||||
|
||||
public func existingPersistedAuthenticationContext(secret: ProxyAgent.Secret) -> PersistedAuthenticationContext? {
|
||||
nil
|
||||
}
|
||||
|
||||
public func persistAuthentication(secret: ProxyAgent.Secret, forDuration: TimeInterval) throws {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ProxyAgent.Store {
|
||||
|
||||
}
|
||||
|
||||
extension ProxyAgent {
|
||||
|
||||
/// A signing-related error.
|
||||
public struct SigningError: Error {
|
||||
/// The underlying error reported by the API, if one was returned.
|
||||
public let error: SecurityError?
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue