MCPcopy Create free account
hub / github.com/anchordotdev/cli / writeCAFile

Function writeCAFile

trust/trust.go:398–420  ·  view source on GitHub ↗
(ca *truststore.CA, dir string)

Source from the content-addressed store, hash-verified

396}
397
398func writeCAFile(ca *truststore.CA, dir string) error {
399 fileName := filepath.Join(ca.UniqueName + ".pem")
400 file, err := os.Create(filepath.Join(dir, fileName))
401 if err != nil {
402 return err
403 }
404 defer file.Close()
405
406 blk := &pem.Block{
407 Type: "CERTIFICATE",
408 Bytes: ca.Raw,
409 }
410
411 if err := pem.Encode(file, blk); err != nil {
412 return err
413 }
414 if err := file.Close(); err != nil {
415 return err
416 }
417
418 ca.FilePath = file.Name()
419 return nil
420}
421
422type SudoManager struct {
423 truststore.CmdFS

Callers 2

PerformMethod · 0.85
PerformMethod · 0.85

Calls 3

EncodeMethod · 0.80
NameMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected