conformancecatalog

package
v1.322.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package conformancecatalog loads classic conformance checks and FCAF test definitions from config_templates into a process-private :memory: SQLite query cache (the sole post-rebuild projection).

Durable source of truth remains the filesystem under config_templates. There is no durable catalog collection in PocketBase data.db.

Clients use PocketBase collection URL shapes:

  • /api/collections/conformance_checks/records (check grain)
  • /api/collections/conformance_suites/records (suite grain; display metadata)

Credimi owns those routes and runs filter/sort/pagination via pocketbase/tools/search against the ephemeral DB. Writes are rejected. List/get auth is public (same posture as the former blueprints/hub listing).

Classic layout: standard/version/suite/<check file>. FCAF layout: fcaf/<version>/<suite>/tests/<id>.yaml — path identity is fcaf/<version>/<suite>/<test_id> (final segment = FCAF test id).

Refresh after local template edits: restart the process (boot rebuild) or call Rebuild / POST /api/conformance-catalog/rebuild with the internal admin API key.

Index

Constants

View Source
const (
	// ChecksCollectionName is the fake PocketBase collection name used in URLs and
	// client code (pb.collection('conformance_checks')).
	ChecksCollectionName = "conformance_checks"

	// CollectionID is a stable id echoed in JSON for PocketBase client compatibility.
	CollectionID = "pbc_conformance_checks_catalog"

	// SuitesCollectionName is the fake PocketBase collection for suite-grain rows.
	SuitesCollectionName = "conformance_suites"

	// SuitesCollectionID is echoed in suite list/get JSON for PB client compatibility.
	SuitesCollectionID = "pbc_conformance_suites_catalog"

	SurfaceManual   = "manual"
	SurfacePipeline = "pipeline"
)

Variables

This section is empty.

Functions

func CheckClientColumnNames

func CheckClientColumnNames() []string

CheckClientColumnNames is the FE Zod / typegen field set for checks.

func ComponentRank

func ComponentRank(component string) int

ComponentRank returns the hub default sort priority for a component uid. wallet → issuer → verifier; unknown/empty last.

func PathID

func PathID(path string) string

PathID returns the stable PocketBase record id for a check path. Encoding: lowercase hex SHA-256 of "credimi.conformance_check:" + path, truncated to 15 characters to match PocketBase's default id alphabet/length ([a-z0-9]{15}).

func Rebuild

func Rebuild(templatesDir string) error

Rebuild walks templatesDir (or TemplatesDir() when empty) and fully replaces the process-default :memory: query cache used by the fake PocketBase collection URL. That cache is the sole post-rebuild projection for the default handle (ADR-0001).

Refresh path for local template edits: call Rebuild, or POST /api/conformance-catalog/rebuild with Credimi-Api-Key = CREDIMI_INTERNAL_ADMIN_KEY, or restart the process (Register hooks rebuild on bootstrap).

func RebuildHTTP

func RebuildHTTP() func(e *core.RequestEvent) error

RebuildHTTP returns a handler that rebuilds the catalog (internal admin key).

func RecordViewHTTP

func RecordViewHTTP() func(*core.RequestEvent) error

RecordViewHTTP serves GET /api/collections/conformance_checks/records/{id}.

func RecordsListHTTP

func RecordsListHTTP() func(*core.RequestEvent) error

RecordsListHTTP serves GET /api/collections/conformance_checks/records using PocketBase tools/search against the process-private :memory: catalog.

func RecordsWriteRejectHTTP

func RecordsWriteRejectHTTP() func(*core.RequestEvent) error

RecordsWriteRejectHTTP rejects create/update/delete on the fake collection URL.

func Register

func Register(app core.App)

Register wires boot rebuild of the ephemeral catalog.

List/get are served by Credimi routes that mimic the PocketBase collection URL (/api/collections/conformance_checks/records and /api/collections/conformance_suites/records) — see RecordsListHTTP / SuitesListHTTP. Both list/get route groups are public; writes are rejected. There is no durable catalog collection shell in data.db.

