Versions in this module Expand all Collapse all v0 v0.1.1 Jul 5, 2026 v0.1.1-rc.1 Jul 5, 2026 v0.1.0 Jul 5, 2026 Changes in this version + const AckSignatureDomain + const ConflictEventHashChain + const ConflictEventVerification + const ConflictPendingDelete + const ConflictRenameTargetExists + const ConflictSamePathDifferentRemote + const ConflictUntrustworthyTime + const EventConflictCreated + const EventConflictKindDivergent + const EventConflictKindUndecryptable + const EventConflictKindVerification + const EventConflictResolved + const EventDeviceKeyGranted + const EventDraftSnapshotCreated + const EventEncryptedV1 + const EventEncryptedV2 + const EventProjectAdded + const EventProjectDeleted + const EventProjectRenamed + const EventProjectUpdated + const RetentionSignatureDomain + const SkipReasonPlaintext + const SkipReasonRetiredV1 + const SkipReasonUnknownVersion + const SnapshotSignatureDomainReserved + var ErrBlobNotFound = errors.New("blob not found") + var ErrInvalidBlobKey = errors.New("invalid blob key") + var ErrMissingWorkspaceKey = errors.New("missing workspace content key for epoch") + var ErrPlaintextEventFromHub = errors.New("plaintext event from hub (anti-downgrade rejection)") + var ErrRetentionConflict = errors.New("retention manifest changed concurrently") + var ErrRetentionNotFound = errors.New("no retention manifest on hub") + var ErrRetentionRollback = errors.New("retention floor rollback") + var ErrSnapshotRequired = errors.New("full snapshot required") + var ErrSnapshotVerification = errors.New("snapshot verification failed") + var ErrSweepLockHeld = errors.New("sweep lock already held") + var ErrSweepLockNotFound = errors.New("sweep lock not found") + var ErrUnknownEnvelopeVersion = errors.New("unknown encrypted envelope version") + var QuarantineConflictTypes = []string + func AckSignaturePayload(m AckMarker) []byte + func ApplyEventsWithStats(ctx context.Context, st *state.Store, events []state.Event, after Cursor) (Cursor, ApplyStats, error) + func CreateConflictResolvedEvent(ctx context.Context, st *state.Store, payload ConflictResolvedPayload) (state.Event, error) + func CreateConflictResolvedEventTx(ctx context.Context, st *state.Store, tx *state.Tx, ...) (state.Event, error) + func CreateProjectEvent(ctx context.Context, st *state.Store, typ string, payload ProjectPayload) (state.Event, error) + func CreateProjectEventTx(ctx context.Context, st *state.Store, tx *state.Tx, typ string, ...) (state.Event, error) + func DecryptEvent(event state.Event, wck []byte) (state.Event, error) + func EncryptEvent(event state.Event, wck []byte, epoch int64) (state.Event, error) + func EnvelopeVersion(event state.Event) (int, bool) + func ImportSnapshot(ctx context.Context, st *state.Store, snap Snapshot, ...) error + func KIDForWCK(wck []byte) string + func LoadRetentionFloorCache(ctx context.Context, st *state.Store, hubID string) (map[string]int64, error) + func MarshalSweepLock(l SweepLock) ([]byte, error) + func NewDeviceKeyGrantEvent(typ, payloadJSON string) state.Event + func NewDraftSnapshotEvent(typ, payloadJSON string) state.Event + func NewProjectEvent(deviceID, typ string, hlc int64, payload ProjectPayload) (state.Event, error) + func NewWCK() ([]byte, error) + func ParseEncryptedEnvelope(event state.Event) (encryptedEnvelope, error) + func ParsePendingDeleteConflictPath(detailsJSON string) (string, error) + func ParseRetentionFloors(raw []byte) (map[string]int64, error) + func ReplayUndecryptableConflicts(ctx context.Context, st *state.Store, h EncryptedHub) (int, error) + func RetentionFloorMetaKey(hubID string) string + func RetentionSignaturePayload(m RetentionManifest) []byte + func SealSnapshot(snap Snapshot, wck []byte, epoch int64) (obj []byte, sha256Hex string, err error) + func SignAckMarker(m *AckMarker, privateSigningKey string) error + func SignRetentionManifest(m *RetentionManifest, privateSigningKey string) error + func VerifyAckMarker(m AckMarker, publicSigningKey string) error + func VerifyRetentionManifest(m RetentionManifest, publicSigningKey string) error + type AckMarker struct + Cursor map[string]int64 + DeviceID string + HLCWatermark int64 + ProducedAt int64 + PushedThroughSeq int64 + Sig string + V int + WorkspaceID string + func ParseAckMarker(raw []byte) (AckMarker, error) + type ApplyStats struct + CursorHeld bool + Quarantined int + type BlobInfo struct + Key string + LastModified time.Time + type ChainAnchor struct + ContentHash string + DeviceID string + HLC int64 + Seq int64 + type ConflictRecord struct + Details string + NamespaceID string + Type string + type ConflictResolvedPayload struct + Action string + ConflictID string + DetailsJSON string + NamespaceID string + Type string + type Cursor map[string]int64 + func ApplyEvents(ctx context.Context, st *state.Store, events []state.Event) (Cursor, error) + func (c Cursor) After(deviceID string) int64 + type Decision struct + Conflicts []ConflictRecord + Mutations []Mutation + func Decide(proj Projection, event state.Event) (Decision, error) + type DeviceKeyGrant struct + Epoch int64 + KID string + Recipient string + WrappedKey string + type DraftSnapshotPayload struct + BlobRef string + ByteSize int64 + FileCount int64 + Path string + type EncryptedHub struct + GraceWindow time.Duration + Hub Hub + Keyring WorkspaceKeyring + MissingKeyWait func(ctx context.Context, epoch int64, kid string) (time.Time, error) + NoteSkipped func(ctx context.Context, ev state.Event, reason string) (time.Time, error) + Stats *PullStats + Verify func(ctx context.Context, ev state.Event) error + func (h EncryptedHub) CompactEventsBelow(ctx context.Context, floors Cursor) (int, error) + func (h EncryptedHub) DeleteAck(ctx context.Context, deviceID string) error + func (h EncryptedHub) DeleteBlob(ctx context.Context, sha256Hex string) error + func (h EncryptedHub) DeleteDeviceStream(ctx context.Context, deviceID string) (int, error) + func (h EncryptedHub) DeleteSnapshotObject(ctx context.Context, sha256Hex string) error + func (h EncryptedHub) DeleteSweepLock(ctx context.Context) error + func (h EncryptedHub) GetBlob(ctx context.Context, sha256Hex string) (io.ReadCloser, error) + func (h EncryptedHub) GetRetention(ctx context.Context) ([]byte, string, error) + func (h EncryptedHub) GetSnapshotObject(ctx context.Context, sha256Hex string) ([]byte, error) + func (h EncryptedHub) GetSweepLock(ctx context.Context) ([]byte, time.Time, error) + func (h EncryptedHub) ListAcks(ctx context.Context) (map[string][]byte, error) + func (h EncryptedHub) ListBlobs(ctx context.Context) ([]BlobInfo, error) + func (h EncryptedHub) ListSnapshotObjects(ctx context.Context) ([]BlobInfo, error) + func (h EncryptedHub) MigrateLegacyEvents(ctx context.Context, dryRun bool) (int, int, error) + func (h EncryptedHub) Pull(ctx context.Context, after Cursor) ([]state.Event, error) + func (h EncryptedHub) Push(ctx context.Context, events []state.Event) error + func (h EncryptedHub) PutAck(ctx context.Context, deviceID string, raw []byte) error + func (h EncryptedHub) PutBlob(ctx context.Context, sha256Hex string, r io.Reader) error + func (h EncryptedHub) PutRetention(ctx context.Context, raw []byte, ifMatchETag string) error + func (h EncryptedHub) PutSnapshotObject(ctx context.Context, sha256Hex string, body []byte) error + func (h EncryptedHub) PutSweepLock(ctx context.Context, raw []byte) error + func (h EncryptedHub) StatBlob(ctx context.Context, sha256Hex string) (BlobInfo, error) + func (h EncryptedHub) TryDecrypt(ctx context.Context, event state.Event) (state.Event, error) + type FileHub struct + Path string + RetentionSeqs map[string]int64 + func (h FileHub) CompactEventsBelow(ctx context.Context, floors Cursor) (int, error) + func (h FileHub) DeleteAck(_ context.Context, deviceID string) error + func (h FileHub) DeleteBlob(_ context.Context, sha256Hex string) error + func (h FileHub) DeleteDeviceStream(_ context.Context, deviceID string) (int, error) + func (h FileHub) DeleteSnapshotObject(_ context.Context, sha256Hex string) error + func (h FileHub) DeleteSweepLock(_ context.Context) error + func (h FileHub) GetBlob(_ context.Context, sha256Hex string) (io.ReadCloser, error) + func (h FileHub) GetRetention(_ context.Context) ([]byte, string, error) + func (h FileHub) GetSnapshotObject(_ context.Context, sha256Hex string) ([]byte, error) + func (h FileHub) GetSweepLock(_ context.Context) ([]byte, time.Time, error) + func (h FileHub) HasEvents(ctx context.Context) (bool, error) + func (h FileHub) ListAcks(_ context.Context) (map[string][]byte, error) + func (h FileHub) ListBlobs(_ context.Context) ([]BlobInfo, error) + func (h FileHub) ListSnapshotObjects(_ context.Context) ([]BlobInfo, error) + func (h FileHub) MigrateLegacyEvents(_ context.Context, _ bool) (int, int, error) + func (h FileHub) Pull(ctx context.Context, after Cursor) ([]state.Event, error) + func (h FileHub) Push(ctx context.Context, events []state.Event) error + func (h FileHub) PutAck(_ context.Context, deviceID string, raw []byte) error + func (h FileHub) PutBlob(ctx context.Context, sha256Hex string, r io.Reader) error + func (h FileHub) PutRetention(_ context.Context, raw []byte, ifMatchETag string) error + func (h FileHub) PutSnapshotObject(_ context.Context, sha256Hex string, body []byte) error + func (h FileHub) PutSweepLock(_ context.Context, raw []byte) error + func (h FileHub) StatBlob(_ context.Context, sha256Hex string) (BlobInfo, error) + type HLC struct + Last int64 + MaxSkew time.Duration + Now func() time.Time + func (h *HLC) Receive(remote int64) (int64, error) + func (h *HLC) Send() int64 + type Hub interface + CompactEventsBelow func(ctx context.Context, floors Cursor) (deleted int, err error) + DeleteAck func(ctx context.Context, deviceID string) error + DeleteBlob func(ctx context.Context, sha256Hex string) error + DeleteDeviceStream func(ctx context.Context, deviceID string) (deleted int, err error) + DeleteSnapshotObject func(ctx context.Context, sha256Hex string) error + DeleteSweepLock func(ctx context.Context) error + GetBlob func(ctx context.Context, sha256Hex string) (io.ReadCloser, error) + GetRetention func(ctx context.Context) (raw []byte, etag string, err error) + GetSnapshotObject func(ctx context.Context, sha256Hex string) ([]byte, error) + GetSweepLock func(ctx context.Context) (raw []byte, lastModified time.Time, err error) + ListAcks func(ctx context.Context) (map[string][]byte, error) + ListBlobs func(ctx context.Context) ([]BlobInfo, error) + ListSnapshotObjects func(ctx context.Context) ([]BlobInfo, error) + MigrateLegacyEvents func(ctx context.Context, dryRun bool) (migrated, kept int, err error) + Pull func(ctx context.Context, after Cursor) ([]state.Event, error) + Push func(ctx context.Context, events []state.Event) error + PutAck func(ctx context.Context, deviceID string, raw []byte) error + PutBlob func(ctx context.Context, sha256Hex string, r io.Reader) error + PutRetention func(ctx context.Context, raw []byte, ifMatchETag string) error + PutSnapshotObject func(ctx context.Context, sha256Hex string, body []byte) error + PutSweepLock func(ctx context.Context, raw []byte) error + StatBlob func(ctx context.Context, sha256Hex string) (BlobInfo, error) + type Mutation struct + Kind MutationKind + Tombstone TombstoneMutation + Upsert state.UpsertProjectParams + type MutationKind int + const MutationTombstone + const MutationUpsert + type ProjectPayload struct + DefaultBranch string + Path string + RemoteKey string + RemoteURL string + Type string + func ProjectPayloadFromEvent(payloadJSON string) (ProjectPayload, error) + type Projection map[string]ProjectionRow + func (p Projection) Apply(d Decision) (Projection, error) + type ProjectionRow struct + DefaultBranch string + DirtyState string + NamespaceID string + Path string + PathKey string + RemoteKey string + RemoteURL string + SourceEventDeviceID string + SourceEventHLC int64 + SourceEventID string + Status string + TombstoneHLC int64 + Type string + type PullStats struct + RawSeen int + Skipped int + Truncated int + Undecryptable int + type RenamePayload struct + NewPath string + OldPath string + type RetentionManifest struct + Floors map[string]int64 + PrevSHA256 string + ProducedAt int64 + ProducedBy string + Sig string + Snapshot RetentionSnapshotRef + V int + WorkspaceID string + func ParseRetentionManifest(raw []byte) (RetentionManifest, error) + type RetentionSnapshotRef struct + Epoch int64 + HLC int64 + KID string + ProducedBy string + SHA256 string + type SamePathConflictInfo struct + LoserEventID string + LoserKey string + Path string + WinnerEventID string + WinnerKey string + func ParseSamePathConflictDetails(detailsJSON string) (SamePathConflictInfo, error) + type Snapshot struct + Anchors []ChainAnchor + Entries []SnapshotEntry + Epoch int64 + Floor Cursor + HLC int64 + KID string + ProducedBy string + Tombstones []SnapshotTombstone + V int + WorkspaceID string + func BuildSnapshot(ctx context.Context, st *state.Store, producedBy string, hlc int64, ...) (Snapshot, error) + func UnsealSnapshot(obj []byte, wck []byte) (Snapshot, error) + type SnapshotDraft struct + BlobRef string + ByteSize int64 + FileCount int64 + SourceEventDeviceID string + SourceEventHLC int64 + SourceEventID string + type SnapshotEntry struct + DisplayName string + Draft *SnapshotDraft + Git *SnapshotGit + MaterializationPolicy string + Path string + PathKey string + SourceEventDeviceID string + SourceEventHLC int64 + SourceEventID string + Status string + Type string + type SnapshotEnvelopeInfo struct + Epoch int64 + HLC int64 + KID string + ProducedBy string + WorkspaceID string + func ParseSnapshotEnvelope(obj []byte) (SnapshotEnvelopeInfo, error) + type SnapshotGit struct + CloneFilter string + DefaultBranch string + ForgeKind string + LFSPolicy string + RemoteKey string + RemoteURL string + SparseConfig string + type SnapshotTombstone struct + PathKey string + SourceEventDeviceID string + SourceEventID string + TombstoneHLC int64 + type SweepLock struct + AcquiredAtHLC int64 + HolderDevice string + Nonce string + TTLSeconds int64 + func ParseSweepLock(raw []byte) (SweepLock, error) + func (l SweepLock) AcquiredAt() time.Time + func (l SweepLock) TTL() time.Duration + type TombstoneMutation struct + HLC int64 + Path string + type WorkspaceKeyring interface + IngestGrant func(ctx context.Context, grant DeviceKeyGrant) error + Prime func(ctx context.Context) error + PushKey func(ctx context.Context) (epoch int64, kid string, wck []byte, err error) + WCKCandidates func(epoch int64, kid string) [][]byte v0.1.0-rc.2 Jul 5, 2026 v0.1.0-rc.1 Jul 5, 2026