Documentation
¶
Overview ¶
Package schemameta handles parsing, inference, and validation of TS11 SchemaMeta objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
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.
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 ¶
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 ¶
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 ¶
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 Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates SchemaMeta objects against the TS11 JSON schema.
func NewValidator ¶
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.