repoplugin

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: BSD-2-Clause Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package repoplugin defines the interface for repository layout plugins.

A repo plugin knows how to discover credentials from a particular repository directory layout. Different source repositories organize their credential schemas, metadata, and governance documents in different ways. Plugins abstract over these layout differences, presenting a uniform DiscoveredCredential to the build pipeline.

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is the global plugin registry.

Functions

func Register

func Register(p Plugin)

Register adds a plugin to the default registry.

Types

type Context

type Context struct {
	// RepoDir is the root directory of the cloned or local repository.
	RepoDir string

	// SubPath is an optional relative path restriction within the repo.
	// If set, the plugin should only discover credentials under this path.
	SubPath string

	// Organization is the resolved organization name for this source.
	Organization string

	// BaseURL is the registry base URL for generating schema URIs.
	BaseURL string

	// Options contains source-level key-value options from sources.yaml.
	// Plugins parse their own options from this map.
	Options map[string]string

	// Logger for structured logging.
	Logger *slog.Logger
}

Context provides plugins with the information they need for discovery.

type DiscoveredCredential

type DiscoveredCredential struct {
	// Org is the organization identifier (used in URLs and grouping).
	Org string

	// Slug is the credential slug (used in URLs and deterministic IDs).
	Slug string

	// SchemaMetaSource contains manually-authored governance metadata.
	// If nil, the credential will not pass TS11 validation (but may still
	// appear on the registry site as a legacy credential).
	SchemaMetaSource *schemameta.SchemaMetaSource

	// FormatFiles maps TS11 format identifiers to absolute file paths.
	// Keys: "dc+sd-jwt", "mso_mdoc", "jwt_vc_json"
	FormatFiles map[string]string

	// GeneratedVCTM holds synthesized VCTM JSON content when the plugin
	// generates it in-memory (e.g., from JSON Schema conversion) rather than
	// reading from an existing file.
	GeneratedVCTM []byte

	// GeneratedMdoc holds synthesized mDOC metadata JSON when generated
	// in-memory by the plugin.
	GeneratedMdoc []byte

	// Assets maps asset type keys to absolute file paths for discovered
	// visual assets (SVG templates, logos, etc.). Convention keys:
	//   "svg_template"       — card SVG template
	//   "svg_template_dark"  — dark mode variant
	//   "logo"              — credential logo (SVG or PNG)
	Assets map[string]string

	// RulebookPath is the absolute path to the rulebook source (markdown).
	// Empty if no rulebook is available.
	RulebookPath string

	// SourceURL is the repository URL for provenance tracking.
	SourceURL string

	// SourceRepo is the repository name.
	SourceRepo string
}

DiscoveredCredential is the uniform output from any layout plugin. It contains everything the pipeline needs regardless of source structure.

type Plugin

type Plugin interface {
	// Name returns the plugin identifier (e.g., "default", "rulebook-catalog").
	// This value is used in the "layout" field of sources.yaml entries.
	Name() string

	// Description returns a human-readable description of the layout this
	// plugin handles.
	Description() string

	// Discover scans the repository directory and returns all credentials
	// found according to the plugin's layout conventions.
	Discover(ctx Context) ([]DiscoveredCredential, error)
}

Plugin discovers credentials from a repository directory. Each layout type implements this interface.

func Get

func Get(name string) (Plugin, bool)

Get retrieves a plugin from the default registry.

func MustGet

func MustGet(name string) Plugin

MustGet retrieves a plugin or panics if not found.

type Registry

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

Registry holds all registered repo plugins.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new plugin registry.

func (*Registry) Get

func (r *Registry) Get(name string) (Plugin, bool)

Get retrieves a plugin by name.

func (*Registry) List

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

List returns the names of all registered plugins.

func (*Registry) Register

func (r *Registry) Register(p Plugin)

Register adds a plugin to the registry.

Directories

Path Synopsis
Package defaultlayout implements the repo plugin for the standard SIROS credential repository layout (co-located schema-meta + format files).
Package defaultlayout implements the repo plugin for the standard SIROS credential repository layout (co-located schema-meta + format files).
Package rulebookcatalog implements the repo plugin for EUDI-style attestation rulebook catalog repositories (e.g., webuild-attestation-rulebooks-catalog).
Package rulebookcatalog implements the repo plugin for EUDI-style attestation rulebook catalog repositories (e.g., webuild-attestation-rulebooks-catalog).

Jump to

Keyboard shortcuts

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