configuration

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSecrets

func LoadSecrets(path string) (*model.Secrets, error)

LoadSecrets reads and parses the secrets YAML file.

func New

func New(ctx context.Context, serviceName string) (*model.Cfg, error)

New parses config file from VC_CONFIG_YAML environment variable. serviceName identifies the calling service so that steps like VCTM loading can be skipped for services that do not use credential constructors (e.g. ui, mockas, registry).

Types

type ClaimTransform

type ClaimTransform struct {
	// Type of transformation (e.g., "date_format", "uppercase", "concat")
	Type string `yaml:"type" json:"type" validate:"required"`

	// Parameters for the transformation (type-specific)
	Params map[string]string `yaml:"params,omitempty" json:"params,omitempty"`
}

ClaimTransform defines how to transform a claim value

type PresentationRequestConfig

type PresentationRequestConfig struct {
	// Templates is a list of all available presentation request templates
	Templates []*PresentationRequestTemplate `yaml:"templates" json:"templates" validate:"required,dive"`

	// DefaultTemplate is the ID of the template to use when no scope matches
	DefaultTemplate string `yaml:"default_template,omitempty" json:"default_template,omitempty"`
}

PresentationRequestConfig holds all presentation request templates

func LoadPresentationRequests

func LoadPresentationRequests(ctx context.Context, dirPath string) (*PresentationRequestConfig, error)

LoadPresentationRequests loads presentation request templates from a directory It reads all YAML files in the directory and merges them into a single config

func LoadPresentationRequestsFromFile

func LoadPresentationRequestsFromFile(ctx context.Context, filePath string) (*PresentationRequestConfig, error)

LoadPresentationRequestsFromFile loads presentation request config from a single file

func (*PresentationRequestConfig) GetEnabledTemplates

func (c *PresentationRequestConfig) GetEnabledTemplates() []*PresentationRequestTemplate

GetEnabledTemplates returns only the enabled templates as a generic slice This is used when creating a PresentationBuilder

func (*PresentationRequestConfig) GetTemplateByID

GetTemplateByID returns a template by its ID

func (*PresentationRequestConfig) GetTemplateByScope

func (c *PresentationRequestConfig) GetTemplateByScope(scope string) (*PresentationRequestTemplate, error)

GetTemplateByScope returns the template that handles the given OIDC scope

func (*PresentationRequestConfig) GetTemplateByScopes

func (c *PresentationRequestConfig) GetTemplateByScopes(scopes []string) (*PresentationRequestTemplate, error)

GetTemplateByScopes returns the template that handles the given OIDC scopes If multiple templates match, returns the first enabled one

func (*PresentationRequestConfig) ListEnabledTemplates

func (c *PresentationRequestConfig) ListEnabledTemplates() []*PresentationRequestTemplate

ListEnabledTemplates returns all enabled templates

type PresentationRequestTemplate

type PresentationRequestTemplate struct {
	// ID uniquely identifies this template
	ID string `yaml:"id" json:"id" validate:"required"`

	// Name is a human-readable name for this template
	Name string `yaml:"name" json:"name" validate:"required"`

	// Description explains the purpose of this presentation request
	Description string `yaml:"description" json:"description"`

	// Version of this template (for tracking changes)
	Version string `yaml:"version" json:"version"`

	// OIDCScopes that trigger this presentation request
	// When an RP requests these scopes, this template is used
	OIDCScopes []string `yaml:"oidc_scopes" json:"oidc_scopes" validate:"required,min=1"`

	// DCQLQuery is the Digital Credentials Query Language query
	// This defines what credentials and claims to request from the wallet
	DCQLQuery *openid4vp.DCQL `yaml:"dcql" json:"dcql" validate:"required"`

	// ClaimMappings maps VP claim paths to OIDC claim names
	// Key: VP claim path (e.g., "given_name" or "place_of_birth.country")
	// Value: OIDC claim name (e.g., "given_name" or "birth_country")
	// Special value "*" means map all claims through unchanged
	ClaimMappings map[string]string `yaml:"claim_mappings" json:"claim_mappings" validate:"required"`

	// ClaimTransforms defines optional transformations for claims
	ClaimTransforms map[string]ClaimTransform `yaml:"claim_transforms,omitempty" json:"claim_transforms,omitempty"`

	// Enabled indicates whether this template is active
	Enabled bool `yaml:"enabled" json:"enabled"`
}

PresentationRequestTemplate defines a configurable presentation request that maps OIDC scopes to DCQL queries and VP claims to OIDC claims

func (*PresentationRequestTemplate) GetClaimMappings

func (t *PresentationRequestTemplate) GetClaimMappings() map[string]string

GetClaimMappings returns the claim mappings (for claims extraction)

func (*PresentationRequestTemplate) GetClaimTransforms

func (t *PresentationRequestTemplate) GetClaimTransforms() map[string]ClaimTransform

GetClaimTransforms returns the claim transforms (for claims extraction)

func (*PresentationRequestTemplate) GetDCQLQuery

func (t *PresentationRequestTemplate) GetDCQLQuery() *openid4vp.DCQL

GetDCQLQuery returns the DCQL query (implements openid4vp.PresentationRequestTemplate)

func (*PresentationRequestTemplate) GetID

GetID returns the template ID (implements openid4vp.PresentationRequestTemplate)

func (*PresentationRequestTemplate) GetOIDCScopes

func (t *PresentationRequestTemplate) GetOIDCScopes() []string

GetOIDCScopes returns the OIDC scopes (implements openid4vp.PresentationRequestTemplate)

Jump to

Keyboard shortcuts

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