From 7c4352be2befbadb90ec8269d226cea0be52e711 Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Fri, 26 Aug 2022 12:52:57 +0100
Subject: [PATCH] Use Contact model in AuthCallbacks.Callback

---
 Sources/XXClient/Callbacks/AuthCallbacks.swift       | 12 ++++++------
 .../TestHelpers/AuthCallback.Callback+stubs.swift    |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Sources/XXClient/Callbacks/AuthCallbacks.swift b/Sources/XXClient/Callbacks/AuthCallbacks.swift
index c6d2b867..83e6f936 100644
--- a/Sources/XXClient/Callbacks/AuthCallbacks.swift
+++ b/Sources/XXClient/Callbacks/AuthCallbacks.swift
@@ -3,9 +3,9 @@ import XCTestDynamicOverlay
 
 public struct AuthCallbacks {
   public enum Callback: Equatable {
-    case confirm(contact: Data, receptionId: Data, ephemeralId: Int64, roundId: Int64)
-    case request(contact: Data, receptionId: Data, ephemeralId: Int64, roundId: Int64)
-    case reset(contact: Data, receptionId: Data, ephemeralId: Int64, roundId: Int64)
+    case confirm(contact: Contact, receptionId: Data, ephemeralId: Int64, roundId: Int64)
+    case request(contact: Contact, receptionId: Data, ephemeralId: Int64, roundId: Int64)
+    case reset(contact: Contact, receptionId: Data, ephemeralId: Int64, roundId: Int64)
   }
 
   public init(handle: @escaping (Callback) -> Void) {
@@ -38,7 +38,7 @@ extension AuthCallbacks {
           fatalError("BindingsAuthCallbacks.confirm received `nil` receptionId")
         }
         callback.handle(.confirm(
-          contact: contact,
+          contact: Contact.live(contact),
           receptionId: receptionId,
           ephemeralId: ephemeralId,
           roundId: roundId
@@ -53,7 +53,7 @@ extension AuthCallbacks {
           fatalError("BindingsAuthCallbacks.request received `nil` receptionId")
         }
         callback.handle(.request(
-          contact: contact,
+          contact: Contact.live(contact),
           receptionId: receptionId,
           ephemeralId: ephemeralId,
           roundId: roundId
@@ -68,7 +68,7 @@ extension AuthCallbacks {
           fatalError("BindingsAuthCallbacks.reset received `nil` receptionId")
         }
         callback.handle(.reset(
-          contact: contact,
+          contact: Contact.live(contact),
           receptionId: receptionId,
           ephemeralId: ephemeralId,
           roundId: roundId
diff --git a/Tests/XXMessengerClientTests/TestHelpers/AuthCallback.Callback+stubs.swift b/Tests/XXMessengerClientTests/TestHelpers/AuthCallback.Callback+stubs.swift
index 9617c0b2..0da805ad 100644
--- a/Tests/XXMessengerClientTests/TestHelpers/AuthCallback.Callback+stubs.swift
+++ b/Tests/XXMessengerClientTests/TestHelpers/AuthCallback.Callback+stubs.swift
@@ -3,19 +3,19 @@ import XXClient
 extension Array where Element == AuthCallbacks.Callback {
   static let stubs: [AuthCallbacks.Callback] = [
     .confirm(
-      contact: "contact-1".data(using: .utf8)!,
+      contact: .unimplemented("contact-1".data(using: .utf8)!),
       receptionId: "reception-id-1".data(using: .utf8)!,
       ephemeralId: 1,
       roundId: 1
     ),
     .request(
-      contact: "contact-2".data(using: .utf8)!,
+      contact: .unimplemented("contact-2".data(using: .utf8)!),
       receptionId: "reception-id-2".data(using: .utf8)!,
       ephemeralId: 2,
       roundId: 2
     ),
     .reset(
-      contact: "contact-3".data(using: .utf8)!,
+      contact: .unimplemented("contact-3".data(using: .utf8)!),
       receptionId: "reception-id-3".data(using: .utf8)!,
       ephemeralId: 3,
       roundId: 3
-- 
GitLab