sync-types.ts

1.6 KB · raw

1/**2 * Types for Peach sync — full encrypted vault blob transfer over Noise NK.3 *4 * The wire protocol (SYNC_VAULT_SEND / SYNC_VAULT_ACK / SYNC_ERROR /5 * PAIR_REQUEST / PAIR_ACCEPT / PAIR_REJECT) lives on the native peer6 * (peach-android SyncPlugin) and is no longer modeled in the extension —7 * the desktop side only owns the in-popup pairing UI plus the device8 * registry.9 */1011export interface TrustedNetwork {12  ssid?: string;13  bssid?: string;14  isTailscale: boolean;15  addedAt: number;16}1718export interface PairedDevice {19  deviceId: string;20  displayName: string;21  x25519PublicKey: string;22  pairedAt: number;23  lastSeenAt?: number;24  lastSyncAt?: number;25}2627export type SyncStatus = "synced" | "syncing" | "no_peers" | "not_trusted" | "offline";2829/**30 * Pairing request received from a peer that needs user confirmation.31 *32 * The banner expires after 60 seconds (`expiresAt - receivedAt = 60_000`);33 * after that the popup hides the banner and the background drops the34 * request. The publicKeyHex is the peer's static X25519 identity — it35 * gets written to trusted devices on accept and discarded on reject.36 */37export interface IncomingPairingRequest {38  deviceName: string;39  publicKeyHex: string;40  receivedAt: number;41  expiresAt: number;42  /**43   * Connection id of the still-open pairing-only socket. The background's44   * RESPOND_INCOMING_PAIRING handler sends PAIR_ACCEPT or PAIR_REJECT over45   * this connection then disconnects. May be absent for synthetic test46   * injections that do not have a real connection behind them.47   */48  connectionId?: string;49}