mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-05 09:24:49 +01:00
Structure
This commit is contained in:
5
SecretKit/Secret.swift
Normal file
5
SecretKit/Secret.swift
Normal file
@@ -0,0 +1,5 @@
|
||||
import Foundation
|
||||
|
||||
public protocol Secret: Identifiable, Hashable {
|
||||
var id: String { get }
|
||||
}
|
||||
9
SecretKit/SecretStore.swift
Normal file
9
SecretKit/SecretStore.swift
Normal file
@@ -0,0 +1,9 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
public protocol SecretStore: ObservableObject {
|
||||
|
||||
associatedtype SecretType: Secret
|
||||
var secrets: [SecretType] { get }
|
||||
|
||||
}
|
||||
3
SecretKit/SecureEnclave/SecureEnclave.swift
Normal file
3
SecretKit/SecureEnclave/SecureEnclave.swift
Normal file
@@ -0,0 +1,3 @@
|
||||
import Foundation
|
||||
|
||||
public enum SecureEnclave {}
|
||||
12
SecretKit/SecureEnclave/SecureEnclaveSecret.swift
Normal file
12
SecretKit/SecureEnclave/SecureEnclaveSecret.swift
Normal file
@@ -0,0 +1,12 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
extension SecureEnclave {
|
||||
|
||||
public struct Secret: SecretKit.Secret {
|
||||
|
||||
public let id: String
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
21
SecretKit/SecureEnclave/SecureEnclaveStore.swift
Normal file
21
SecretKit/SecureEnclave/SecureEnclaveStore.swift
Normal 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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user