cloudsync

package
v1.3.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeychainUnavailable = errors.New("macOS Keychain is unavailable")
	ErrKeychainItemMissing = errors.New("sync key is not present in macOS Keychain")
)
View Source
var ErrNoLocalData = errors.New("no ccl configuration or OAuth credentials found to sync")

Functions

func DenyPairing

func DenyPairing(ctx context.Context, code, via string) error

func HasActiveProfile

func HasActiveProfile() (bool, error)

func HasDiagnosticErrors

func HasDiagnosticErrors(report DiagnosticReport) bool

func IsNotConfiguredDiagnostic

func IsNotConfiguredDiagnostic(report DiagnosticReport) bool

func KeyModeDescription

func KeyModeDescription(mode string) string

func PrimaryRemoteAlias

func PrimaryRemoteAlias() (string, error)

func RenameRemote

func RenameRemote(alias, newAlias string) error

func SetPrimaryRemote

func SetPrimaryRemote(alias string) error

func SetRemoteMirror

func SetRemoteMirror(alias string, enabled bool) error

Types

type Diagnostic

type Diagnostic struct {
	Level   string
	Message string
}

type DiagnosticReport

type DiagnosticReport struct {
	Configured bool
	ProfileID  string
	Remotes    int
	Checks     []Diagnostic
}

func DiagnoseLocal

func DiagnoseLocal() DiagnosticReport

type KeyExportResult

type KeyExportResult struct {
	ProfileID   string
	RecoveryKey string
	KeyMode     string
}

func ExportRecoveryKey

func ExportRecoveryKey() (KeyExportResult, error)

type KeyImportResult

type KeyImportResult struct {
	RemoteDir string
	DeviceID  string
	KeyMode   string
}

func ImportRecoveryKey

func ImportRecoveryKey(value string) (KeyImportResult, error)

func ImportRecoveryKeyForProvider

func ImportRecoveryKeyForProvider(value, requestedProvider string) (KeyImportResult, error)

ImportRecoveryKeyForProvider restores a profile after its cloud provider has been authorized. An empty provider uses the active cloud configuration, then falls back to a saved Google authorization and finally iCloud.

type LoginResult

type LoginResult struct {
	RemoteDir string
	DeviceID  string
	Alias     string
	Provider  string
	Existing  bool
	KeyMode   string
	Migrated  bool
}

func LoginGoogleDrive

func LoginGoogleDrive(
	ctx context.Context,
	usePassphrase bool,
	passphrase string,
	notice io.Writer,
) (LoginResult, error)

LoginGoogleDrive starts the native browser OAuth flow, downloads the application-private sync bundle, then opens or creates its encrypted profile. The OAuth client identity is built into ccl; callers never supply a JSON file.

func LoginGoogleDriveNamed

func LoginGoogleDriveNamed(
	ctx context.Context,
	alias string,
	usePassphrase bool,
	passphrase string,
	notice interface{ Write([]byte) (int, error) },
) (LoginResult, error)

LoginGoogleDriveNamed connects a Google account under a local alias. The first login reuses the v1 implementation and immediately migrates it to v2; later logins attach an independent OAuth token/cache to the active profile.

func LoginICloud

func LoginICloud(passphrase string) (LoginResult, error)

LoginICloud retains the original passphrase API for callers that explicitly select the legacy-compatible passphrase mode.

func LoginICloudKeychain

func LoginICloudKeychain() (LoginResult, error)

func LoginICloudLocalKey

func LoginICloudLocalKey() (LoginResult, error)

LoginICloudLocalKey is the default macOS mode. It uses a random 256-bit master key stored under ~/.ccl/cloud/profiles/<id>/key (with a temporary ~/.ccl/cloud.key only until the v2 registry is created), and migrates the short-lived Keychain mode used by earlier ccl builds.

func LoginICloudNamed

func LoginICloudNamed(alias string, usePassphrase bool, passphrase string) (LoginResult, error)

func LoginICloudWithPassphrase

func LoginICloudWithPassphrase(passphrase string) (LoginResult, error)

type LogoutOptions

