initial-sync.ts
1export const INITIAL_SYNC_PENDING_DEVICE_KEY =2 "peach_initial_sync_pending_device_id";34export interface InitialSyncDevice {5 deviceId: string;6 lastSyncedAt?: number;7}89/**10 * Pairing persists identity and vault-key material before the first entry sync.11 * A receiver is ready to reveal its vault only after the newly paired source12 * has completed a real sync round, recorded by its durable lastSyncedAt.13 */14export function hasCompletedInitialSync(15 devices: InitialSyncDevice[],16 pendingDeviceId: string,17): boolean {18 return devices.some(19 (device) =>20 device.deviceId === pendingDeviceId &&21 typeof device.lastSyncedAt === "number",22 );23}