import Foundation
import LilithAgentCore

/// Single shared keychain where the device auth token is stored.
/// All three sync modules (iMessage, iPhoto, iMail) look here for the Bearer token.
/// The device token belongs to one hardware device — it is not per-module.
public let macSyncSharedKeychain = KeychainHelper(service: "com.lilith.mac-sync")

/// Read `serverURL` from UserDefaults, falling back to the default server on the VPN.
/// `ConfigFile.load()` merges `~/.config/com.lilith.mac-sync/config.json` into UserDefaults
/// at every launch, so this reflects the most recent config file value.
public func macSyncResolveServerURL() -> String {
    UserDefaults.standard.string(forKey: "serverURL") ?? "http://black.local:3201"
}
