syncwire

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package syncwire owns the on-wire types shared by the cloud sync stack: the encrypted envelope (pinax.cloud.envelope.v1) and the content manifest (pinax.cloud.manifest.v1/v2). remote and cloudsync previously declared parallel copies of these schemas with drifting field sets — this package is the single source of truth; the other packages alias these types so the wire format can no longer diverge silently.

Index

Constants

View Source
const (
	// EnvelopeSchemaVersion is the encrypted-envelope wire schema.
	EnvelopeSchemaVersion = "pinax.cloud.envelope.v1"
	// ManifestSchemaVersionV1 is the path-keyed manifest wire schema.
	ManifestSchemaVersionV1 = "pinax.cloud.manifest.v1"
	// ManifestSchemaVersionV2 is the identity-first manifest wire schema.
	ManifestSchemaVersionV2 = "pinax.cloud.manifest.v2"
	// ManifestSchemaVersion is the schema written by new manifests.
	ManifestSchemaVersion = ManifestSchemaVersionV1
)

Variables

This section is empty.

Functions

func IsUnsafePlaintextToken

func IsUnsafePlaintextToken(value string) bool

IsUnsafePlaintextToken reports whether a value may carry plaintext paths or credentials that must never appear in wire metadata.

Types

type Envelope

type Envelope struct {
	SchemaVersion string            `json:"schema_version"`
	Alg           string            `json:"alg"`
	KeyID         string            `json:"key_id"`
	Nonce         string            `json:"nonce"`
	Ciphertext    string            `json:"ciphertext"`
	PlainSHA256   string            `json:"plain_sha256"`
	Metadata      map[string]string `json:"metadata,omitempty"`
}

Envelope is the encrypted payload wrapper for blobs and manifests.

func (Envelope) Validate

func (e Envelope) Validate() error

Validate enforces the envelope schema and rejects metadata that could leak plaintext tokens.

type Manifest

type Manifest struct {
	SchemaVersion string           `json:"schema_version"`
	GeneratedAt   string           `json:"generated_at"`
	EntryCount    int              `json:"entry_count"`
	Entries       []ManifestEntry  `json:"entries"`
	Deletes       []ManifestDelete `json:"deletes,omitempty"`
}

Manifest is the content manifest serialized inside manifest envelopes.

func (Manifest) BlobIDs

func (m Manifest) BlobIDs() []string

BlobIDs lists every blob referenced by the manifest entries, including trash backup blobs held by delete markers.

func (Manifest) Validate

func (m Manifest) Validate() error

Validate enforces manifest structure per schema version.

func (Manifest) ValidateV2

func (m Manifest) ValidateV2() error

type ManifestDelete

type ManifestDelete struct {
	PathHash    string `json:"path_hash"`
	ObjectKind  string `json:"object_kind"`
	ObjectID    string `json:"object_id,omitempty"`
	TombstoneID string `json:"tombstone_id"`
	DeletedAt   string `json:"deleted_at,omitempty"`
	TrashBlobID string `json:"trash_blob_id,omitempty"`
	RevisionID  string `json:"revision_id,omitempty"`
	DeviceID    string `json:"device_id,omitempty"`
}

ManifestDelete is one delete-marker tombstone in a manifest.

type ManifestEntry

type ManifestEntry struct {
	ObjectID   string `json:"object_id,omitempty"`
	RevisionID string `json:"revision_id,omitempty"`
	DeviceID   string `json:"device_id,omitempty"`
	Path       string `json:"path"`
	PathHash   string `json:"path_hash"`
	BlobID     string `json:"blob_id"`
	Size       int64  `json:"size"`
	SHA256     string `json:"sha256"`
	ObjectKind string `json:"object_kind,omitempty"`
	Mode       uint32 `json:"mode,omitempty"`
	MediaType  string `json:"media_type,omitempty"`
	UpdatedAt  string `json:"updated_at"`
}

ManifestEntry is one object in a manifest.

Jump to

Keyboard shortcuts

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