Structure

This commit is contained in:
Max Goedjen
2020-02-18 20:52:00 -08:00
parent d0ab8b44b5
commit de2082f70e
9 changed files with 149 additions and 15 deletions

5
SecretKit/Secret.swift Normal file
View File

@@ -0,0 +1,5 @@
import Foundation
public protocol Secret: Identifiable, Hashable {
var id: String { get }
}

View File

@@ -0,0 +1,9 @@
import Foundation
import Combine
public protocol SecretStore: ObservableObject {
associatedtype SecretType: Secret
var secrets: [SecretType] { get }
}

View File

@@ -0,0 +1,3 @@
import Foundation
public enum SecureEnclave {}

View File

@@ -0,0 +1,12 @@
import Foundation
import Combine
extension SecureEnclave {
public struct Secret: SecretKit.Secret {
public let id: String
}
}

View File

@@ -0,0 +1,21 @@
import Foundation
import Security
extension SecureEnclave {
public class Store: SecretStore {
@Published public fileprivate(set) var secrets: [Secret] = []
public init() {
loadSecrets()
}
fileprivate func loadSecrets() {
let secret = Secret(id: "Test")
secrets.append(secret)
}
}
}