Skip to content

Commit 05bd9d7

Browse files
committed
feat: Add signatures to AgentCard for gRPC as per v0.3.0
1 parent d5fddc6 commit 05bd9d7

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
@@ -18,6 +18,7 @@
1818
import io.a2a.spec.APIKeySecurityScheme;
1919
import io.a2a.spec.AgentCapabilities;
2020
import io.a2a.spec.AgentCard;
21+
import io.a2a.spec.AgentCardSignature;
2122
import io.a2a.spec.AgentExtension;
2223
import io.a2a.spec.AgentInterface;
2324
import io.a2a.spec.AgentProvider;
@@ -124,6 +125,9 @@ public static io.a2a.grpc.AgentCard agentCard(AgentCard agentCard) {
124125
builder.addAllSkills(agentCard.skills().stream().map(ToProto::agentSkill).collect(Collectors.toList()));
125126
}
126127
builder.setSupportsAuthenticatedExtendedCard(agentCard.supportsAuthenticatedExtendedCard());
128+
if (agentCard.signatures() != null) {
129+
builder.addAllSignatures(agentCard.signatures().stream().map(ToProto::agentCardSignature).collect(Collectors.toList()));
130+
}
127131
return builder.build();
128132
}
129133

@@ -398,6 +402,16 @@ private static io.a2a.grpc.AgentSkill agentSkill(AgentSkill agentSkill) {
398402
return builder.build();
399403
}
400404

405+
private static io.a2a.grpc.AgentCardSignature agentCardSignature(AgentCardSignature agentCardSignature) {
406+
io.a2a.grpc.AgentCardSignature.Builder builder = io.a2a.grpc.AgentCardSignature.newBuilder();
407+
builder.setProtected(agentCardSignature.protectedHeader());
408+
builder.setSignature(agentCardSignature.signature());
409+
if (agentCardSignature.header() != null) {
410+
builder.setHeader(struct(agentCardSignature.header()));
411+
}
412+
return builder.build();
413+
}
414+
401415
private static io.a2a.grpc.SecurityScheme securityScheme(SecurityScheme securityScheme) {
402416
io.a2a.grpc.SecurityScheme.Builder builder = io.a2a.grpc.SecurityScheme.newBuilder();
403417
if (securityScheme instanceof APIKeySecurityScheme) {

0 commit comments

Comments
 (0)