Files
ELY-Browser/crates/ely_app/Cargo.toml
T
ZacharyZhang-NY 74b3de54ed Add email + OTP sign-in flow for cloud sync
Replace the "drop a session token in a file" workflow with a real
Chrome-style email login. The Cloudflare worker already had Better
Auth's `email-otp` plugin wired into `SEND_EMAIL`; this commit
builds the renderer-side counterpart.

Worker side:
- Move the OTP sender from `auth@elydora.com` to `browser@elydora.com`
  (wrangler.toml `allowed_sender_addresses` + better_auth.ts
  `EMAIL_OTP_FROM_ADDRESS`). Worker must be redeployed to pick this up.

Client side (`ely_sync_client::email_otp`):
- `send_email_otp(config, email)` POSTs `/api/auth/email-otp/send-verification-otp`
  with `{ email, type: "sign-in" }`.
- `verify_email_otp(config, email, otp)` POSTs `/api/auth/sign-in/email-otp`,
  reads the Better Auth session token from the JSON body's `token` field
  with the `Set-Cookie: better-auth.session_token=…` header as the
  documented fallback channel, and returns it as a `BearerToken`.

Shell side (`shell/auth.rs` + `shell/internal_pages/sync.rs`):
- New `AuthFlowPhase` (Idle / SendingCode / AwaitingOtp / Verifying /
  Error) tracks the in-flight form. Two off-thread workers run the
  HTTP exchanges so the GPUI render loop never blocks.
- Successful verify saves the bearer via `SyncEngine::install_bearer`
  and triggers an immediate snapshot upload, so the user is signed in
  + initial-synced in one click.
- Sync settings page replaces the bare "Sync now" button row with an
  account card: when SignedOut → email field + Send code → OTP field
  + Verify / Resend; when signed in → an account chip + Sign out.
- `trigger_cloud_sync_upload` no longer takes a `Context` param so
  the post-auth path can fire it from the inbox-drain pass without
  needing a window context.
2026-05-15 21:32:50 -04:00

54 lines
1.5 KiB
TOML

[package]
name = "ely_app"
version = "0.1.0"
edition.workspace = true
license.workspace = true
rust-version.workspace = true
[features]
live-site-smoke = []
[dependencies]
ahash = "0.8"
directories.workspace = true
ed25519-dalek.workspace = true
ely_browser_core = { path = "../ely_browser_core" }
ely_design_system = { path = "../ely_design_system" }
ely_domain = { path = "../ely_domain" }
ely_sync_client = { path = "../ely_sync_client" }
gpui.workspace = true
gpui-component.workspace = true
gpui-component-assets.workspace = true
image.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
sha2.workspace = true
thiserror.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
ureq.workspace = true
url.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.10"
# Pin to the same minor as gpui 0.2.2 so we share its `CVPixelBuffer`
# type — gpui's `Surface::From<CVPixelBuffer>` only matches the
# version it built against.
core-video = "0.4"
io-surface = "0.16"
mach2 = "0.6"
objc2 = "0.6"
objc2-core-foundation = { version = "0.3.2", features = ["CFBase", "CFDictionary", "CFNumber", "CFString"] }
objc2-foundation = { version = "0.3.1", features = ["NSDictionary", "NSString", "NSValue"] }
objc2-io-surface = "0.3.2"
uuid.workspace = true
[dev-dependencies]
gpui = { workspace = true, features = ["test-support"] }
[build-dependencies]
toml.workspace = true
[lints]
workspace = true