backend

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 32 Imported by: 0

README

Backend System

This package implements pluggable backend systems for tool installation from multiple sources.

Responsibilities

  • Define the Backend interface for tool sources
  • Implement GitHub Releases backend
  • Implement Aqua registry backend
  • Implement HTTP download backend
  • Manage backend registry and discovery
  • Handle version listing and resolution
  • Coordinate artifact downloads

Key Components

  • backend.go - Backend interface definition
  • github.go - GitHub Releases backend implementation
  • aqua.go - Aqua registry backend implementation
  • http.go - HTTP download backend implementation
  • registry.go - Backend registry and discovery

Usage

import "github.com/snowdreamtech/unirtm/internal/backend"

// Register backends
registry := backend.NewRegistry()
registry.Register("github", backend.NewGitHubBackend())
registry.Register("aqua", backend.NewAquaBackend())

// Use a backend
backend := registry.Get("github")
versions, err := backend.ListVersions(ctx, "nodejs/node")
if err != nil {
    log.Fatal(err)
}

Requirements

Implements requirements: 5.1-5.8

Documentation

Overview

Package backend provides the GitHub Provenance (SLSA attestation) verifier.

Package backend provides the GitLab Provenance (SLSA attestation) verifier.

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is the global default backend registry.

Functions

func Backends

func Backends() map[string]Backend

Backends returns a copy of all registered backends from the default registry.

func CalculateAssetScore

func CalculateAssetScore(assetName string, platform Platform, toolName string) int

CalculateAssetScore calculates a compatibility score for an asset name. Returns -1 if the asset is definitely incompatible.

func FetchAndParseChecksumFile

func FetchAndParseChecksumFile(ctx context.Context, client *http.Client, url string) (map[string]string, error)

FetchAndParseChecksumFile downloads and parses a checksum file from a URL.

func FindChecksumForAsset

func FindChecksumForAsset(ctx context.Context, client *http.Client, assets []CommonAsset, targetAsset *CommonAsset) (string, error)

FindChecksumForAsset attempts to find a matching checksum for an asset from a list of all assets.

func FindGPGSignatureForAsset

func FindGPGSignatureForAsset(assets []CommonAsset, targetAsset *CommonAsset) string

FindGPGSignatureForAsset attempts to find a matching GPG signature for an asset.

func Has

func Has(name string) bool

Has checks if a backend is registered in the default registry.

func InitializeTUFRoot

func InitializeTUFRoot(cacheDirName, repoBaseURL string, customRoot []byte) (*root.LiveTrustedRoot, error)

InitializeTUFRoot sets up a Sigstore TUF root with the specified parameters.

func List

func List() []string

List returns all registered backend names from the default registry.

func ProbeURL

func ProbeURL(ctx context.Context, client *http.Client, url string) bool

ProbeURL checks if a URL is accessible via HEAD request.

func Register

func Register(backend Backend)

Register registers a backend in the default registry.

func ResetTrustedRootForTest

func ResetTrustedRootForTest()

func ResolveAsdfToolName

func ResolveAsdfToolName(tool string) string

ResolveAsdfToolName maps common tool names to their official asdf plugin names.

func ResolveGitHubTokenPublic

func ResolveGitHubTokenPublic(host string) string

ResolveGitHubTokenPublic is the exported wrapper for use outside the backend package.

func Unregister

func Unregister(name string)

Unregister removes a backend from the default registry.

Types

type AquaBackend

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

AquaBackend implements the Backend interface for Aqua registry. Aqua is a declarative CLI version manager that provides a curated registry of tools.

func NewAquaBackend

func NewAquaBackend() *AquaBackend

NewAquaBackend creates a new Aqua backend.

func (*AquaBackend) AttestationType

func (a *AquaBackend) AttestationType() string

AttestationType returns the type of attestation verification supported.

func (*AquaBackend) Dependencies

func (b *AquaBackend) Dependencies() []string

func (*AquaBackend) GetDownloadInfo

