registry

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("plugin record not found")
View Source
var ErrSourceSecurityFloorRollback = errors.New("source security floor rollback")

Functions

func RunnableTrustState

func RunnableTrustState(state TrustState) bool

Types

type EnableState

type EnableState string
const (
	EnableDisabled         EnableState = "disabled"
	EnableEnabled          EnableState = "enabled"
	EnableDisabledByPolicy EnableState = "disabled_by_policy"
)

type LocalImportProvenance

type LocalImportProvenance struct {
	ImportID       string `json:"import_id"`
	Distribution   string `json:"distribution"`
	PolicyEpoch    string `json:"policy_epoch"`
	UnsignedPolicy string `json:"unsigned_policy"`
	AssessedAt     string `json:"assessed_at"`
}

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) BumpPolicyRevision

func (s *MemoryStore) BumpPolicyRevision(_ context.Context, pluginInstanceID string, revoke bool, now time.Time) (PluginRecord, error)

func (*MemoryStore) DeletePlugin

func (s *MemoryStore) DeletePlugin(_ context.Context, pluginInstanceID string) error

func (*MemoryStore) GetPlugin

func (s *MemoryStore) GetPlugin(_ context.Context, pluginInstanceID string) (PluginRecord, error)

func (*MemoryStore) GetSourceSecurityFloor

func (s *MemoryStore) GetSourceSecurityFloor(_ context.Context, sourceID string) (SourceSecurityFloor, error)

func (*MemoryStore) ListPlugins

func (s *MemoryStore) ListPlugins(_ context.Context) ([]PluginRecord, error)

func (*MemoryStore) MarkUninstalled

func (s *MemoryStore) MarkUninstalled(_ context.Context, pluginInstanceID string, retained RetainedDataState, now time.Time) (PluginRecord, error)

func (*MemoryStore) PutPlugin

func (s *MemoryStore) PutPlugin(_ context.Context, record PluginRecord, opts PutOptions) (PluginRecord, error)

func (*MemoryStore) PutSourceSecurityFloor

func (s *MemoryStore) PutSourceSecurityFloor(_ context.Context, floor SourceSecurityFloor, opts PutOptions) (SourceSecurityFloor, error)

func (*MemoryStore) SetEnableState

func (s *MemoryStore) SetEnableState(_ context.Context, pluginInstanceID string, state EnableState, reason string, now time.Time) (PluginRecord, error)

type PluginRecord

type PluginRecord struct {
	PluginInstanceID         string                   `json:"plugin_instance_id"`
	PublisherID              string                   `json:"publisher_id"`
	PluginID                 string                   `json:"plugin_id"`
	Version                  string                   `json:"version"`
	ActiveFingerprint        string                   `json:"active_fingerprint"`
	PackageHash              string                   `json:"package_hash"`
	ManifestHash             string                   `json:"manifest_hash"`
	EntriesHash              string                   `json:"entries_hash"`
	TrustState               TrustState               `json:"trust_state"`
	TrustAssessment          TrustAssessment          `json:"trust_assessment"`
	SourcePolicySnapshotHash string                   `json:"source_policy_snapshot_hash,omitempty"`
	SourcePolicySnapshot     map[string]any           `json:"source_policy_snapshot,omitempty"`
	LocalImportProvenance    *LocalImportProvenance   `json:"local_import_provenance,omitempty"`
	CapabilityContracts      []capabilitycontract.Pin `json:"capability_contracts,omitempty"`
	EnableState              EnableState              `json:"enable_state"`
	DisabledReason           string                   `json:"disabled_reason,omitempty"`
	RetainedDataState        RetainedDataState        `json:"retained_data_state"`
	PolicyRevision           uint64                   `json:"policy_revision"`
	ManagementRevision       uint64                   `json:"management_revision"`
	RevokeEpoch              uint64                   `json:"revoke_epoch"`
	Manifest                 manifest.Manifest        `json:"manifest"`
	PackageEntries           []pluginpkg.Entry        `json:"package_entries"`
	VersionHistory           []PluginVersion          `json:"version_history,omitempty"`
	InstalledAt              time.Time                `json:"installed_at"`
	EnabledAt                *time.Time               `json:"enabled_at,omitempty"`
	UpdatedAt                time.Time                `json:"updated_at"`
	DeletedAt                *time.Time               `json:"deleted_at,omitempty"`
	Metadata                 map[string]string        `json:"metadata,omitempty"`
}

type PluginVersion

type PluginVersion struct {
	Version                  string                   `json:"version"`
	ActiveFingerprint        string                   `json:"active_fingerprint"`
	PackageHash              string                   `json:"package_hash"`
	ManifestHash             string                   `json:"manifest_hash"`
	EntriesHash              string                   `json:"entries_hash"`
	TrustState               TrustState               `json:"trust_state"`
	TrustAssessment          TrustAssessment          `json:"trust_assessment"`
	SourcePolicySnapshotHash string                   `json:"source_policy_snapshot_hash,omitempty"`
	SourcePolicySnapshot     map[string]any           `json:"source_policy_snapshot,omitempty"`
	LocalImportProvenance    *LocalImportProvenance   `json:"local_import_provenance,omitempty"`
	CapabilityContracts      []capabilitycontract.Pin `json:"capability_contracts,omitempty"`
	Manifest                 manifest.Manifest        `json:"manifest"`
	PackageEntries           []pluginpkg.Entry        `json:"package_entries"`
	ActivatedAt              time.Time                `json:"activated_at"`
	Metadata                 map[string]string        `json:"metadata,omitempty"`
}

