Commit dc12376
feat(pro): add micasa pro encrypted multi-device sync (#791)
## Summary
- **ULID primary keys**: migrate all entities from auto-increment uint
to ULID strings for sync compatibility
- **Oplog**: change tracking via `sync_oplog_entries` table with GORM
hooks for create/update/delete/restore
- **Encryption**: NaCl secretbox (XSalsa20-Poly1305) envelope encryption
with household key generation and NaCl box key exchange
- **Relay server** (`cmd/relay`): full HTTP relay with PgStore, SHA-256
token auth, invite flow with FOR UPDATE locking, blob storage
(upload/download/dedup/quota), Stripe webhook verification, graceful
shutdown
- **Sync engine** (`internal/sync`): pull/push with LWW conflict
resolution, blob upload/download with encryption, `blob_ref` stripping
in apply
- **CLI**: `pro init`, `pro join`, `pro status`, `pro storage`, `pro
sync`, `pro invite`, `pro devices`, `pro conflicts` commands
- **TUI background sync**: indicator (synced/syncing/offline/conflict
glyphs), debounce on mutations, deferred reload during form editing
- **Self-hosted relay**: `SELF_HOSTED=true` mode with subscription
bypass, configurable blob quota, Docker Compose stack (postgres + relay
+ optional Caddy TLS)
- **CASCADE oplog safety**: `HardDeleteMaintenance` with proper oplog
entries for child ServiceLogEntries and document detachment, TUI
hard-delete extended to maintenance tab
- **~18.7k lines** across 118 files, ~1:1 production-to-test ratio
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent a12dea3 commit dc12376
124 files changed
Lines changed: 19824 additions & 1230 deletions
File tree
- .github/workflows
- cmd
- micasa
- relay
- deploy
- relay
- internal
- app
- crypto
- data
- extract
- relay
- sync
- uid
- plans
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
160 | 204 | | |
161 | 205 | | |
162 | 206 | | |
| |||
249 | 293 | | |
250 | 294 | | |
251 | 295 | | |
252 | | - | |
| 296 | + | |
253 | 297 | | |
254 | 298 | | |
255 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
291 | 298 | | |
292 | 299 | | |
293 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
64 | 72 | | |
65 | 73 | | |
66 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
| 218 | + | |
| 219 | + | |
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
| |||
0 commit comments