Skip to content

feat: Bring-your-own Cloudflare Workers + R2 encrypted sync provider #267

Description

@mrchatam

Summary

I'd like to contribute a bring-your-own Cloudflare Workers + R2 encrypted sync backend, as an optional sync provider alongside the existing GitHub Gist Sync plugin and Voltius cloud sync.

Motivation

Many users want cross-device vault sync without:

  • a vendor-hosted sync service, or
  • relying on GitHub Gists

Cloudflare Workers + R2 is a natural fit: the user deploys and owns the Worker, R2 stores only ciphertext + non-sensitive sync metadata, and encryption stays client-side (same model as Gist sync).

Proposed architecture

Voltius client
  → local vault encryption (existing)
  → sync plugin (new): plugin-cloudflare-sync
  → user's Cloudflare Worker
  → R2 (opaque device blobs + plaintext manifest: salt, device ids, pushedAt)

Client (plugin)

Mirror src/plugins/gist-sync/:

  • Reuse api.sync.exportState / api.sync.importStates and api.crypto.deriveKey
  • No changes to SSH core or official src/services/sync.ts
  • Secrets in api.vault (Worker token + passphrase; passphrase required — do not derive the enc key from the transport token)
  • Poll-based sync (default ~60s), pull-then-push, same conflict approach as Gist (LWW via importStates)

Server (user-owned)

Clean-room Worker template (MIT), e.g. under examples/cloudflare-sync-worker/:

  • Bearer token auth (SYNC_TOKEN secret)
  • R2 only for MVP (no D1/KV required)
  • Endpoints roughly: /health, /v1/manifest, /v1/devices/:id
  • Worker never runs Argon2 / vault crypto

Why a plugin (not a sync.ts backend)

PluginAPI already exposes the encrypted export/import path that Gist uses. A Cloudflare provider can ship as:

  1. Seeded optional plugin (like Gist Sync), or
  2. Marketplace MIT plugin + docs linking a Worker template

I can implement either; maintainers' preference welcome.

Security requirements

  • Worker/R2 must only ever see ciphertext + sync metadata (device id/label/timestamps/salt/size)
  • Transport token ≠ encryption secret
  • Offline export/recovery remains possible without Cloudflare
  • No Voltius Pro bypass — this is BYO infrastructure, complementary to hosted sync

Scope / non-goals (MVP)

  • Not replacing Pro cloud / SSE realtime
  • Not team vaults
  • Not multi-tenant hosted SaaS on Cloudflare
  • Poll first (no Durable Objects realtime in MVP)

Implementation plan (on fork)

Working fork: https://github.com/mrchatam/voltius
Branching from dev, small phases with tests, aligning with CI (pnpm test / pnpm build, plugin seed list / Windows plugin assert if seeded).

Happy to adjust shape (seeded vs marketplace-only, API details) before/during review.

Checklist

  • Maintainer preference: seeded in-app vs marketplace-only
  • Confirm Worker template path (examples/ vs separate repo) is acceptable
  • Any API/naming constraints before PR

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions