@@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"context"
5
+ "encoding/base64"
5
6
"encoding/json"
6
7
"fmt"
7
8
"os"
@@ -164,8 +165,9 @@ func runUnauthorizeApp(ctx context.Context, opts unauthorizeOptions) error {
164
165
}
165
166
166
167
type addOptions struct {
167
- Name string
168
- Value string
168
+ Name string
169
+ Value string
170
+ Base64 bool
169
171
}
170
172
171
173
type deleteOptions struct {
@@ -187,6 +189,7 @@ func AddSecret(ctx context.Context) *cobra.Command {
187
189
_ = cmd .MarkFlagRequired ("name" )
188
190
flags .StringVarP (& opts .Value , "value" , "v" , "" , "Value of the secret" )
189
191
_ = cmd .MarkFlagRequired ("value" )
192
+ flags .BoolVar (& opts .Base64 , "base64" , false , "Is the value base64 encoded" )
190
193
return cmd
191
194
}
192
195
@@ -228,7 +231,17 @@ func runAddSecret(ctx context.Context, opts addOptions) error {
228
231
if err := assertMcpPolicyExists (ctx , c ); err != nil {
229
232
return err
230
233
}
231
- return c .SetSecret (ctx , secretsapi.Secret {Name : opts .Name , Value : opts .Value , Policies : []string {mcpPolicyName }})
234
+
235
+ value := opts .Value
236
+ if opts .Base64 {
237
+ decodedValue , err := base64 .StdEncoding .DecodeString (value )
238
+ if err != nil {
239
+ return fmt .Errorf ("failed to decode base64 value: %w" , err )
240
+ }
241
+ value = string (decodedValue )
242
+ }
243
+
244
+ return c .SetSecret (ctx , secretsapi.Secret {Name : opts .Name , Value : value , Policies : []string {mcpPolicyName }})
232
245
}
233
246
234
247
func runListSecrets (ctx context.Context ) error {
0 commit comments