Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/DDGSync/DDGSync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ 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
}

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 {
Expand Down
2 changes: 1 addition & 1 deletion Sources/DDGSync/DDGSyncing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down