type PutOptions

type PutOptions struct {
	Now time.Time
}

type RetainedDataState

type RetainedDataState string
const (
	RetainedDataNone              RetainedDataState = "none"
	RetainedDataRetained          RetainedDataState = "retained"
	RetainedDataDeleted           RetainedDataState = "deleted"
	RetainedDataDeleteFailedRetry RetainedDataState = "delete_failed_retryable"
)

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(ctx context.Context, path string) (*SQLiteStore, error)

func (*SQLiteStore) BumpPolicyRevision

func (s *SQLiteStore) BumpPolicyRevision(ctx context.Context, pluginInstanceID string, revoke bool, now time.Time) (PluginRecord, error)

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) DeletePlugin

func (s *SQLiteStore) DeletePlugin(ctx context.Context, pluginInstanceID string) error

func (*SQLiteStore) GetPlugin

func (s *SQLiteStore) GetPlugin(ctx context.Context, pluginInstanceID string) (PluginRecord, error)

func (*SQLiteStore) GetSourceSecurityFloor

func (s *SQLiteStore) GetSourceSecurityFloor(ctx context.Context, sourceID string) (SourceSecurityFloor, error)

func (*SQLiteStore) ListPlugins

func (s *SQLiteStore) ListPlugins(ctx context.Context) ([]PluginRecord, error)

func (*SQLiteStore) MarkUninstalled

func (s *SQLiteStore) MarkUninstalled(ctx context.Context, pluginInstanceID string, retained RetainedDataState, now time.Time) (PluginRecord, error)

func (*SQLiteStore) PutPlugin

func (s *SQLiteStore) PutPlugin(ctx context.Context, record PluginRecord, opts PutOptions) (PluginRecord, error)

func (*SQLiteStore) PutSourceSecurityFloor

func (s *SQLiteStore) PutSourceSecurityFloor(ctx context.Context, floor SourceSecurityFloor, opts PutOptions) (SourceSecurityFloor, error)

func (*SQLiteStore) SetEnableState

func (s *SQLiteStore) SetEnableState(ctx context.Context, pluginInstanceID string, state EnableState, reason string, now time.Time) (PluginRecord, error)

type SourceSecurityFloor

type SourceSecurityFloor struct {
	SourceID                 string    `json:"source_id"`
	PolicyEpoch              string    `json:"policy_epoch"`
	KeyRotationEpoch         string    `json:"key_rotation_epoch"`
	RevocationEpoch          string    `json:"revocation_epoch"`
	SourcePolicySnapshotHash string    `json:"source_policy_snapshot_hash"`
	RevocationMetadataSHA256 string    `json:"revocation_metadata_sha256"`
	UpdatedAt                time.Time `json:"updated_at"`
}

type Store

type Store interface {
	PutPlugin(ctx context.Context, record PluginRecord, opts PutOptions) (PluginRecord, error)
	GetPlugin(ctx context.Context, pluginInstanceID string) (PluginRecord, error)
	ListPlugins(ctx context.Context) ([]PluginRecord, error)
	SetEnableState(ctx context.Context, pluginInstanceID string, state EnableState, reason string, now time.Time) (PluginRecord, error)
	BumpPolicyRevision(ctx context.Context, pluginInstanceID string, revoke bool, now time.Time) (PluginRecord, error)
	MarkUninstalled(ctx context.Context, pluginInstanceID string, retained RetainedDataState, now time.Time) (PluginRecord, error)
	DeletePlugin(ctx context.Context, pluginInstanceID string) error
	PutSourceSecurityFloor(ctx context.Context, floor SourceSecurityFloor, opts PutOptions) (SourceSecurityFloor, error)
	GetSourceSecurityFloor(ctx context.Context, sourceID string) (SourceSecurityFloor, error)
}

type TrustAssessment

type TrustAssessment struct {
	TrustState           TrustState         `json:"trust_state"`
	ReasonCodes          []string           `json:"reason_codes,omitempty"`
	VerifiedHashes       TrustHashSet       `json:"verified_hashes"`
	VerifiedSignature    *VerifiedSignature `json:"verified_signature,omitempty"`
	TrustAssessmentEpoch string             `json:"trust_assessment_epoch,omitempty"`
	PolicyEpoch          string             `json:"policy_epoch,omitempty"`
	RevocationEpoch      string             `json:"revocation_epoch,omitempty"`
	Metadata             map[string]string  `json:"metadata,omitempty"`
}

type TrustHashSet

type TrustHashSet struct {
	PackageSHA256  string `json:"package_sha256"`
	ManifestSHA256 string `json:"manifest_sha256"`
	EntriesSHA256  string `json:"entries_sha256"`
}

type TrustState

type TrustState string
const (
	TrustVerified        TrustState = "verified"
	TrustUnsignedLocal   TrustState = "unsigned_local"
	TrustUntrusted       TrustState = "untrusted"
	TrustNeedsReview     TrustState = "needs_review"
	TrustUnavailable     TrustState = "trust_unavailable"
	TrustBlockedSecurity TrustState = "blocked_security"
)

type VerifiedSignature

type VerifiedSignature struct {
	Algorithm string `json:"algorithm"`
	KeyID     string `json:"key_id"`
}

Jump to

Keyboard shortcuts

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