schemameta

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: BSD-2-Clause Imports: 10 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 schemameta handles parsing, inference, and validation of TS11 SchemaMeta objects.

Index

Constants

This section is empty.

Variables

View Source
var FormatMapping = map[string]string{
	".vctm.json": "dc+sd-jwt",
	".mdoc.json": "mso_mdoc",
	".vc.json":   "jwt_vc_json",
}

FormatMapping maps file extensions to TS11 format identifiers.

View Source
var LegacyVCTMExtensions = []string{".vctm.json", ".vctm"}

LegacyVCTMExtensions lists file extensions that indicate a legacy VCTM file (JSON content) that can be used for credential discovery when no schema-meta exists.

View Source
var UUIDNamespace = uuid.MustParse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") // DNS namespace

UUIDNamespace is the UUID v5 namespace for registry.siros.org schema IDs.

Functions

func DetectFormats

func DetectFormats(dir, slug string) (formats []string, files map[string]string, err error)

DetectFormats scans a directory for known credential format files matching a slug and returns the detected format identifiers and file paths. It checks FormatMapping extensions first, then falls back to bare .vctm extension.

func DetectLegacyCredentials

func DetectLegacyCredentials(dir string, knownSlugs map[string]bool) ([]string, error)

DetectLegacyCredentials scans a directory for VCTM files (.vctm.json or .vctm) that do NOT have a corresponding schema-meta file, returning their slugs.

func GenerateID

func GenerateID(org, slug string) string

GenerateID produces a deterministic UUID v5 from org/slug.

Types

type SchemaMeta

type SchemaMeta struct {
	ID                 string      `json:"id"`
	Version            string      `json:"version"`
	AttestationLoS     string      `json:"attestationLoS"`
	BindingType        string      `json:"bindingType"`
	SupportedFormats   []string    `json:"supportedFormats"`
	SchemaURIs         []SchemaURI `json:"schemaURIs"`
	RulebookURI        string      `json:"rulebookURI,omitempty"`
	TrustedAuthorities []any       `json:"trustedAuthorities,omitempty"`
}

SchemaMeta is the full TS11 SchemaMeta object, combining authored and inferred fields.

func Infer

func Infer(src *SchemaMetaSource, org, slug, baseURL string, formats []string, formatFiles map[string]string) *SchemaMeta

Infer builds a complete SchemaMeta from authored source fields, detected formats, and context.

func InferLegacy

func InferLegacy(org, slug, baseURL string, formats []string, formatFiles map[string]string) *SchemaMeta

InferLegacy builds a SchemaMeta for a credential discovered via VCTM files only (no schema-meta.yaml). These will not pass TS11 validation.

type SchemaMetaSource

type SchemaMetaSource struct {
	AttestationLoS     string `yaml:"attestation_los" json:"attestationLoS"`
	BindingType        string `yaml:"binding_type" json:"bindingType"`
	Version            string `yaml:"version,omitempty" json:"version,omitempty"`
	TrustedAuthorities []any  `yaml:"trusted_authorities,omitempty" json:"trustedAuthorities,omitempty"`
	RulebookURI        string `yaml:"rulebook_uri,omitempty" json:"rulebookURI,omitempty"`
}

SchemaMetaSource represents the manually-authored fields from schema-meta.yaml.

func ParseSource

func ParseSource(path string) (*SchemaMetaSource, error)

ParseSource reads a schema-meta.yaml (or .json) file.

type SchemaURI

type SchemaURI struct {
	FormatIdentifier string `json:"formatIdentifier"`
	URI              string `json:"uri"`
}

SchemaURI represents a format-specific schema reference.

type Validator

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

Validator validates SchemaMeta objects against the TS11 JSON schema.

func NewValidator

func NewValidator() (*Validator, error)

NewValidator creates a validator using the embedded TS11 JSON schema.

func (*Validator) Validate

func (v *Validator) Validate(sm *SchemaMeta) error

Validate checks a SchemaMeta object against the TS11 JSON schema.

Jump to

Keyboard shortcuts

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