a2aproject / a2aproject/a2a-go
[Task] Implement utilities for AgentCard signing
- Langage dominant
- Go
- Étoiles
- 460
- Forks
- 93
- Merge moyen
- 2 j 21 h
- PR mergées (30 j)
- 9
Description
Implement utilities for AgentCard signatures.
Signatures are described [in the spec](https://a2a-protocol.org/v0.3.0/specification/#555-agentinterface-object) and this Python [PR](https://github.com/a2aproject/a2a-python/pull/581) can serve as a reference.
1. Create a new package `a2acrypto`.
2. Make it export a verfifier.
```go
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 { ... }
```
3. Make it export a signer.
```go
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) { ... }
```
4. Make `a2aclient.Client` be configurable with `a2aclient.WithCardVerifier(*a2acrypto.Verifier)`. If set, the verifier should run when `GetAgentCard()` is called.
5. Make `agentcard.Resolver` have an `*a2acrypto.Verifier` field. If set, the verifier should be used in `Resolve()`.
6. Use the signer to implement an `a2asrv.NewSignedCardProducer` for wrapping a user-provided AgentCardProducer.
```go
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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Read the linked spec and Python PR to understand the signature scheme. Start by creating the new a2acrypto package and implementing the Verifier and Signer interfaces as described. Look at existing a2aclient.Client and agentcard.Resolver to see where to integrate the verifier. Write tests that generate signatures with the Python SDK and verify them with the Go implementation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- go
- Domaine
- backend-api-design
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100