storeclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package storeclient implements the client side of croc-store-v1 for the CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStoredValue

func IsStoredValue(value string) bool

IsStoredValue reports whether input looks like a stored URL or CLI token.

Types

type Callbacks

type Callbacks struct {
	Status   func(string)
	Progress func(Progress)
}

Callbacks receives human-readable status and byte progress.

type Client

type Client struct {
	HTTP *http.Client
	// contains filtered or unexported fields
}

Client talks to one croc stored-transfer HTTP service. It must not be copied after first use.

func (*Client) Inspect

Inspect fetches and decrypts a manifest without claiming the transfer.

func (*Client) Receive

func (c *Client) Receive(
	ctx context.Context,
	share storecrypto.Share,
	manifest storecrypto.Manifest,
	outputDirectory string,
	callbacks Callbacks,
) error

Receive claims, downloads, verifies, and atomically installs all files.

func (*Client) Revoke

func (c *Client) Revoke(
	ctx context.Context,
	share storecrypto.Share,
	uploadToken string,
) error

Revoke deletes an incomplete or available transfer using the sender receipt.

func (*Client) Upload

func (c *Client) Upload(
	ctx context.Context,
	origin string,
	paths []string,
	callbacks Callbacks,
) (result UploadResult, err error)

Upload hashes, encrypts, and uploads regular files. Upload sessions are not persisted; a terminal failure revokes the partial transfer.

func (*Client) UploadWithDownloads

func (c *Client) UploadWithDownloads(
	ctx context.Context,
	origin string,
	paths []string,
	downloads int,
	callbacks Callbacks,
) (result UploadResult, err error)

UploadWithDownloads uploads regular files with a requested verified-download allowance. Servers reject values above their configured maximum.

func (*Client) UploadWithOptions

func (c *Client) UploadWithOptions(
	ctx context.Context,
	origin string,
	paths []string,
	options UploadOptions,
	callbacks Callbacks,
) (result UploadResult, err error)

UploadWithOptions uploads regular files with a requested verified-download allowance and finite storage lifetime.

type HTTPError

type HTTPError struct {
	StatusCode int
	Message    string
	RetryAfter string
}

HTTPError represents a non-success response from the storage service.

func (*HTTPError) Error

func (e *HTTPError) Error() string

type Progress

type Progress struct {
	FileIndex  int
	FileCount  int
	FileName   string
	FileBytes  int64
	FileSize   int64
	TotalBytes int64
	TotalSize  int64
}

Progress reports plaintext bytes processed.

type UploadOptions

type UploadOptions struct {
	Downloads  int
	Expiration time.Duration
}

UploadOptions configures a stored upload. Zero values select the historical defaults of one verified download and one day of storage.

type UploadResult

type UploadResult struct {
	Share       storecrypto.Share
	UploadToken string
	ExpiresAt   time.Time
	Downloads   int
}

UploadResult contains the share and sender-only revocation capability.

Jump to

Keyboard shortcuts

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