feat(sync): round trip cloud snapshots

This commit is contained in:
2026-05-16 00:01:28 -04:00
parent 06e947f43e
commit 40ab6b4874
22 changed files with 694 additions and 69 deletions
+3 -11
View File
@@ -10,19 +10,11 @@
//! - Bearer-token authenticated requests via `ureq`.
//! - Device registration (`POST /api/devices/register`) and listing
//! (`GET /api/devices`).
//! - Sync snapshot upload (`POST /api/sync/snapshot`) and download
//! - Sync status (`GET /api/sync/status`), snapshot upload
//! (`POST /api/sync/snapshot`), and snapshot download
//! (`GET /api/sync/snapshot?snapshot_id=…`).
//!
//! Intentionally omitted (kept for follow-up work, not papered over here):
//! - The full Better Auth handshake (email + OTP / OAuth). Callers obtain
//! the bearer token out-of-band and hand it to the client.
//! - First-device approval bootstrap. The Cloudflare API rejects sync from
//! an unapproved device; the user must approve a freshly-registered
//! device from another already-approved device (or via direct D1
//! operation), exactly as the backend enforces.
//! - Incremental change-log push/pull (`/api/sync/push` and `/api/sync/pull`).
//! The snapshot path is the simplest contract that round-trips the user's
//! entire state, so we start there.
pub mod auth;
pub mod client;
@@ -32,7 +24,7 @@ pub mod error;
pub mod snapshot;
pub use auth::{BearerToken, BearerTokenStore};
pub use client::{ApiClientConfig, SyncApiClient};
pub use client::{ApiClientConfig, SyncApiClient, SyncLatestSnapshotDocument, SyncStatusDocument};
pub use device::{DeviceIdentity, DeviceListResponse, DeviceRecord, DeviceRegistration};
pub use email_otp::{send_email_otp, verify_email_otp};
pub use error::SyncClientError;