hex

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package hex validates Hex tarballs and extracts metadata needed by the signed registry v2 protocol. It never executes metadata.config as Erlang.

Index

Constants

View Source
const (
	MaxTarballBytes = 64 << 20
)

Variables

This section is empty.

Functions

func DecodeNames

func DecodeNames(body []byte, key *rsa.PublicKey) (string, []string, error)

DecodeNames verifies a signed upstream /names resource before it is used to build a new resource under this repository's own signing key.

func DerivedPath

func DerivedPath(p string) bool

func EncodeNames

func EncodeNames(repository string, names []string, private *rsa.PrivateKey) ([]byte, error)

func EncodePackage

func EncodePackage(reg RegistryPackage, private *rsa.PrivateKey) ([]byte, error)

func EncodeVersions

func EncodeVersions(
	repository string,
	packages []RegistryPackage,
	private *rsa.PrivateKey,
) ([]byte, error)

func Files

func Files(ctx context.Context, st store.Store, c repo.Config) ([]types.Item, error)

func IsTarballPath

func IsTarballPath(p string) bool

func ParsePublicKey

func ParsePublicKey(value string) (*rsa.PublicKey, error)

func PublicKeyPEM

func PublicKeyPEM(key *rsa.PrivateKey) string

func Serves

func Serves(t repo.PackageType) bool

func TarballPath

func TarballPath(name, version string) (string, bool)

func ValidName

func ValidName(name string) bool

func ValidVersion

func ValidVersion(version string) bool

Types

type Handler

type Handler struct{ generic.Handler }

func (Handler) Admit

func (Handler) Admit(
	ctx context.Context, env format.Env, c repo.Config, w format.Write,
) (format.Write, error)

func (Handler) Classify

func (Handler) Classify(_ repo.Config, p string) format.Class

func (Handler) Deployed

func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Inspect

func (Handler) Inspect(
	ctx context.Context, env format.Env, _ repo.Config, w format.Write,
) (any, error)

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

type Package

type Package struct {
	Name          string
	Version       string
	Requirements  []Requirement
	InnerChecksum [32]byte
	OuterChecksum [32]byte
	// These signed registry fields are retained when a remote view is
	// permission-filtered and re-signed. Local tarballs do not carry them.
	Retirement      []byte
	AdvisoryIndexes []uint64
	PublishedAt     []byte
}

func InspectTarball

func InspectTarball(r io.Reader) (Package, error)

InspectTarball validates both tar layers and metadata before the item can be admitted to a repository. The source bytes remain unchanged.

type RegistryPackage

type RegistryPackage struct {
	Name       string
	Repository string
	Releases   []Package
	Advisories [][]byte
}

RegistryPackage is the verified content of /packages/NAME. Release checksums are binary SHA-256 digests, exactly as Hex registry v2 prescribes.

func DecodePackage

func DecodePackage(body []byte, key *rsa.PublicKey) (RegistryPackage, error)

func DecodeVersions

func DecodeVersions(body []byte, key *rsa.PublicKey) (string, []RegistryPackage, error)

DecodeVersions verifies a signed upstream /versions resource.

type Requirement

type Requirement struct {
	Package     string
	Requirement string
	App         string
	Repository  string
	Optional    bool
}

Jump to

Keyboard shortcuts

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