@@ -116,7 +116,9 @@ func createKeyCmd(args []string) {
116116 ctx , cancel := signal .NotifyContext (context .Background (), os .Interrupt , os .Kill )
117117 defer cancel ()
118118
119- client := newClient (insecureSkipVerify )
119+ client := newClient (config {
120+ InsecureSkipVerify : insecureSkipVerify ,
121+ })
120122 for _ , name := range cmd .Args () {
121123 if err := client .CreateKey (ctx , name ); err != nil {
122124 if errors .Is (err , context .Canceled ) {
@@ -169,7 +171,9 @@ func importKeyCmd(args []string) {
169171 ctx , cancel := signal .NotifyContext (context .Background (), os .Interrupt , os .Kill )
170172 defer cancel ()
171173
172- enclave := newClient (insecureSkipVerify )
174+ enclave := newClient (config {
175+ InsecureSkipVerify : insecureSkipVerify ,
176+ })
173177 if err = enclave .ImportKey (ctx , name , & kes.ImportKeyRequest {Key : key }); err != nil {
174178 if errors .Is (err , context .Canceled ) {
175179 os .Exit (1 )
@@ -229,7 +233,9 @@ func describeKeyCmd(args []string) {
229233 defer cancelCtx ()
230234
231235 name := cmd .Arg (0 )
232- client := newClient (insecureSkipVerify )
236+ client := newClient (config {
237+ InsecureSkipVerify : insecureSkipVerify ,
238+ })
233239 info , err := client .DescribeKey (ctx , name )
234240 if err != nil {
235241 if errors .Is (err , context .Canceled ) {
@@ -308,7 +314,9 @@ func lsKeyCmd(args []string) {
308314 ctx , cancelCtx := signal .NotifyContext (context .Background (), os .Interrupt , os .Kill )
309315 defer cancelCtx ()
310316
311- enclave := newClient (insecureSkipVerify )
317+ enclave := newClient (config {
318+ InsecureSkipVerify : insecureSkipVerify ,
319+ })
312320 iter := & kes.ListIter [string ]{
313321 NextFunc : enclave .ListKeys ,
314322 }
@@ -380,7 +388,9 @@ func rmKeyCmd(args []string) {
380388 ctx , cancelCtx := signal .NotifyContext (context .Background (), os .Interrupt , os .Kill )
381389 defer cancelCtx ()
382390
383- client := newClient (insecureSkipVerify )
391+ client := newClient (config {
392+ InsecureSkipVerify : insecureSkipVerify ,
393+ })
384394 for _ , name := range cmd .Args () {
385395 if err := client .DeleteKey (ctx , name ); err != nil {
386396 if errors .Is (err , context .Canceled ) {
@@ -436,7 +446,9 @@ func encryptKeyCmd(args []string) {
436446 ctx , cancel := signal .NotifyContext (context .Background (), os .Interrupt , os .Kill )
437447 defer cancel ()
438448
439- client := newClient (insecureSkipVerify )
449+ client := newClient (config {
450+ InsecureSkipVerify : insecureSkipVerify ,
451+ })
440452 ciphertext , err := client .Encrypt (ctx , name , []byte (message ), nil )
441453 if err != nil {
442454 if errors .Is (err , context .Canceled ) {
@@ -445,7 +457,7 @@ func encryptKeyCmd(args []string) {
445457 cli .Fatalf ("failed to encrypt message: %v" , err )
446458 }
447459
448- if isTerm ( os . Stdout ) {
460+ if cli . IsTerminal ( ) {
449461 fmt .Printf ("\n ciphertext: %s\n " , base64 .StdEncoding .EncodeToString (ciphertext ))
450462 } else {
451463 fmt .Printf (`{"ciphertext":"%s"}` , base64 .StdEncoding .EncodeToString (ciphertext ))
@@ -509,7 +521,9 @@ func decryptKeyCmd(args []string) {
509521 ctx , cancel := signal .NotifyContext (context .Background (), os .Interrupt , os .Kill )
510522 defer cancel ()
511523
512- client := newClient (insecureSkipVerify )
524+ client := newClient (config {
525+ InsecureSkipVerify : insecureSkipVerify ,
526+ })
513527 plaintext , err := client .Decrypt (ctx , name , ciphertext , associatedData )
514528 if err != nil {
515529 if errors .Is (err , context .Canceled ) {
@@ -518,7 +532,7 @@ func decryptKeyCmd(args []string) {
518532 cli .Fatalf ("failed to decrypt ciphertext: %v" , err )
519533 }
520534
521- if isTerm ( os . Stdout ) {
535+ if cli . IsTerminal ( ) {
522536 fmt .Printf ("\n plaintext: %s\n " , base64 .StdEncoding .EncodeToString (plaintext ))
523537 } else {
524538 fmt .Printf (`{"plaintext":"%s"}` , base64 .StdEncoding .EncodeToString (plaintext ))
@@ -575,7 +589,9 @@ func dekCmd(args []string) {
575589 ctx , cancelCtx := signal .NotifyContext (context .Background (), os .Interrupt , os .Kill )
576590 defer cancelCtx ()
577591
578- client := newClient (insecureSkipVerify )
592+ client := newClient (config {
593+ InsecureSkipVerify : insecureSkipVerify ,
594+ })
579595 key , err := client .GenerateKey (ctx , name , associatedData )
580596 if err != nil {
581597 if errors .Is (err , context .Canceled ) {
@@ -588,7 +604,7 @@ func dekCmd(args []string) {
588604 plaintext = base64 .StdEncoding .EncodeToString (key .Plaintext )
589605 ciphertext = base64 .StdEncoding .EncodeToString (key .Ciphertext )
590606 )
591- if isTerm ( os . Stdout ) {
607+ if cli . IsTerminal ( ) {
592608 const format = "\n plaintext: %s\n ciphertext: %s\n "
593609 fmt .Printf (format , plaintext , ciphertext )
594610 } else {
0 commit comments