a2a

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ExtensionURI = "https://git-a2a.com/ext/module/v1"

Variables

This section is empty.

Functions

func CanonicalPayload

func CanonicalPayload(card map[string]any) ([]byte, error)

CanonicalPayload returns the RFC 8785 JSON representation signed by A2A.

func CheckOrigins added in v1.3.0

func CheckOrigins(raw []byte, cardURL, repository, canonicalGit string, declared []string) error

CheckOrigins binds card discovery and interface URLs to the module repository or to explicit owner-declared origins.

func Export

func Export(base map[string]any, binding Binding) (map[string]any, error)

func FileName

func FileName(name string) string

func JWKThumbprint added in v1.3.0

func JWKThumbprint(jwk map[string]any) (string, error)

JWKThumbprint returns the RFC 7638 SHA-256 thumbprint for a public JWK.

func Marshal

func Marshal(card map[string]any) ([]byte, error)

func Parse

func Parse(b []byte) (map[string]any, error)

func Read

func Read(location, base string) (map[string]any, []byte, error)

func Snapshot

func Snapshot(m *manifest.Manifest, dir string, readPath PathReader) (map[string]string, []error)

func Validate

func Validate(card map[string]any) error

Types

type Binding

type Binding struct {
	Module, Repository, Ref string
	Agent                   manifest.Agent
	ModuleDescription       string
}

type Capabilities

type Capabilities struct {
	Streaming         *bool       `json:"streaming,omitempty"`
	PushNotifications *bool       `json:"pushNotifications,omitempty"`
	Extensions        []Extension `json:"extensions,omitempty"`
	ExtendedAgentCard *bool       `json:"extendedAgentCard,omitempty"`
}

type Card

type Card struct {
	Name                 string                `json:"name"`
	Description          string                `json:"description"`
	SupportedInterfaces  []Interface           `json:"supportedInterfaces"`
	Provider             *Provider             `json:"provider,omitempty"`
	Version              string                `json:"version"`
	DocumentationURL     string                `json:"documentationUrl,omitempty"`
	Capabilities         Capabilities          `json:"capabilities"`
	SecuritySchemes      map[string]any        `json:"securitySchemes,omitempty"`
	SecurityRequirements []SecurityRequirement `json:"securityRequirements,omitempty"`
	DefaultInputModes    []string              `json:"defaultInputModes"`
	DefaultOutputModes   []string              `json:"defaultOutputModes"`
	Skills               []Skill               `json:"skills"`
	Signatures           []Signature           `json:"signatures,omitempty"`
	IconURL              string                `json:"iconUrl,omitempty"`
}

type Extension

type Extension struct {
	URI         string         `json:"uri"`
	Description string         `json:"description,omitempty"`
	Required    bool           `json:"required"`
	Params      map[string]any `json:"params,omitempty"`
}

type Interface

type Interface struct {
	URL             string `json:"url"`
	ProtocolBinding string `json:"protocolBinding"`
	Tenant          string `json:"tenant,omitempty"`
	ProtocolVersion string `json:"protocolVersion"`
}

type LocationError

type LocationError struct {
	Location string
	Err      error
}

LocationError reports that a card location could not be retrieved. It is distinct from errors returned while parsing or validating retrieved bytes.

func (*LocationError) Error

func (e *LocationError) Error() string

func (*LocationError) Unwrap

func (e *LocationError) Unwrap() error

type PathReader

type PathReader func(path string) ([]byte, error)

type Provider

type Provider struct {
	URL          string `json:"url"`
	Organization string `json:"organization"`
}

type SecurityRequirement

type SecurityRequirement struct {
	Schemes map[string]StringList `json:"schemes"`
}

type Signature

type Signature struct {
	Protected string         `json:"protected"`
	Signature string         `json:"signature"`
	Header    map[string]any `json:"header,omitempty"`
}

type Skill

type Skill struct {
	ID                   string                `json:"id"`
	Name                 string                `json:"name"`
	Description          string                `json:"description"`
	Tags                 []string              `json:"tags"`
	Examples             []string              `json:"examples,omitempty"`
	InputModes           []string              `json:"inputModes,omitempty"`
	OutputModes          []string              `json:"outputModes,omitempty"`
	SecurityRequirements []SecurityRequirement `json:"securityRequirements,omitempty"`
}

type StringList

type StringList struct {
	List []string `json:"list"`
}

type Verification

type Verification struct {
	KeyID       string
	Algorithm   string
	JWKS        string
	Thumbprint  string
	CacheAge    time.Duration
	UnpinnedKey bool
}

func VerifySignatures

func VerifySignatures(raw []byte, options VerifyOptions) (Verification, error)

VerifySignatures verifies at least one detached JWS signature over the RFC 8785 canonical Agent Card payload. The signatures property is not signed.

type VerifyOptions

type VerifyOptions struct {
	CacheRoot  string
	Client     *http.Client
	Offline    bool
	CardURL    string
	PinnedJWKS []string
	PinnedKeys []string
	MaxAge     time.Duration
}

Jump to

Keyboard shortcuts

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