func (a *AquaBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

GetDownloadInfo retrieves download information for a specific version.

func (*AquaBackend) GetReach

func (a *AquaBackend) GetReach() string

func (*AquaBackend) IsRecommended

func (a *AquaBackend) IsRecommended() bool

func (*AquaBackend) IsScriptless

func (a *AquaBackend) IsScriptless() bool

func (*AquaBackend) IsStable

func (a *AquaBackend) IsStable() bool

func (*AquaBackend) ListVersions

func (a *AquaBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

ListVersions returns all available versions from Aqua registry.

func (*AquaBackend) Name

func (a *AquaBackend) Name() string

Name returns the backend identifier.

func (*AquaBackend) ResolveVersion

func (a *AquaBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

ResolveVersion resolves a version request to a concrete version.

func (*AquaBackend) SupportsChecksum

func (a *AquaBackend) SupportsChecksum() bool

SupportsChecksum indicates whether this backend provides checksums.

func (*AquaBackend) SupportsGPG

func (a *AquaBackend) SupportsGPG() bool

SupportsGPG indicates whether this backend supports GPG signatures.

func (*AquaBackend) SupportsOffline

func (a *AquaBackend) SupportsOffline() bool

type AsdfBackend

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

AsdfBackend implements the Backend interface for asdf plugins.

func NewAsdfBackend

func NewAsdfBackend() *AsdfBackend

NewAsdfBackend creates a new asdf backend.

func (*AsdfBackend) AttestationType

func (b *AsdfBackend) AttestationType() string

func (*AsdfBackend) Dependencies

func (b *AsdfBackend) Dependencies() []string

func (*AsdfBackend) GetDownloadInfo

func (b *AsdfBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*AsdfBackend) GetReach

func (b *AsdfBackend) GetReach() string

func (*AsdfBackend) IsRecommended

func (b *AsdfBackend) IsRecommended() bool

func (*AsdfBackend) IsScriptless

func (b *AsdfBackend) IsScriptless() bool

func (*AsdfBackend) IsStable

func (b *AsdfBackend) IsStable() bool

func (*AsdfBackend) ListVersions

func (b *AsdfBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*AsdfBackend) Name

func (b *AsdfBackend) Name() string

func (*AsdfBackend) ResolveVersion

func (b *AsdfBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*AsdfBackend) SupportsChecksum

func (b *AsdfBackend) SupportsChecksum() bool

func (*AsdfBackend) SupportsGPG

func (b *AsdfBackend) SupportsGPG() bool

func (*AsdfBackend) SupportsOffline

func (b *AsdfBackend) SupportsOffline() bool

type Backend

type Backend interface {
	// Name returns the unique identifier for this backend (e.g., "github", "aqua", "http").
	Name() string

	// ListVersions returns all available versions for a tool.
	// The versions are returned in descending order (newest first).
	ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

	// ResolveVersion resolves a version request (e.g., "latest", "1.20", "^1.19") to a concrete version.
	// Returns the resolved VersionInfo or an error if the version cannot be resolved.
	ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

	// GetDownloadInfo retrieves download information for a specific tool version.
	// This is useful when you already know the exact version you want.
	GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

	// SupportsChecksum indicates whether this backend provides checksum verification.
	SupportsChecksum() bool

	// SupportsGPG indicates whether this backend supports GPG signature verification.
	SupportsGPG() bool

	// AttestationType returns the type of build provenance or attestation
	// verification supported (e.g., "SLSA", "GitHub", "Cosign").
	// Returns an empty string if not supported.
	AttestationType() string

	// IsRecommended indicates whether this backend is recommended for use.
	IsRecommended() bool

	// IsScriptless indicates whether this backend performs installation without executing arbitrary scripts.
	IsScriptless() bool

	// GetReach returns the relative coverage/reach of this backend (e.g., "Small", "Medium", "Large", "Huge").
	GetReach() string

	// IsStable indicates whether this backend has high stability and low bit-rot.
	IsStable() bool

	// SupportsOffline indicates whether this backend supports offline mode or private mirrors.
	SupportsOffline() bool

	// Dependencies returns a list of backend names or tools that this backend depends on.
	// This is used to determine the installation order.
	Dependencies() []string
}

Backend defines the interface for tool version management backends. Each backend is responsible for listing available versions, resolving version requests, and providing download information for tools.

func Get

func Get(name string) (Backend, error)

Get retrieves a backend from the default registry.

type BackendError

type BackendError struct {
	Backend string // The backend that produced the error
	Tool    string // The tool being operated on
	Message string // Error message
	Cause   error  // Underlying error, if any
}

BackendError represents an error from a backend operation.

func NewBackendError

func NewBackendError(backend, tool, message string, cause error) *BackendError

NewBackendError creates a new BackendError.

func (*BackendError) Error

func (e *BackendError) Error() string

Error implements the error interface.

func (*BackendError) Unwrap

func (e *BackendError) Unwrap() error

Unwrap returns the underlying error.

type CabalBackend

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

func NewCabalBackend

func NewCabalBackend() *CabalBackend

func (*CabalBackend) AttestationType

func (b *CabalBackend) AttestationType() string

func (*CabalBackend) Dependencies

func (b *CabalBackend) Dependencies() []string

func (*CabalBackend) GetDownloadInfo

func (b *CabalBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*CabalBackend) GetReach

func (b *CabalBackend) GetReach() string

func (*CabalBackend) IsRecommended

func (b *CabalBackend) IsRecommended() bool

func (*CabalBackend) IsScriptless

func (b *CabalBackend) IsScriptless() bool

func (*CabalBackend) IsStable

func (b *CabalBackend) IsStable() bool

func (*CabalBackend) ListVersions

func (b *CabalBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*CabalBackend) Name

func (b *CabalBackend) Name() string

func (*CabalBackend) ResolveVersion

func (b *CabalBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*CabalBackend) SupportsChecksum

func (b *CabalBackend) SupportsChecksum() bool

func (*CabalBackend) SupportsGPG

func (b *CabalBackend) SupportsGPG() bool

func (*CabalBackend) SupportsOffline

func (b *CabalBackend) SupportsOffline() bool

type CargoBackend

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

CargoBackend implements the Backend interface for Cargo packages.

func NewCargoBackend

func NewCargoBackend() *CargoBackend

NewCargoBackend creates a new Cargo backend.

func (*CargoBackend) AttestationType

func (b *CargoBackend) AttestationType() string

func (*CargoBackend) Dependencies

func (b *CargoBackend) Dependencies() []string

func (*CargoBackend) GetDownloadInfo

func (b *CargoBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*CargoBackend) GetReach

func (b *CargoBackend) GetReach() string

func (*CargoBackend) IsRecommended

func (b *CargoBackend) IsRecommended() bool

func (*CargoBackend) IsScriptless

func (b *CargoBackend) IsScriptless() bool

func (*CargoBackend) IsStable

func (b *CargoBackend) IsStable() bool

func (*CargoBackend) ListVersions

func (b *CargoBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*CargoBackend) Name

func (b *CargoBackend) Name() string

func (*CargoBackend) ResolveVersion

func (b *CargoBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*CargoBackend) SupportsChecksum

func (b *CargoBackend) SupportsChecksum() bool

func (*CargoBackend) SupportsGPG

func (b *CargoBackend) SupportsGPG() bool

func (*CargoBackend) SupportsOffline

func (b *CargoBackend) SupportsOffline() bool

type CommonAsset

type CommonAsset struct {
	Name string
	URL  string
	Size int64
}

CommonAsset represents a generic asset from a hosting platform.

func FindBestAsset

func FindBestAsset(assets []CommonAsset, platform Platform, toolName string) (*CommonAsset, int)

FindBestAsset finds the best matching asset for a platform from a list.

type CommonRelease

type CommonRelease struct {
	Tag         string
	Prerelease  bool
	Assets      []CommonAsset
	PublishedAt time.Time
}

CommonRelease represents a generic release from any hosting platform.

type ComposerBackend

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

func NewComposerBackend

func NewComposerBackend() *ComposerBackend

func (*ComposerBackend) AttestationType

func (b *ComposerBackend) AttestationType() string

func (*ComposerBackend) Dependencies

func (b *ComposerBackend) Dependencies() []string

func (*ComposerBackend) GetDownloadInfo

func (b *ComposerBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*ComposerBackend) GetReach

func (b *ComposerBackend) GetReach() string

func (*ComposerBackend) IsRecommended

func (b *ComposerBackend) IsRecommended() bool

func (*ComposerBackend) IsScriptless

func (b *ComposerBackend) IsScriptless() bool

func (*ComposerBackend) IsStable

func (b *ComposerBackend) IsStable() bool

func (*ComposerBackend) ListVersions

func (b *ComposerBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*ComposerBackend) Name

func (b *ComposerBackend) Name() string

func (*ComposerBackend) ResolveVersion

func (b *ComposerBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*ComposerBackend) SupportsChecksum

func (b *ComposerBackend) SupportsChecksum() bool

func (*ComposerBackend) SupportsGPG

func (b *ComposerBackend) SupportsGPG() bool

func (*ComposerBackend) SupportsOffline

func (b *ComposerBackend) SupportsOffline() bool

type CondaBackend

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

CondaBackend implements the Backend interface for Conda packages.

func NewCondaBackend

func NewCondaBackend() *CondaBackend

NewCondaBackend creates a new conda backend.

func (*CondaBackend) AttestationType

func (b *CondaBackend) AttestationType() string

func (*CondaBackend) Dependencies

func (b *CondaBackend) Dependencies() []string

func (*CondaBackend) GetDownloadInfo

func (b *CondaBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*CondaBackend) GetReach

func (b *CondaBackend) GetReach() string

func (*CondaBackend) IsRecommended

func (b *CondaBackend) IsRecommended() bool

func (*CondaBackend) IsScriptless

func (b *CondaBackend) IsScriptless() bool

func (*CondaBackend) IsStable

func (b *CondaBackend) IsStable() bool

func (*CondaBackend) ListVersions

func (b *CondaBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*CondaBackend) Name

func (b *CondaBackend) Name() string

func (*CondaBackend) ResolveVersion

func (b *CondaBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*CondaBackend) SupportsChecksum

func (b *CondaBackend) SupportsChecksum() bool

func (*CondaBackend) SupportsGPG

func (b *CondaBackend) SupportsGPG() bool

func (*CondaBackend) SupportsOffline

func (b *CondaBackend) SupportsOffline() bool

type ContainerBackend added in v0.2.0

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

ContainerBackend implements the Backend interface for container tools. It handles tools registered with prefixes like "docker", "podman", etc.

func NewContainerBackend added in v0.2.0

func NewContainerBackend(name string) *ContainerBackend

NewContainerBackend creates a new Container backend.

func (*ContainerBackend) AttestationType added in v0.2.0

func (b *ContainerBackend) AttestationType() string

func (*ContainerBackend) Dependencies added in v0.2.0

func (b *ContainerBackend) Dependencies() []string

Dependencies returns any external dependencies required by this backend.

func (*ContainerBackend) GetDownloadInfo added in v0.2.0

func (b *ContainerBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

GetDownloadInfo returns metadata needed by the ContainerProvider.

func (*ContainerBackend) GetReach added in v0.2.0

func (b *ContainerBackend) GetReach() string

func (*ContainerBackend) IsRecommended added in v0.2.0

func (b *ContainerBackend) IsRecommended() bool

func (*ContainerBackend) IsScriptless added in v0.2.0

func (b *ContainerBackend) IsScriptless() bool

func (*ContainerBackend) IsStable added in v0.2.0

func (b *ContainerBackend) IsStable() bool

func (*ContainerBackend) ListVersions added in v0.2.0

func (b *ContainerBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

ListVersions returns available versions for a container tool.

func (*ContainerBackend) Name added in v0.2.0

func (b *ContainerBackend) Name() string

Name returns the backend identifier.

func (*ContainerBackend) ResolveVersion added in v0.2.0

func (b *ContainerBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

ResolveVersion resolves a version request.

func (*ContainerBackend) SupportsChecksum added in v0.2.0

func (b *ContainerBackend) SupportsChecksum() bool

func (*ContainerBackend) SupportsGPG added in v0.2.0

func (b *ContainerBackend) SupportsGPG() bool

func (*ContainerBackend) SupportsOffline added in v0.2.0

func (b *ContainerBackend) SupportsOffline() bool

type CranBackend

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

func NewCranBackend

func NewCranBackend() *CranBackend

func (*CranBackend) AttestationType

func (b *CranBackend) AttestationType() string

func (*CranBackend) Dependencies

func (b *CranBackend) Dependencies() []string

func (*CranBackend) GetDownloadInfo

func (b *CranBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*CranBackend) GetReach

func (b *CranBackend) GetReach() string

func (*CranBackend) IsRecommended

func (b *CranBackend) IsRecommended() bool

func (*CranBackend) IsScriptless

func (b *CranBackend) IsScriptless() bool

func (*CranBackend) IsStable

func (b *CranBackend) IsStable() bool

func (*CranBackend) ListVersions

func (b *CranBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*CranBackend) Name

func (b *CranBackend) Name() string

func (*CranBackend) ResolveVersion

func (b *CranBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*CranBackend) SupportsChecksum

func (b *CranBackend) SupportsChecksum() bool

func (*CranBackend) SupportsGPG

func (b *CranBackend) SupportsGPG() bool

func (*CranBackend) SupportsOffline

func (b *CranBackend) SupportsOffline() bool

type DenoBackend

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

func NewDenoBackend

func NewDenoBackend() *DenoBackend

func (*DenoBackend) AttestationType

func (b *DenoBackend) AttestationType() string

func (*DenoBackend) Dependencies

func (b *DenoBackend) Dependencies() []string

func (*DenoBackend) GetDownloadInfo

func (b *DenoBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*DenoBackend) GetReach

func (b *DenoBackend) GetReach() string

func (*DenoBackend) IsRecommended

func (b *DenoBackend) IsRecommended() bool

func (*DenoBackend) IsScriptless

func (b *DenoBackend) IsScriptless() bool

func (*DenoBackend) IsStable

func (b *DenoBackend) IsStable() bool

func (*DenoBackend) ListVersions

func (b *DenoBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*DenoBackend) Name

func (b *DenoBackend) Name() string

func (*DenoBackend) ResolveVersion

func (b *DenoBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*DenoBackend) SupportsChecksum

func (b *DenoBackend) SupportsChecksum() bool

func (*DenoBackend) SupportsGPG

func (b *DenoBackend) SupportsGPG() bool

func (*DenoBackend) SupportsOffline

func (b *DenoBackend) SupportsOffline() bool

type DotnetBackend

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

DotnetBackend implements the Backend interface for .NET tools (NuGet).

func NewDotnetBackend

func NewDotnetBackend() *DotnetBackend

NewDotnetBackend creates a new dotnet backend.

func (*DotnetBackend) AttestationType

func (b *DotnetBackend) AttestationType() string

func (*DotnetBackend) Dependencies

func (b *DotnetBackend) Dependencies() []string

func (*DotnetBackend) GetDownloadInfo

func (b *DotnetBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*DotnetBackend) GetReach

func (b *DotnetBackend) GetReach() string

func (*DotnetBackend) IsRecommended

func (b *DotnetBackend) IsRecommended() bool

func (*DotnetBackend) IsScriptless

func (b *DotnetBackend) IsScriptless() bool

func (*DotnetBackend) IsStable

func (b *DotnetBackend) IsStable() bool

func (*DotnetBackend) ListVersions

func (b *DotnetBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*DotnetBackend) Name

func (b *DotnetBackend) Name() string

func (*DotnetBackend) ResolveVersion

func (b *DotnetBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*DotnetBackend) SupportsChecksum

func (b *DotnetBackend) SupportsChecksum() bool

func (*DotnetBackend) SupportsGPG

func (b *DotnetBackend) SupportsGPG() bool

func (*DotnetBackend) SupportsOffline

func (b *DotnetBackend) SupportsOffline() bool

type ForgejoBackend

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

ForgejoBackend implements the Backend interface using GenericReleaseManager.

func NewForgejoBackend

func NewForgejoBackend() *ForgejoBackend

NewForgejoBackend creates a new Forgejo backend.

func (*ForgejoBackend) AttestationType

func (b *ForgejoBackend) AttestationType() string

func (*ForgejoBackend) Dependencies

func (b *ForgejoBackend) Dependencies() []string

func (*ForgejoBackend) FetchReleaseByTag

func (b *ForgejoBackend) FetchReleaseByTag(ctx context.Context, tool string, tag string) (*CommonRelease, error)

FetchReleaseByTag implements HostingProvider.

func (*ForgejoBackend) FetchReleases

func (b *ForgejoBackend) FetchReleases(ctx context.Context, tool string) ([]CommonRelease, error)

FetchReleases implements HostingProvider.

func (*ForgejoBackend) GetAttestationType

func (b *ForgejoBackend) GetAttestationType() string

func (*ForgejoBackend) GetClient

func (b *ForgejoBackend) GetClient() *http.Client

func (*ForgejoBackend) GetDownloadInfo

func (b *ForgejoBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*ForgejoBackend) GetReach

func (b *ForgejoBackend) GetReach() string

func (*ForgejoBackend) IsRecommended

func (b *ForgejoBackend) IsRecommended() bool

func (*ForgejoBackend) IsScriptless

func (b *ForgejoBackend) IsScriptless() bool

func (*ForgejoBackend) IsStable

func (b *ForgejoBackend) IsStable() bool

func (*ForgejoBackend) ListVersions

func (b *ForgejoBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*ForgejoBackend) Name

func (b *ForgejoBackend) Name() string

func (*ForgejoBackend) ResolveVersion

func (b *ForgejoBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*ForgejoBackend) SupportsChecksum

func (b *ForgejoBackend) SupportsChecksum() bool

func (*ForgejoBackend) SupportsGPG

func (b *ForgejoBackend) SupportsGPG() bool

func (*ForgejoBackend) SupportsOffline

func (b *ForgejoBackend) SupportsOffline() bool

type GemBackend

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

GemBackend implements the Backend interface for RubyGems.

func NewGemBackend

func NewGemBackend() *GemBackend

NewGemBackend creates a new gem backend.

func (*GemBackend) AttestationType

func (b *GemBackend) AttestationType() string

func (*GemBackend) Dependencies

func (b *GemBackend) Dependencies() []string

func (*GemBackend) GetDownloadInfo

func (b *GemBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*GemBackend) GetReach

func (b *GemBackend) GetReach() string

func (*GemBackend) IsRecommended

func (b *GemBackend) IsRecommended() bool

func (*GemBackend) IsScriptless

func (b *GemBackend) IsScriptless() bool

func (*GemBackend) IsStable

func (b *GemBackend) IsStable() bool

func (*GemBackend) ListVersions

func (b *GemBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*GemBackend) Name

func (b *GemBackend) Name() string

func (*GemBackend) ResolveVersion

func (b *GemBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*GemBackend) SupportsChecksum

func (b *GemBackend) SupportsChecksum() bool

func (*GemBackend) SupportsGPG

func (b *GemBackend) SupportsGPG() bool

func (*GemBackend) SupportsOffline

func (b *GemBackend) SupportsOffline() bool

type GitHubBackend

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

GitHubBackend implements the Backend interface using GenericReleaseManager.

func NewGitHubBackend

func NewGitHubBackend() *GitHubBackend

NewGitHubBackend creates a new GitHub backend.

func (*GitHubBackend) AttestationType

func (g *GitHubBackend) AttestationType() string

func (*GitHubBackend) Dependencies

func (b *GitHubBackend) Dependencies() []string

func (*GitHubBackend) FetchReleaseByTag

func (g *GitHubBackend) FetchReleaseByTag(ctx context.Context, tool string, tag string) (*CommonRelease, error)

FetchReleaseByTag implements HostingProvider.

func (*GitHubBackend) FetchReleases

func (g *GitHubBackend) FetchReleases(ctx context.Context, tool string) ([]CommonRelease, error)

FetchReleases implements HostingProvider.

func (*GitHubBackend) GetAttestationType

func (g *GitHubBackend) GetAttestationType() string

func (*GitHubBackend) GetClient

func (g *GitHubBackend) GetClient() *http.Client

func (*GitHubBackend) GetDownloadInfo

func (g *GitHubBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*GitHubBackend) GetReach

func (g *GitHubBackend) GetReach() string

func (*GitHubBackend) IsRecommended

func (g *GitHubBackend) IsRecommended() bool

func (*GitHubBackend) IsScriptless

func (g *GitHubBackend) IsScriptless() bool

func (*GitHubBackend) IsStable

func (g *GitHubBackend) IsStable() bool

func (*GitHubBackend) ListVersions

func (g *GitHubBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

ListVersions returns all available versions from GitHub Releases.

func (*GitHubBackend) Name

func (g *GitHubBackend) Name() string

func (*GitHubBackend) ResolveVersion

func (g *GitHubBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*GitHubBackend) SupportsChecksum

func (g *GitHubBackend) SupportsChecksum() bool

func (*GitHubBackend) SupportsGPG

func (g *GitHubBackend) SupportsGPG() bool

func (*GitHubBackend) SupportsOffline

func (g *GitHubBackend) SupportsOffline() bool

type GitlabBackend

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

GitlabBackend implements the Backend interface using GenericReleaseManager.

func NewGitlabBackend

func NewGitlabBackend() *GitlabBackend

NewGitlabBackend creates a new GitLab backend.

func (*GitlabBackend) AttestationType

func (b *GitlabBackend) AttestationType() string

func (*GitlabBackend) Dependencies

func (b *GitlabBackend) Dependencies() []string

func (*GitlabBackend) FetchReleaseByTag

func (b *GitlabBackend) FetchReleaseByTag(ctx context.Context, tool string, tag string) (*CommonRelease, error)

FetchReleaseByTag implements HostingProvider.

func (*GitlabBackend) FetchReleases

func (b *GitlabBackend) FetchReleases(ctx context.Context, tool string) ([]CommonRelease, error)

FetchReleases implements HostingProvider.

func (*GitlabBackend) GetAttestationType

func (b *GitlabBackend) GetAttestationType() string

func (*GitlabBackend) GetClient

func (b *GitlabBackend) GetClient() *http.Client

func (*GitlabBackend) GetDownloadInfo

func (b *GitlabBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*GitlabBackend) GetReach

func (b *GitlabBackend) GetReach() string

func (*GitlabBackend) IsRecommended

func (b *GitlabBackend) IsRecommended() bool

func (*GitlabBackend) IsScriptless

func (b *GitlabBackend) IsScriptless() bool

func (*GitlabBackend) IsStable

func (b *GitlabBackend) IsStable() bool

func (*GitlabBackend) ListVersions

func (b *GitlabBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*GitlabBackend) Name

func (b *GitlabBackend) Name() string

func (*GitlabBackend) ResolveVersion

func (b *GitlabBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*GitlabBackend) SupportsChecksum

func (b *GitlabBackend) SupportsChecksum() bool

func (*GitlabBackend) SupportsGPG

func (b *GitlabBackend) SupportsGPG() bool

func (*GitlabBackend) SupportsOffline

func (b *GitlabBackend) SupportsOffline() bool

type GoBackend

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

func NewGoBackend

func NewGoBackend() *GoBackend

func (*GoBackend) AttestationType

func (b *GoBackend) AttestationType() string

func (*GoBackend) Dependencies

func (b *GoBackend) Dependencies() []string

func (*GoBackend) GetDownloadInfo

func (b *GoBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*GoBackend) GetReach

func (b *GoBackend) GetReach() string

func (*GoBackend) IsRecommended

func (b *GoBackend) IsRecommended() bool

func (*GoBackend) IsScriptless

func (b *GoBackend) IsScriptless() bool

func (*GoBackend) IsStable

func (b *GoBackend) IsStable() bool

func (*GoBackend) ListVersions

func (b *GoBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*GoBackend) Name

func (b *GoBackend) Name() string

func (*GoBackend) ResolveVersion

func (b *GoBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*GoBackend) SupportsChecksum

func (b *GoBackend) SupportsChecksum() bool

func (*GoBackend) SupportsGPG

func (b *GoBackend) SupportsGPG() bool

func (*GoBackend) SupportsOffline

func (b *GoBackend) SupportsOffline() bool

type GoPkgBackend added in v0.0.9

type GoPkgBackend struct {
	*GoBackend
}

GoPkgBackend implements the backend for go packages. It embeds GoBackend to reuse its version resolution logic (proxy.golang.org).

func NewGoPkgBackend added in v0.0.9

func NewGoPkgBackend() *GoPkgBackend

func (*GoPkgBackend) Name added in v0.0.9

func (b *GoPkgBackend) Name() string

type HTTPBackend

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

HTTPBackend implements the Backend interface for direct HTTP downloads. This backend supports URL templates with placeholders for version, OS, and architecture.

func NewHTTPBackend

func NewHTTPBackend() *HTTPBackend

NewHTTPBackend creates a new HTTP backend.

func (*HTTPBackend) AttestationType

func (h *HTTPBackend) AttestationType() string

func (*HTTPBackend) Dependencies

func (h *HTTPBackend) Dependencies() []string

func (*HTTPBackend) GetDownloadInfo

func (h *HTTPBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

GetDownloadInfo retrieves download information for a specific version. This constructs the download URL from the configured template.

func (*HTTPBackend) GetDownloadInfoWithConfig

func (h *HTTPBackend) GetDownloadInfoWithConfig(ctx context.Context, tool string, version string, platform Platform, config HTTPConfig) (*VersionInfo, error)

GetDownloadInfoWithConfig retrieves download information using explicit configuration.

func (*HTTPBackend) GetReach

func (h *HTTPBackend) GetReach() string

func (*HTTPBackend) IsRecommended

func (h *HTTPBackend) IsRecommended() bool

func (*HTTPBackend) IsScriptless

func (h *HTTPBackend) IsScriptless() bool

func (*HTTPBackend) IsStable

func (h *HTTPBackend) IsStable() bool

func (*HTTPBackend) ListVersions

func (h *HTTPBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

ListVersions returns all available versions for an HTTP backend tool. Note: HTTP backend requires versions to be explicitly configured.

func (*HTTPBackend) Name

func (h *HTTPBackend) Name() string

Name returns the backend identifier.

func (*HTTPBackend) ResolveVersion

func (h *HTTPBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

ResolveVersion resolves a version request to a concrete version.

func (*HTTPBackend) SupportsChecksum

func (h *HTTPBackend) SupportsChecksum() bool

SupportsChecksum indicates whether this backend provides checksums.

func (*HTTPBackend) SupportsGPG

func (h *HTTPBackend) SupportsGPG() bool

SupportsGPG indicates whether this backend supports GPG signatures.

func (*HTTPBackend) SupportsOffline

func (h *HTTPBackend) SupportsOffline() bool

type HTTPConfig

type HTTPConfig struct {
	URLTemplate      string            // URL template with placeholders (e.g., "https://example.com/{{.version}}/{{.os}}-{{.arch}}.tar.gz")
	Versions         []string          // List of available versions
	ChecksumTemplate string            // Optional checksum URL template
	Replacements     map[string]string // Custom placeholder replacements
}

HTTPConfig represents the configuration for an HTTP backend tool. This should be provided in the tool configuration.

type HostingProvider

type HostingProvider interface {
	Name() string
	FetchReleases(ctx context.Context, tool string) ([]CommonRelease, error)
	FetchReleaseByTag(ctx context.Context, tool string, tag string) (*CommonRelease, error)
	GetAttestationType() string
	GetClient() *http.Client
}

HostingProvider defines the interface for fetching data from a hosting platform (GitHub, GitLab, etc.).

type LuarocksBackend

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

func NewLuarocksBackend

func NewLuarocksBackend() *LuarocksBackend

func (*LuarocksBackend) AttestationType

func (b *LuarocksBackend) AttestationType() string

func (*LuarocksBackend) Dependencies

func (b *LuarocksBackend) Dependencies() []string

func (*LuarocksBackend) GetDownloadInfo

func (b *LuarocksBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*LuarocksBackend) GetReach

func (b *LuarocksBackend) GetReach() string

func (*LuarocksBackend) IsRecommended

func (b *LuarocksBackend) IsRecommended() bool

func (*LuarocksBackend) IsScriptless

func (b *LuarocksBackend) IsScriptless() bool

func (*LuarocksBackend) IsStable

func (b *LuarocksBackend) IsStable() bool

func (*LuarocksBackend) ListVersions

func (b *LuarocksBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*LuarocksBackend) Name

func (b *LuarocksBackend) Name() string

func (*LuarocksBackend) ResolveVersion

func (b *LuarocksBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*LuarocksBackend) SupportsChecksum

func (b *LuarocksBackend) SupportsChecksum() bool

func (*LuarocksBackend) SupportsGPG

func (b *LuarocksBackend) SupportsGPG() bool

func (*LuarocksBackend) SupportsOffline

func (b *LuarocksBackend) SupportsOffline() bool

type MavenBackend

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

func NewMavenBackend

func NewMavenBackend() *MavenBackend

func (*MavenBackend) AttestationType

func (b *MavenBackend) AttestationType() string

func (*MavenBackend) Dependencies

func (b *MavenBackend) Dependencies() []string

func (*MavenBackend) GetDownloadInfo

func (b *MavenBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*MavenBackend) GetReach

func (b *MavenBackend) GetReach() string

func (*MavenBackend) IsRecommended

func (b *MavenBackend) IsRecommended() bool

func (*MavenBackend) IsScriptless

func (b *MavenBackend) IsScriptless() bool

func (*MavenBackend) IsStable

func (b *MavenBackend) IsStable() bool

func (*MavenBackend) ListVersions

func (b *MavenBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*MavenBackend) Name

func (b *MavenBackend) Name() string

func (*MavenBackend) ResolveVersion

func (b *MavenBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*MavenBackend) SupportsChecksum

func (b *MavenBackend) SupportsChecksum() bool

func (*MavenBackend) SupportsGPG

func (b *MavenBackend) SupportsGPG() bool

func (*MavenBackend) SupportsOffline

func (b *MavenBackend) SupportsOffline() bool

type NativeBackend

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

NativeBackend implements the Backend interface using built-in native recipes.

func NewNativeBackend

func NewNativeBackend() *NativeBackend

func (*NativeBackend) AttestationType

func (b *NativeBackend) AttestationType() string

func (*NativeBackend) Dependencies

func (b *NativeBackend) Dependencies() []string

func (*NativeBackend) GetDownloadInfo

func (b *NativeBackend) GetDownloadInfo(ctx context.Context, tool, version string, platform Platform) (*VersionInfo, error)

func (*NativeBackend) GetReach

func (b *NativeBackend) GetReach() string

func (*NativeBackend) IsRecommended

func (b *NativeBackend) IsRecommended() bool

func (*NativeBackend) IsScriptless

func (b *NativeBackend) IsScriptless() bool

func (*NativeBackend) IsStable

func (b *NativeBackend) IsStable() bool

func (*NativeBackend) ListVersions

func (b *NativeBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*NativeBackend) Name

func (b *NativeBackend) Name() string

func (*NativeBackend) ResolveVersion

func (b *NativeBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*NativeBackend) SupportsChecksum

func (b *NativeBackend) SupportsChecksum() bool

func (*NativeBackend) SupportsGPG

func (b *NativeBackend) SupportsGPG() bool

func (*NativeBackend) SupportsOffline

func (b *NativeBackend) SupportsOffline() bool

type NpmBackend

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

NpmBackend implements the Backend interface for npm packages.

func NewNpmBackend

func NewNpmBackend() *NpmBackend

NewNpmBackend creates a new npm backend.

func (*NpmBackend) AttestationType

func (b *NpmBackend) AttestationType() string

func (*NpmBackend) Dependencies

func (b *NpmBackend) Dependencies() []string

func (*NpmBackend) GetDownloadInfo

func (b *NpmBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*NpmBackend) GetReach

func (b *NpmBackend) GetReach() string

func (*NpmBackend) IsRecommended

func (b *NpmBackend) IsRecommended() bool

func (*NpmBackend) IsScriptless

func (b *NpmBackend) IsScriptless() bool

func (*NpmBackend) IsStable

func (b *NpmBackend) IsStable() bool

func (*NpmBackend) ListVersions

func (b *NpmBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*NpmBackend) Name

func (b *NpmBackend) Name() string

func (*NpmBackend) ResolveVersion

func (b *NpmBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*NpmBackend) SupportsChecksum

func (b *NpmBackend) SupportsChecksum() bool

func (*NpmBackend) SupportsGPG

func (b *NpmBackend) SupportsGPG() bool

func (*NpmBackend) SupportsOffline

func (b *NpmBackend) SupportsOffline() bool

type PipxBackend

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

PipxBackend implements the Backend interface for pipx packages. It leverages the PyPI backend for version resolution as pipx packages are hosted on PyPI.

func NewPipxBackend

func NewPipxBackend() *PipxBackend

NewPipxBackend creates a new pipx backend.

func (*PipxBackend) AttestationType

func (b *PipxBackend) AttestationType() string

func (*PipxBackend) Dependencies

func (b *PipxBackend) Dependencies() []string

func (*PipxBackend) GetDownloadInfo

func (b *PipxBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*PipxBackend) GetReach

func (b *PipxBackend) GetReach() string

func (*PipxBackend) IsRecommended

func (b *PipxBackend) IsRecommended() bool

func (*PipxBackend) IsScriptless

func (b *PipxBackend) IsScriptless() bool

func (*PipxBackend) IsStable

func (b *PipxBackend) IsStable() bool

func (*PipxBackend) ListVersions

func (b *PipxBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*PipxBackend) Name

func (b *PipxBackend) Name() string

func (*PipxBackend) ResolveVersion

func (b *PipxBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*PipxBackend) SupportsChecksum

func (b *PipxBackend) SupportsChecksum() bool

func (*PipxBackend) SupportsGPG

func (b *PipxBackend) SupportsGPG() bool

func (*PipxBackend) SupportsOffline

func (b *PipxBackend) SupportsOffline() bool

type Platform

type Platform struct {
	OS   string // e.g., "linux", "darwin", "windows"
	Arch string // e.g., "amd64", "arm64", "386"
}

Platform represents the operating system and architecture information.

func CurrentPlatform

func CurrentPlatform() Platform

CurrentPlatform returns the platform information for the current system.

func (Platform) String

func (p Platform) String() string

String returns a string representation of the platform (e.g., "linux-amd64").

type ProvenanceResult

type ProvenanceResult struct {
	// Supported is false when the project publishes no attestations.
	Supported bool
	// Verified is true when the attestation bundle passed all checks.
	Verified bool
	// Repository is the source repository recorded in the Fulcio cert SAN.
	Repository string
	// WorkflowRef is the triggering workflow path recorded in the cert.
	WorkflowRef string
	// PredicateType is the in-toto predicate URI in the signed statement.
	PredicateType string
	// BuilderID is the SLSA builder identifier from the certificate extension.
	BuilderID string
}

ProvenanceResult represents the metadata extracted from a verified provenance bundle.

func VerifyArtifactProvenance

func VerifyArtifactProvenance(
	ctx context.Context,
	token, owner, repo, artifactPath string,
) (*ProvenanceResult, error)

VerifyArtifactProvenance checks the GitHub attestation for the artifact at artifactPath against the repository owner/repo.

func VerifyGitlabArtifactProvenance

func VerifyGitlabArtifactProvenance(
	ctx context.Context,
	token, owner, repo, artifactPath string,
) (*ProvenanceResult, error)

VerifyGitlabArtifactProvenance checks the GitLab attestation for the artifact at artifactPath against the repository owner/repo.

type PypiBackend

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

PypiBackend implements the Backend interface for PyPI packages.

func NewPypiBackend

func NewPypiBackend() *PypiBackend

NewPypiBackend creates a new PyPI backend.

func (*PypiBackend) AttestationType

func (b *PypiBackend) AttestationType() string

func (*PypiBackend) Dependencies

func (b *PypiBackend) Dependencies() []string

func (*PypiBackend) GetDownloadInfo

func (b *PypiBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*PypiBackend) GetReach

func (b *PypiBackend) GetReach() string

func (*PypiBackend) IsRecommended

func (b *PypiBackend) IsRecommended() bool

func (*PypiBackend) IsScriptless

func (b *PypiBackend) IsScriptless() bool

func (*PypiBackend) IsStable

func (b *PypiBackend) IsStable() bool

func (*PypiBackend) ListVersions

func (b *PypiBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*PypiBackend) Name

func (b *PypiBackend) Name() string

func (*PypiBackend) ResolveVersion

func (b *PypiBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*PypiBackend) SupportsChecksum

func (b *PypiBackend) SupportsChecksum() bool

func (*PypiBackend) SupportsGPG

func (b *PypiBackend) SupportsGPG() bool

func (*PypiBackend) SupportsOffline

func (b *PypiBackend) SupportsOffline() bool

type Registry

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

Registry manages backend implementations and provides discovery by name.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new backend registry with default backends registered.

func (*Registry) Backends

func (r *Registry) Backends() map[string]Backend

Backends returns a copy of all registered backends.

func (*Registry) Get

func (r *Registry) Get(name string) (Backend, error)

Get retrieves a backend by name. Returns an error if the backend is not found.

func (*Registry) Has

func (r *Registry) Has(name string) bool

Has checks if a backend is registered.

func (*Registry) List

func (r *Registry) List() []string

List returns a list of all registered backend names.

func (*Registry) Register

func (r *Registry) Register(backend Backend)

Register registers a backend in the registry. If a backend with the same name already exists, it will be replaced.

func (*Registry) Unregister

func (r *Registry) Unregister(name string)

Unregister removes a backend from the registry.

type S3Backend

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

S3Backend implements the Backend interface for Amazon S3 buckets.

func NewS3Backend

func NewS3Backend() *S3Backend

NewS3Backend creates a new S3 backend.

func (*S3Backend) AttestationType

func (b *S3Backend) AttestationType() string

func (*S3Backend) Dependencies

func (b *S3Backend) Dependencies() []string

func (*S3Backend) GetDownloadInfo

func (b *S3Backend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*S3Backend) GetReach

func (b *S3Backend) GetReach() string

func (*S3Backend) IsRecommended

func (b *S3Backend) IsRecommended() bool

func (*S3Backend) IsScriptless

func (b *S3Backend) IsScriptless() bool

func (*S3Backend) IsStable

func (b *S3Backend) IsStable() bool

func (*S3Backend) ListVersions

func (b *S3Backend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*S3Backend) Name

func (b *S3Backend) Name() string

func (*S3Backend) ResolveVersion

func (b *S3Backend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*S3Backend) SupportsChecksum

func (b *S3Backend) SupportsChecksum() bool

func (*S3Backend) SupportsGPG

func (b *S3Backend) SupportsGPG() bool

func (*S3Backend) SupportsOffline

func (b *S3Backend) SupportsOffline() bool

type SigstoreVerifier

type SigstoreVerifier struct {
	TrustedMaterials []root.TrustedMaterial
	Identities       []verify.CertificateIdentity
	ExpectedRepo     string
}

SigstoreVerifier acts as the common orchestration engine for verifying Sigstore bundles across different platforms (GitHub, GitLab, etc.)

func (*SigstoreVerifier) VerifyBundles

func (v *SigstoreVerifier) VerifyBundles(bundles []json.RawMessage, artifactDigest string) (*ProvenanceResult, error)

VerifyBundles attempts to verify a list of bundles against the provided identities and trust roots. It returns the first successful verification result.

type SpmBackend

type SpmBackend struct {
}

SpmBackend implements the Backend interface for Swift Package Manager.

func NewSpmBackend

func NewSpmBackend() *SpmBackend

NewSpmBackend creates a new spm backend.

func (*SpmBackend) AttestationType

func (b *SpmBackend) AttestationType() string

func (*SpmBackend) Dependencies

func (b *SpmBackend) Dependencies() []string

func (*SpmBackend) GetDownloadInfo

func (b *SpmBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*SpmBackend) GetReach

func (b *SpmBackend) GetReach() string

func (*SpmBackend) IsRecommended

func (b *SpmBackend) IsRecommended() bool

func (*SpmBackend) IsScriptless

func (b *SpmBackend) IsScriptless() bool

func (*SpmBackend) IsStable

func (b *SpmBackend) IsStable() bool

func (*SpmBackend) ListVersions

func (b *SpmBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*SpmBackend) Name

func (b *SpmBackend) Name() string

func (*SpmBackend) ResolveVersion

func (b *SpmBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*SpmBackend) SupportsChecksum

func (b *SpmBackend) SupportsChecksum() bool

func (*SpmBackend) SupportsGPG

func (b *SpmBackend) SupportsGPG() bool

func (*SpmBackend) SupportsOffline

func (b *SpmBackend) SupportsOffline() bool

type VersionInfo

type VersionInfo struct {
	Version      string            // The version string (e.g., "1.20.0")
	DownloadURL  string            // URL to download the artifact
	Checksum     string            // SHA-256 checksum of the artifact
	SignatureURL string            // URL to download the GPG signature (.asc, .sig)
	GPGSignature string            // Raw GPG signature content
	GPGKeys      []string          // Trusted GPG fingerprints for this version
	Platform     Platform          // Target platform for this artifact
	Metadata     map[string]string // Additional metadata (e.g., release date, notes)
	PublishedAt  time.Time         // The time this version was published/released
}

VersionInfo contains metadata about a specific tool version.

func GenericGetDownloadInfo

func GenericGetDownloadInfo(ctx context.Context, p HostingProvider, tool string, version string, platform Platform) (*VersionInfo, error)

GenericGetDownloadInfo implements the common logic for retrieving download info.

func GenericResolveVersion

func GenericResolveVersion(ctx context.Context, p HostingProvider, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

GenericResolveVersion implements the common logic for resolving a version request.

type VfoxBackend

type VfoxBackend struct {
}

VfoxBackend implements the Backend interface for vfox plugins.

func NewVfoxBackend

func NewVfoxBackend() *VfoxBackend

NewVfoxBackend creates a new vfox backend.

func (*VfoxBackend) AttestationType

func (b *VfoxBackend) AttestationType() string

func (*VfoxBackend) Dependencies

func (b *VfoxBackend) Dependencies() []string

func (*VfoxBackend) GetDownloadInfo

func (b *VfoxBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*VfoxBackend) GetReach

func (b *VfoxBackend) GetReach() string

func (*VfoxBackend) IsRecommended

func (b *VfoxBackend) IsRecommended() bool

func (*VfoxBackend) IsScriptless

func (b *VfoxBackend) IsScriptless() bool

func (*VfoxBackend) IsStable

func (b *VfoxBackend) IsStable() bool

func (*VfoxBackend) ListVersions

func (b *VfoxBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*VfoxBackend) Name

func (b *VfoxBackend) Name() string

func (*VfoxBackend) ResolveVersion

func (b *VfoxBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*VfoxBackend) SupportsChecksum

func (b *VfoxBackend) SupportsChecksum() bool

func (*VfoxBackend) SupportsGPG

func (b *VfoxBackend) SupportsGPG() bool

func (*VfoxBackend) SupportsOffline

func (b *VfoxBackend) SupportsOffline() bool

type ZigBackend

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

func NewZigBackend

func NewZigBackend() *ZigBackend

func (*ZigBackend) AttestationType

func (b *ZigBackend) AttestationType() string

func (*ZigBackend) Dependencies

func (b *ZigBackend) Dependencies() []string

func (*ZigBackend) GetDownloadInfo

func (b *ZigBackend) GetDownloadInfo(ctx context.Context, tool string, version string, platform Platform) (*VersionInfo, error)

func (*ZigBackend) GetReach

func (b *ZigBackend) GetReach() string

func (*ZigBackend) IsRecommended

func (b *ZigBackend) IsRecommended() bool

func (*ZigBackend) IsScriptless

func (b *ZigBackend) IsScriptless() bool

func (*ZigBackend) IsStable

func (b *ZigBackend) IsStable() bool

func (*ZigBackend) ListVersions

func (b *ZigBackend) ListVersions(ctx context.Context, tool string, platform Platform) ([]VersionInfo, error)

func (*ZigBackend) Name

func (b *ZigBackend) Name() string

func (*ZigBackend) ResolveVersion

func (b *ZigBackend) ResolveVersion(ctx context.Context, tool string, versionRequest string, platform Platform) (*VersionInfo, error)

func (*ZigBackend) SupportsChecksum

func (b *ZigBackend) SupportsChecksum() bool

func (*ZigBackend) SupportsGPG

func (b *ZigBackend) SupportsGPG() bool

func (*ZigBackend) SupportsOffline

func (b *ZigBackend) SupportsOffline() bool

Jump to

Keyboard shortcuts

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