diff --git a/Sources/ElixxirDAppsSDK/Errors.swift b/Sources/ElixxirDAppsSDK/Errors.swift index ae4ae8ae8eb88d81cf516be75899e78f03811062..0f113897a48ac3055837e1256a4571da57b7f961 100644 --- a/Sources/ElixxirDAppsSDK/Errors.swift +++ b/Sources/ElixxirDAppsSDK/Errors.swift @@ -5,3 +5,7 @@ public struct BindingsDownloadAndVerifySignedNdfWithUrlUnknownError: Error, Equa public struct BindingsGenerateSecretUnknownError: Error, Equatable { public init() {} } + +public struct PasswordStorageMissingPasswordError: Error, Equatable { + public init() {} +} diff --git a/Sources/ElixxirDAppsSDK/PasswordStorage.swift b/Sources/ElixxirDAppsSDK/PasswordStorage.swift new file mode 100644 index 0000000000000000000000000000000000000000..82ae04dcd844cd97c365bec9fe2f1d9170043a59 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/PasswordStorage.swift @@ -0,0 +1,29 @@ +import Foundation + +public struct PasswordStorage { + public init( + save: @escaping (Data) throws -> Void, + load: @escaping () throws -> Data + ) { + self.save = save + self.load = load + } + + public var save: (Data) throws -> Void + public var load: () throws -> Data +} + +#if DEBUG +extension PasswordStorage { + public static let failing = PasswordStorage( + save: { _ in + struct NotImplemented: Error {} + throw NotImplemented() + }, + load: { + struct NotImplemented: Error {} + throw NotImplemented() + } + ) +} +#endif