@@ -18,7 +18,7 @@ import (
1818 pb "github.com/CryptoLabInc/rune-admin/vault/pkg/vaultpb"
1919)
2020
21- // MaxMessageSize bounds gRPC frames. EvalKey alone can be tens of MB.
21+ // MaxMessageSize bounds gRPC frames.
2222const MaxMessageSize = 256 * 1024 * 1024
2323
2424// Vault is the runtime container shared by all RPC handlers and the
@@ -79,9 +79,9 @@ type VaultGRPC struct {
7979
8080func NewVaultGRPC (v * Vault ) * VaultGRPC { return & VaultGRPC {v : v } }
8181
82- // ── GetPublicKey ───── ─────────────────────────────────────────────
82+ // ── GetAgentManifest ─────────────────────────────────────────────
8383
84- func (s * VaultGRPC ) GetPublicKey (ctx context.Context , req * pb.GetPublicKeyRequest ) (* pb.GetPublicKeyResponse , error ) {
84+ func (s * VaultGRPC ) GetAgentManifest (ctx context.Context , req * pb.GetAgentManifestRequest ) (* pb.GetAgentManifestResponse , error ) {
8585 start := time .Now ()
8686 user := s .v .tokens .GetUsername (req .GetToken ())
8787 if user == "" {
@@ -91,52 +91,51 @@ func (s *VaultGRPC) GetPublicKey(ctx context.Context, req *pb.GetPublicKeyReques
9191 statusStr := "success"
9292 var errDetail * string
9393 defer func () {
94- s .emit (ctx , "get_public_key " , user , nil , resultCount , statusStr , errDetail , time .Since (start ))
94+ s .emit (ctx , "get_agent_manifest " , user , nil , resultCount , statusStr , errDetail , time .Since (start ))
9595 }()
9696
9797 username , role , err := s .v .tokens .Validate (req .GetToken ())
9898 if err != nil {
9999 st , msg := mapTokenError (err )
100100 statusStr , errDetail = errStatus (err )
101- return & pb.GetPublicKeyResponse {Error : msg }, status .Error (st , msg )
101+ return & pb.GetAgentManifestResponse {Error : msg }, status .Error (st , msg )
102102 }
103103 user = username
104104 if err := role .CheckScope ("get_public_key" ); err != nil {
105105 statusStr = "denied"
106106 ed := err .Error ()
107107 errDetail = & ed
108- return & pb.GetPublicKeyResponse {Error : err .Error ()}, status .Error (codes .PermissionDenied , err .Error ())
108+ return & pb.GetAgentManifestResponse {Error : err .Error ()}, status .Error (codes .PermissionDenied , err .Error ())
109109 }
110110
111111 bundle , err := s .v .buildBundle (req .GetToken ())
112112 if err != nil {
113113 statusStr = "error"
114114 ed := err .Error ()
115115 errDetail = & ed
116- return & pb.GetPublicKeyResponse {Error : err .Error ()}, status .Error (codes .Internal , err .Error ())
116+ return & pb.GetAgentManifestResponse {Error : err .Error ()}, status .Error (codes .Internal , err .Error ())
117117 }
118118 js , err := json .Marshal (bundle )
119119 if err != nil {
120120 statusStr = "error"
121121 ed := err .Error ()
122122 errDetail = & ed
123- return & pb.GetPublicKeyResponse {Error : err .Error ()}, status .Error (codes .Internal , err .Error ())
123+ return & pb.GetAgentManifestResponse {Error : err .Error ()}, status .Error (codes .Internal , err .Error ())
124124 }
125125 resultCount = 1
126- return & pb.GetPublicKeyResponse { KeyBundleJson : string (js )}, nil
126+ return & pb.GetAgentManifestResponse { ManifestJson : string (js )}, nil
127127}
128128
129- // buildBundle assembles the per-token JSON bundle returned by GetPublicKey .
129+ // buildBundle assembles the per-token JSON manifest returned by GetAgentManifest .
130130// Order of keys is irrelevant — clients parse by name.
131131func (s * Vault ) buildBundle (token string ) (map [string ]any , error ) {
132- pub , err := crypto .ReadPublicKeyBundle (s .bundleParams )
132+ encKey , err := crypto .ReadEncKey (s .bundleParams )
133133 if err != nil {
134134 return nil , err
135135 }
136136 bundle := map [string ]any {
137- "EncKey.json" : pub .EncKey ,
138- "EvalKey.json" : pub .EvalKey ,
139- "key_id" : s .bundleParams .KeyID ,
137+ "EncKey.json" : encKey ,
138+ "key_id" : s .bundleParams .KeyID ,
140139 }
141140 if s .cfg .Keys .IndexName != "" {
142141 bundle ["index_name" ] = s .cfg .Keys .IndexName
0 commit comments