2026-05-15 17:05:13 -07:00
|
|
|
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")
|
|
|
|
|
|
2026-06-23 15:35:18 -04:00
|
|
|
/// Read `serverURL` from UserDefaults, falling back to localhost for local development.
|
2026-05-15 17:05:13 -07:00
|
|
|
/// `ConfigFile.load()` merges `~/.config/com.lilith.mac-sync/config.json` into UserDefaults
|
|
|
|
|
/// at every launch, so this reflects the most recent config file value.
|
2026-06-23 15:35:18 -04:00
|
|
|
/// For deployed setups the install script (or config file) sets the remote server URL.
|
2026-05-15 17:05:13 -07:00
|
|
|
public func macSyncResolveServerURL() -> String {
|
2026-06-23 15:35:18 -04:00
|
|
|
UserDefaults.standard.string(forKey: "serverURL") ?? "http://localhost:3201"
|
2026-05-15 17:05:13 -07:00
|
|
|
}
|