Documentation
¶
Overview ¶
Package crypto provides cryptographic utilities for CapiscIO.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCanonicalJSON ¶
CreateCanonicalJSON creates a canonical JSON representation of the Agent Card for signature verification. It removes the "signatures" field and ensures keys are sorted (which encoding/json does by default).
Types ¶
type DefaultJWKSFetcher ¶
type DefaultJWKSFetcher struct {
// contains filtered or unexported fields
}
DefaultJWKSFetcher is the default implementation of JWKSFetcher.
func NewDefaultJWKSFetcher ¶
func NewDefaultJWKSFetcher() *DefaultJWKSFetcher
NewDefaultJWKSFetcher creates a new fetcher with a default HTTP client and 1 hour cache TTL.
func (*DefaultJWKSFetcher) Fetch ¶
func (f *DefaultJWKSFetcher) Fetch(ctx context.Context, url string) (*jose.JSONWebKeySet, error)
Fetch retrieves the JWKS from the specified URL, using cache if available.
func (*DefaultJWKSFetcher) FlushCache ¶
func (f *DefaultJWKSFetcher) FlushCache()
FlushCache clears all cached JWKS entries.
func (*DefaultJWKSFetcher) SetTTL ¶
func (f *DefaultJWKSFetcher) SetTTL(ttl time.Duration)
SetTTL configures the cache time-to-live.
type JWKSFetcher ¶
JWKSFetcher handles fetching and caching of JSON Web Key Sets.
type SignatureResult ¶
type SignatureResult struct {
Index int
Valid bool
Algorithm string
KeyID string
Issuer string
JWKSUri string
Error string
}
SignatureResult holds the details of a single signature verification.
type SignatureVerificationResult ¶
type SignatureVerificationResult struct {
Valid bool
Signatures []SignatureResult
Summary VerificationSummary
}
SignatureVerificationResult contains the result of verifying all signatures.
type VerificationSummary ¶
VerificationSummary summarizes the results of all signature verifications.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier handles Agent Card signature verification.
func NewVerifier ¶
func NewVerifier() *Verifier
NewVerifier creates a new Verifier with the default JWKS fetcher.
func NewVerifierWithFetcher ¶
func NewVerifierWithFetcher(fetcher JWKSFetcher) *Verifier
NewVerifierWithFetcher creates a new Verifier with a custom JWKS fetcher.
func (*Verifier) VerifyAgentCardSignatures ¶
func (v *Verifier) VerifyAgentCardSignatures(ctx context.Context, card *agentcard.AgentCard) (*SignatureVerificationResult, error)
VerifyAgentCardSignatures verifies all signatures in an Agent Card.