Boot: OnBootstrap rebuilds from TemplatesDir(). A missing templates directory is skipped (test apps / empty checkouts); if the directory exists, rebuild failures fail bootstrap. Refresh without restart: Rebuild("") or POST /api/conformance-catalog/rebuild.

func SuiteClientColumnNames

func SuiteClientColumnNames() []string

SuiteClientColumnNames is the FE Zod / typegen field set for suites.

func SuiteHasQR

func SuiteHasQR(pathPrefix string) bool

SuiteHasQR reports whether the suite grain at pathPrefix has authored has_qr. Absent suite, catalog unavailable, or false ⇒ false.

func SuitePathPrefix

func SuitePathPrefix(fsStandard, fsVersion, suite string) string

SuitePathPrefix builds the durable suite path_prefix (fs_standard/fs_version/suite).

func SuitePathPrefixFromCheckID

func SuitePathPrefixFromCheckID(checkID string) string

SuitePathPrefixFromCheckID derives path_prefix from a check path (fs_standard/fs_version/suite/…). Returns "" when the id has fewer than 3 segments.

func SuiteViewHTTP

func SuiteViewHTTP() func(*core.RequestEvent) error

SuiteViewHTTP serves GET /api/collections/conformance_suites/records/{id}.

func SuitesListHTTP

func SuitesListHTTP() func(*core.RequestEvent) error

SuitesListHTTP serves GET /api/collections/conformance_suites/records.

func SuitesWriteRejectHTTP

func SuitesWriteRejectHTTP() func(*core.RequestEvent) error

SuitesWriteRejectHTTP rejects writes on the suites collection URL.

func TemplatesDir

func TemplatesDir() string

TemplatesDir resolves config_templates from ROOT_DIR (empty ROOT_DIR → ./config_templates).

Types

type Check

type Check struct {
	ID         string      `db:"id" json:"id"`
	Path       string      `db:"path" json:"path"`
	Title      string      `db:"title" json:"title"`
	FSStandard string      `db:"fs_standard" json:"fs_standard"`
	FSVersion  string      `db:"fs_version" json:"fs_version"`
	Suite      string      `db:"suite" json:"suite"`
	File       string      `db:"file" json:"file"`
	VisibleIn  stringArray `db:"visible_in" json:"visible_in"`
	Protocol   string      `db:"protocol" json:"protocol"`
	SUT        string      `db:"sut" json:"sut"`
	Role       string      `db:"role" json:"role"`
	Provider   string      `db:"provider" json:"provider"`
	Standard   string      `db:"standard" json:"standard"`
	Component  string      `db:"component" json:"component"`
	Version    string      `db:"version" json:"version"`
	Created    string      `db:"created" json:"created"`
	Updated    string      `db:"updated" json:"updated"`
}

Check is one catalog entry derived from a template file. Lean check grain: path, title, facets, and identity only. Suite display metadata (name, logo, URLs) lives on the suite projection (ADR-0002). Generated from checkColumns; HTTP list/get wraps it in checkHTTPRecord.

type ClientColumn

type ClientColumn struct {
	Name     string
	Kind     ColumnKind
	Optional bool
	// Default is a TypeScript literal pasted into z.….default(<Default>) when Optional.
	// Examples: "”", "[]", "9". Empty means no .default().
	Default string
}

ClientColumn is one Client-facing catalog wire field (exported for go generate).

func CheckClientColumns

func CheckClientColumns() []ClientColumn

CheckClientColumns returns Client wire specs for checks (go generate).

func SuiteClientColumns

func SuiteClientColumns() []ClientColumn

SuiteClientColumns returns Client wire specs for suites (go generate).

type ColumnKind

type ColumnKind string

ColumnKind is the FE wire kind for a Client=true column (Zod + PB typegen).

const (
	ColumnKindString      ColumnKind = "string"
	ColumnKindInt         ColumnKind = "int"
	ColumnKindNonNegInt   ColumnKind = "nonNegInt"
	ColumnKindBool        ColumnKind = "bool"
	ColumnKindStringArray ColumnKind = "stringArray"
	ColumnKindMemberArray ColumnKind = "memberArray"
)

type GrainColumn

