attributes

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package attributes implements the TS11 §2 Catalogue of Attributes. It infers Attribute objects from VCTM claim definitions and supports optional manual overrides via *.attr.json files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSchemas

func GenerateSchemas(attrs []Attribute) map[string]json.RawMessage

GenerateSchemas generates a minimal JSON Schema for each attribute. Returns a map from schema filename to JSON content.

Types

type AttestationRef

type AttestationRef struct {
	SchemaID string `json:"schemaId"`
	Org      string `json:"org"`
	Slug     string `json:"slug"`
	Name     string `json:"name,omitempty"`
}

AttestationRef links an attribute back to an attestation that uses it. This is a SIROS extension (x-usedBy) not in the TS11 spec.

type Attribute

type Attribute struct {
	Identifier                string               `json:"identifier"`
	Name                      []LangValue          `json:"name"`
	Description               []LangValue          `json:"description,omitempty"`
	NameSpace                 string               `json:"nameSpace,omitempty"`
	Distributions             []SchemaDistribution `json:"distributions"`
	ContactInfo               []string             `json:"contactInfo,omitempty"`
	LegalBasis                []string             `json:"legalBasis,omitempty"`
	SemanticDataSpecification string               `json:"semanticDataSpecification,omitempty"`
	AuthenticSources          []DataService        `json:"authenticSources,omitempty"`
	UsedBy                    []AttestationRef     `json:"x-usedBy,omitempty"` // cross-reference to attestations
}

Attribute represents a TS11 §2.1 Attribute object.

func InferFromCredentials

func InferFromCredentials(credentials []CredentialInput, baseURL string) []Attribute

InferFromCredentials builds a catalogue of attributes by extracting claims from credentials and deduplicating by identifier. Claims with the same namespace+path produce a single Attribute with multiple UsedBy references.

type ClaimInput

type ClaimInput struct {
	Path        []string // claim path segments
	DisplayName string   // first non-empty display name (any locale)
	DisplayLang string   // locale of the display name
}

ClaimInput is the minimal claim information needed to infer an Attribute.

type CredentialInput

type CredentialInput struct {
	SchemaID string       // SchemaMeta UUID
	Org      string       // organization slug
	Slug     string       // credential slug
	Name     string       // credential display name
	VCT      string       // vct URI from VCTM (used to derive namespace)
	Claims   []ClaimInput // claims extracted from VCTM
}

CredentialInput is the minimal credential information needed for inference.

type DataService

type DataService struct {
	Country             string `json:"country"`
	NationalSubID       string `json:"nationalSubID,omitempty"`
	EndpointURL         string `json:"endpointURL"`
	EndpointDescription string `json:"endpointDescription,omitempty"`
}

DataService holds a TS11 §2.1 authentic source endpoint.

type LangValue

type LangValue struct {
	Value string `json:"value"`
	Lang  string `json:"lang"`
}

LangValue holds a language-tagged string value.

type SchemaDistribution

type SchemaDistribution struct {
	AccessURL string `json:"accessURL"`
	MediaType string `json:"mediaType"`
}

SchemaDistribution holds a TS11 §2.1 distribution reference.

Jump to

Keyboard shortcuts

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