Skip to content

Commit b11bde9

Browse files
committed
feat: Add signatures to AgentCard for gRPC as per v0.3.0
1 parent 92f1530 commit b11bde9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

spec-grpc/src/main/java/io/a2a/grpc/utils/ProtoUtils.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import io.a2a.spec.APIKeySecurityScheme;
1818
import io.a2a.spec.AgentCapabilities;
1919
import io.a2a.spec.AgentCard;
20+
import io.a2a.spec.AgentCardSignature;
2021
import io.a2a.spec.AgentExtension;
2122
import io.a2a.spec.AgentInterface;
2223
import io.a2a.spec.AgentProvider;
@@ -122,6 +123,9 @@ public static io.a2a.grpc.AgentCard agentCard(AgentCard agentCard) {
122123
builder.addAllSkills(agentCard.skills().stream().map(ToProto::agentSkill).collect(Collectors.toList()));
123124
}
124125
builder.setSupportsAuthenticatedExtendedCard(agentCard.supportsAuthenticatedExtendedCard());
126+
if (agentCard.signatures() != null) {
127+
builder.addAllSignatures(agentCard.signatures().stream().map(ToProto::agentCardSignature).collect(Collectors.toList()));
128+
}
125129
return builder.build();
126130
}
127131

@@ -377,6 +381,16 @@ private static io.a2a.grpc.AgentSkill agentSkill(AgentSkill agentSkill) {
377381
return builder.build();
378382
}
379383

384+
private static io.a2a.grpc.AgentCardSignature agentCardSignature(AgentCardSignature agentCardSignature) {
385+
io.a2a.grpc.AgentCardSignature.Builder builder = io.a2a.grpc.AgentCardSignature.newBuilder();
386+
builder.setProtected(agentCardSignature.protectedHeader());
387+
builder.setSignature(agentCardSignature.signature());
388+
if (agentCardSignature.header() != null) {
389+
builder.setHeader(struct(agentCardSignature.header()));
390+
}
391+
return builder.build();
392+
}
393+
380394
private static io.a2a.grpc.SecurityScheme securityScheme(SecurityScheme securityScheme) {
381395
io.a2a.grpc.SecurityScheme.Builder builder = io.a2a.grpc.SecurityScheme.newBuilder();
382396
if (securityScheme instanceof APIKeySecurityScheme) {

0 commit comments

Comments
 (0)