type GrainColumn struct {
	Name string
	Kind ColumnKind
}

GrainColumn is one persisted catalog column exposed for Go record generate (ADR-0009). Includes Client=false timestamps.

func CheckGrainColumns

func CheckGrainColumns() []GrainColumn

CheckGrainColumns returns all check-grain columns for Go record generate.

func SuiteGrainColumns

func SuiteGrainColumns() []GrainColumn

SuiteGrainColumns returns all suite-grain columns for Go record generate.

type LoadedCatalog

type LoadedCatalog struct {
	Checks []Check
	Suites []SuiteRecord
}

LoadedCatalog is the filesystem walk result: lean checks and projected suite rows (ADR-0002, ADR-0006). Suite display metadata stays internal to the walk. Check / SuiteRecord types are generated from columnSpec (ADR-0009).

func LoadFromDir

func LoadFromDir(templatesDir string) (LoadedCatalog, error)

LoadFromDir walks templatesDir once and returns lean checks plus projected suite-grain rows. Layout: standard/version/suite/file (classic) or …/tests/<id>.yaml (FCAF). Suite display from metadata.yaml is applied during projection and is not part of the returned value. Does not touch PocketBase; Rebuild inserts the returned rows into the process-private ephemeral store.

type PathIdentity

type PathIdentity struct {
	// Standard is the product standard uid (openid4vp, openid4vci, or passthrough).
	Standard string
	// Component is wallet, issuer, or verifier when known; empty when unmapped.
	Component string
	// Version is the standard profile version (1.0, draft-23, …). Empty for FCAF
	// packs that have no pinned OpenID profile yet (FS version is an SUT label).
	Version string
}

PathIdentity is the in-memory product projection of a filesystem catalog path. Durable path strings stay FS-shaped; hub grouping/filter/sort uses these fields.

func NormalizePathIdentity

func NormalizePathIdentity(fsStandard, fsVersion, fsSuite string) PathIdentity

NormalizePathIdentity projects FS path segments into product Standard / Component / Version without renaming durable paths.

type SuiteMember

type SuiteMember struct {
	Path  string `json:"path"`
	Title string `json:"title"`
	File  string `json:"file"`
}

SuiteMember is one check leaf on a suite-grain catalog row.

type SuiteRecord

type SuiteRecord struct {
	ID               string      `db:"id" json:"id"`
	Standard         string      `db:"standard" json:"standard"`
	Component        string      `db:"component" json:"component"`
	ComponentRank    int         `db:"component_rank" json:"component_rank"`
	Version          string      `db:"version" json:"version"`
	Suite            string      `db:"suite" json:"suite"`
	Provider         string      `db:"provider" json:"provider"`
	ProviderLabel    string      `db:"provider_label" json:"provider_label"`
	SuiteName        string      `db:"suite_name" json:"suite_name"`
	SuiteSubtitle    string      `db:"suite_subtitle" json:"suite_subtitle"`
	SuiteHomepage    string      `db:"suite_homepage" json:"suite_homepage"`
	SuiteRepository  string      `db:"suite_repository" json:"suite_repository"`
	SuiteHelp        string      `db:"suite_help" json:"suite_help"`
	SuiteDescription string      `db:"suite_description" json:"suite_description"`
	HasQR            bool        `db:"has_qr" json:"has_qr"`
	CheckCount       int         `db:"check_count" json:"check_count"`
	Members          memberArray `db:"members" json:"members"`
	VisibleIn        stringArray `db:"visible_in" json:"visible_in"`
	FSStandard       string      `db:"fs_standard" json:"fs_standard"`
	FSVersion        string      `db:"fs_version" json:"fs_version"`
	PathPrefix       string      `db:"path_prefix" json:"path_prefix"`
	Created          string      `db:"created" json:"created"`
	Updated          string      `db:"updated" json:"updated"`
}

SuiteRecord is one hub-table row: a suite under normalized standard×component×version. FS* fields preserve durable path identity for hub links; Standard/Component/Version are the product projection. Generated from suiteColumns; HTTP list/get wraps it in suiteHTTPRecord.

Jump to

Keyboard shortcuts

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