type LogoutOptions struct {
	Revoke       bool
	DeleteRemote bool
	ForceLocal   bool
}

type LogoutResult

type LogoutResult struct {
	Alias         string
	Provider      string
	NewPrimary    string
	RemoteDeleted bool
	TokenRevoked  bool
	LocalOnly     bool
}

func LogoutRemote

func LogoutRemote(ctx context.Context, alias string, options LogoutOptions) (LogoutResult, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func Load

func Load() (*Manager, error)

func LoadRemote

func LoadRemote(alias string) (*Manager, error)

LoadRemote loads a selected v2 cloud remote. An empty alias selects the primary remote. A legacy v1 configuration is migrated locally before use.

func (*Manager) Pull

func (m *Manager) Pull(tagValue string, force bool) (PullResult, error)

func (*Manager) Push

func (m *Manager) Push(force bool) (PushResult, error)

func (*Manager) Status

func (m *Manager) Status() (Status, error)

func (*Manager) Tag

func (m *Manager) Tag(value string) (TagResult, error)

type PairingApproveResult

type PairingApproveResult struct {
	Code       string
	RequestID  string
	DeviceID   string
	DeviceName string
	ExpiresAt  time.Time
}

func ApprovePairing

func ApprovePairing(
	ctx context.Context,
	code, via string,
) (PairingApproveResult, error)

type PairingCompleteResult

type PairingCompleteResult struct {
	Alias     string
	ProfileID string
	DeviceID  string
	KeyMode   string
}

func CompletePairing

func CompletePairing(
	ctx context.Context,
	code string,
) (PairingCompleteResult, error)

type PairingRequestInfo

type PairingRequestInfo struct {
	Code       string
	RequestID  string
	Alias      string
	DeviceID   string
	DeviceName string
	CreatedAt  time.Time
	ExpiresAt  time.Time
}

func ListPairingRequests

func ListPairingRequests(
	ctx context.Context,
	via string,
	all bool,
) ([]PairingRequestInfo, error)

type PairingRequestResult

type PairingRequestResult struct {
	Code      string
	RequestID string
	Alias     string
	ExpiresAt time.Time
}

func PendingPairingRequests

func PendingPairingRequests() ([]PairingRequestResult, error)

func StartPairing

func StartPairing(
	ctx context.Context,
	via, deviceName string,
) (PairingRequestResult, error)

type PartialPushError

type PartialPushError struct {
	Message string
}

func (*PartialPushError) Error

func (err *PartialPushError) Error() string

func (*PartialPushError) ExitCode

func (*PartialPushError) ExitCode() int

type PullResult

type PullResult struct {
	Tag        string
	Hash       string
	ID         string
	Downloaded bool
	BackupPath string
}

type PushResult

type PushResult struct {
	Tag      string
	Hash     string
	ID       string
	Uploaded bool
}

type RemoteInfo

type RemoteInfo struct {
	ID          string
	Alias       string
	Provider    string
	ProfileID   string
	Primary     bool
	Mirror      bool
	Enabled     bool
	SignedIn    bool
	RemoteLabel string
	AccountHint string
}

func ListRemotes

func ListRemotes() ([]RemoteInfo, error)

ListRemotes returns the locally configured cloud remotes in stable order. It does not contact any provider.

type RemotePushOutcome

type RemotePushOutcome struct {
	Alias  string
	Result PushResult
	Err    error
}

func PushRemotes

func PushRemotes(to string, all, force, bestEffort bool) ([]RemotePushOutcome, error)

PushRemotes pushes one prepared encrypted snapshot to one or more remotes. All targets are preflighted before the first write unless bestEffort is set.

type Status

type Status struct {
	Alias          string
	Primary        bool
	Mirror         bool
	Provider       string
	KeyMode        string
	RemoteDir      string
	DeviceID       string
	LocalHash      string
	PendingTag     string
	RemoteTag      string
	RemoteID       string
	RemoteHash     string
	RemoteDeviceID string
	RemoteCreated  time.Time
	LastOperation  string
	LastSyncAt     time.Time
	State          string
}

type TagResult

type TagResult struct {
	Tag  string
	Hash string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL