Skip to main content

Module sync

Module sync 

Source
Expand description

gRPC sync client for communicating with snip-sync server.

Handles bidirectional synchronization of snippets with encryption in transit. Uses TLS for secure communication and AES-256-GCM for snippet encryption.

§Sync Flow

  1. Connect to server with TLS
  2. Encrypt local snippets with user’s API key
  3. Send encrypted snippets with last sync timestamp
  4. Receive encrypted remote snippets
  5. Decrypt and merge with local storage

Structs§

SyncClient
Client for syncing snippets with a remote server.
SyncRetryConfig
Configuration for gRPC retry behavior with exponential backoff.

Functions§

decrypt_snippet
Decrypts a snippet’s encrypted fields received from the sync server.
detect_device_conflict
Detects if any server snippets have a device_id that doesn’t match the expected local device_id, indicating a potential conflict from another device.
encrypt_snippet
Encrypts a snippet’s sensitive fields (description, command, tags) for sync.