diff --git a/Sources/ElixxirDAppsSDK/StoreReceptionIdentity.swift b/Sources/ElixxirDAppsSDK/StoreReceptionIdentity.swift new file mode 100644 index 0000000000000000000000000000000000000000..a56f212b76dbce6a4b6cdc2c95810407d5737911 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/StoreReceptionIdentity.swift @@ -0,0 +1,31 @@ +import Bindings +import XCTestDynamicOverlay + +public struct StoreReceptionIdentity { + public var run: (String, Data, Int) throws -> Bool + + public func callAsFunction( + key: String, + identity: Data, + cmixId: Int + ) throws -> Bool { + try run(key, identity, cmixId) + } +} + +extension StoreReceptionIdentity { + public static let live = StoreReceptionIdentity { key, identity, cmixId in + var error: NSError? + let result = BindingsStoreReceptionIdentity(key, identity, cmixId, &error) + if let error = error { + throw error + } + return result + } +} + +extension StoreReceptionIdentity { + public static let unimplemented = StoreReceptionIdentity( + run: XCTUnimplemented("\(Self.self)") + ) +}