Help us shape the future of Go! Take the 2026 Go Developer Survey

attribution

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package attribution transports bounded trusted identity and runtime correlation. Value, Policy, NewPolicy, Policy.Validate, WithContext, FromContext, WithCorrelation, Producer and Error are designated protected surfaces. This package performs no authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, v Value, p Policy) (context.Context, error)

func WithCorrelation

func WithCorrelation(ctx context.Context, core Value) (context.Context, error)

WithCorrelation replaces runtime-owned correlation while preserving trusted subject/tenant and attributes. It uses the policy stored by WithContext.

Types

type Error

type Error struct{ Field string }

func (*Error) Error

func (e *Error) Error() string

type Policy

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

func NewPolicy

func NewPolicy(modules, keys []string) (Policy, error)

NewPolicy requires exact attribute keys owned by an explicitly linked module.

func (Policy) Validate

func (p Policy) Validate(v Value) error

type Producer

type Producer func(context.Context) (Value, error)

Producer is explicitly injected by a trusted distribution, never chosen by a header. It may establish subject/tenant and allowlisted attributes; core correlation wins.

type Value

type Value struct {
	Subject      string            `json:"subject,omitempty"`
	Tenant       string            `json:"tenant,omitempty"`
	RouteID      string            `json:"route_id,omitempty"`
	AgentID      string            `json:"agent_id,omitempty"`
	RunID        string            `json:"run_id,omitempty"`
	VirtualKeyID string            `json:"virtual_key_id,omitempty"`
	TraceID      string            `json:"trace_id,omitempty"`
	SpanID       string            `json:"span_id,omitempty"`
	ParentSpanID string            `json:"parent_span_id,omitempty"`
	Attributes   map[string]string `json:"attributes,omitempty"`
}

func FromContext

func FromContext(ctx context.Context) (Value, bool)

Jump to

Keyboard shortcuts

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