Implement utilities for AgentCard signatures.
Signatures are described in the spec and this Python PR can serve as a reference.
- Create a new package
a2acrypto.
- Make it export a verfifier.
type KeyResolver interface {
ResolveKey(kid, jku string) (crypto.PublicKey, error)
}
type VerifierConfig struct {
KeyResolver KeyResolver
}
func NewVerifier(config VerifierConfig) *Verifier { ... }
func (v *Verifier) Verify(card *a2a.AgentCard, signature *a2a.AgentCardSignature) error { ... }
- Make it export a signer.
type SignerConfig struct {
PrivateKey crypto.Signer
KeyID string
Algorithm string
JWKSURL string
}
func NewSigner(config SignerConfig) *Signer { ... }
func (s *Signer) Sign(card *a2a.AgentCard) (*a2a.AgentCardSignature, error) { ... }
- Make
a2aclient.Client be configurable with a2aclient.WithCardVerifier(*a2acrypto.Verifier). If set, the verifier should run when GetAgentCard() is called.
- Make
agentcard.Resolver have an *a2acrypto.Verifier field. If set, the verifier should be used in Resolve().
- Use the signer to implement an
a2asrv.NewSignedCardProducer for wrapping a user-provided AgentCardProducer.
type signedAgentCardProducer struct {
wrapped AgentCardProducer
signer *a2asrv.Signer
}
func (p *signedAgentCardProducer) Card(ctx context.Context) (*a2a.AgentCard, error) { ... }
func NewSignedCardProducer(*a2acrypto.Signer, AgentCardProducer) AgentCardProducer { ... }
Add tests to verify the implementation. Can use Python or other SDK to generate an expected signature to compare against.
Implement utilities for AgentCard signatures.
Signatures are described in the spec and this Python PR can serve as a reference.
a2acrypto.a2aclient.Clientbe configurable witha2aclient.WithCardVerifier(*a2acrypto.Verifier). If set, the verifier should run whenGetAgentCard()is called.agentcard.Resolverhave an*a2acrypto.Verifierfield. If set, the verifier should be used inResolve().a2asrv.NewSignedCardProducerfor wrapping a user-provided AgentCardProducer.Add tests to verify the implementation. Can use Python or other SDK to generate an expected signature to compare against.