From be67c3a1352aec5d705a35ce5fc6bdbba15d42df Mon Sep 17 00:00:00 2001 From: Christopher Brind Date: Mon, 15 May 2023 17:22:23 +0100 Subject: [PATCH] return devices returned by login --- Sources/DDGSync/DDGSync.swift | 3 ++- Sources/DDGSync/DDGSyncing.swift | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/DDGSync/DDGSync.swift b/Sources/DDGSync/DDGSync.swift index 707063c26..c1ba8e238 100644 --- a/Sources/DDGSync/DDGSync.swift +++ b/Sources/DDGSync/DDGSync.swift @@ -55,7 +55,7 @@ public class DDGSync: DDGSyncing { updateIsAuthenticated() } - public func login(_ recoveryKey: SyncCode.RecoveryKey, deviceName: String, deviceType: String) async throws { + public func login(_ recoveryKey: SyncCode.RecoveryKey, deviceName: String, deviceType: String) async throws -> [RegisteredDevice] { guard try dependencies.secureStore.account() == nil else { throw SyncError.accountAlreadyExists } @@ -63,6 +63,7 @@ public class DDGSync: DDGSyncing { let result = try await dependencies.account.login(recoveryKey, deviceName: deviceName, deviceType: deviceType) try dependencies.secureStore.persistAccount(result.account) updateIsAuthenticated() + return result.devices } public func remoteConnect() throws -> RemoteConnecting { diff --git a/Sources/DDGSync/DDGSyncing.swift b/Sources/DDGSync/DDGSyncing.swift index f0ece0143..79412dc9d 100644 --- a/Sources/DDGSync/DDGSyncing.swift +++ b/Sources/DDGSync/DDGSyncing.swift @@ -56,7 +56,7 @@ public protocol DDGSyncing { /** Logs in to an existing account using a recovery key. */ - func login(_ recoveryKey: SyncCode.RecoveryKey, deviceName: String, deviceType: String) async throws + func login(_ recoveryKey: SyncCode.RecoveryKey, deviceName: String, deviceType: String) async throws -> [RegisteredDevice] /** Returns a device id and temporary secret key ready for display and allows callers attempt to fetch the transmitted recovery key.