diff --git a/Sources/ElixxirDAppsSDK/Connection.swift b/Sources/ElixxirDAppsSDK/Connection.swift index 5b7cb92078419e62f79000b66dc57849c46304b0..9f269119d17292807e95dbbcc1ec64c4a0d9e54d 100644 --- a/Sources/ElixxirDAppsSDK/Connection.swift +++ b/Sources/ElixxirDAppsSDK/Connection.swift @@ -2,6 +2,7 @@ import Bindings public struct Connection { public var isAuthenticated: () -> Bool + public var getPartner: () -> Data public var send: MessageSender public var listen: MessageListener } @@ -12,6 +13,12 @@ extension Connection { ) -> Connection { Connection( isAuthenticated: { false }, + getPartner: { + guard let data = bindingsConnection.getPartner() else { + fatalError("BindingsConnection.getPartner returned `nil`") + } + return data + }, send: .live(bindingsConnection: bindingsConnection), listen: .live(bindingsConnection: bindingsConnection) ) @@ -22,6 +29,12 @@ extension Connection { ) -> Connection { Connection( isAuthenticated: bindingsAuthenticatedConnection.isAuthenticated, + getPartner: { + guard let data = bindingsAuthenticatedConnection.getPartner() else { + fatalError("BindingsAuthenticatedConnection.getPartner returned `nil`") + } + return data + }, send: .live(bindingsAuthenticatedConnection: bindingsAuthenticatedConnection), listen: .live(bindingsAuthenticatedConnection: bindingsAuthenticatedConnection) ) @@ -32,6 +45,7 @@ extension Connection { extension Connection { public static let failing = Connection( isAuthenticated: { fatalError("Not implemented") }, + getPartner: { fatalError("Not implemented") }, send: .failing, listen: .failing )