Documentation
¶
Overview ¶
Package schemameta handles parsing, inference, and validation of TS11 SchemaMeta objects.
Index ¶
- Variables
- func DetectFormats(dir, slug string) (formats []string, files map[string]string, err error)
- func DetectLegacyCredentials(dir string, knownSlugs map[string]bool) ([]string, error)
- func GenerateID(org, slug string) string
- func NormalizeAttestationLoS(v string) string
- func NormalizeBindingType(v string) string
- func ValidSupportedFormat(f string) bool
- type SchemaMeta
- type SchemaMetaSource
- type SchemaURI
- type TrustAuthority
- type Validator
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.
var ValidAttestationLoS = map[string]bool{ "iso_18045_high": true, "iso_18045_moderate": true, "iso_18045_enhanced-basic": true, "iso_18045_basic": true, }
ValidAttestationLoS lists the normative TS11 attestation LoS values.
var ValidBindingType = map[string]bool{ "claim": true, "key": true, "biometric": true, "none": true, }
ValidBindingType lists the normative TS11 binding type values.
var ValidSupportedFormats = map[string]bool{ "dc+sd-jwt": true, "mso_mdoc": true, "jwt_vc_json": true, "jwt_vc_json-ld": true, "ldp_vc": true, }
ValidSupportedFormat returns true if the format identifier is one of the normative TS11 supported formats.
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, and finally checks for bare {slug}.json as a VCTM (dc+sd-jwt) file.
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.
func NormalizeAttestationLoS ¶ added in v0.7.0
NormalizeAttestationLoS maps legacy/friendly values to normative TS11 enum values.
func NormalizeBindingType ¶ added in v0.7.0
NormalizeBindingType maps legacy/friendly values to normative TS11 enum values.
func ValidSupportedFormat ¶ added in v0.7.0
ValidSupportedFormat checks whether a format string is in the normative enum.
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 []TrustAuthority `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 []TrustAuthority `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 TrustAuthority ¶ added in v0.7.0
type TrustAuthority struct {
FrameworkType string `yaml:"framework_type" json:"frameworkType"`
Value string `yaml:"value" json:"value"`
IsLOTE *bool `yaml:"is_lote,omitempty" json:"isLOTE,omitempty"`
}
TrustAuthority represents a trust framework reference per TS11 Section 4.3.3.
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.
func (*Validator) ValidateRaw ¶ added in v0.7.0
ValidateRaw checks a raw map against the TS11 JSON schema. This is used to test additionalProperties enforcement.