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

Function FetchExpectedCAs

trust/trust.go:244–274  ·  view source on GitHub ↗
(ctx context.Context, anc *api.Session, org, realm string)

Source from the content-addressed store, hash-verified

242}
243
244func FetchExpectedCAs(ctx context.Context, anc *api.Session, org, realm string) ([]*truststore.CA, error) {
245 creds, err := anc.FetchCredentials(ctx, org, realm)
246 if err != nil {
247 return nil, err
248 }
249
250 var cas []*truststore.CA
251 for _, item := range creds {
252 blk, _ := pem.Decode([]byte(item.TextualEncoding))
253
254 cert, err := x509.ParseCertificate(blk.Bytes)
255 if err != nil {
256 return nil, err
257 }
258
259 uniqueName := cert.SerialNumber.Text(16)
260
261 ca := &truststore.CA{
262 Certificate: cert,
263 UniqueName: uniqueName,
264 }
265
266 // TODO: make this variable based on cli.Config
267 if ca.PublicKeyAlgorithm == x509.Ed25519 {
268 continue
269 }
270
271 cas = append(cas, ca)
272 }
273 return cas, nil
274}
275
276func FetchLocalDevCAs(ctx context.Context, anc *api.Session) ([]*truststore.CA, error) {
277 userInfo, err := anc.UserInfo(ctx)

Callers 8

systemConfigMethod · 0.92
performAuditMethod · 0.92
TestLclFunction · 0.92
PerformMethod · 0.85
performAuditMethod · 0.85
FetchLocalDevCAsFunction · 0.85
TestAuditFunction · 0.85
RunTUIMethod · 0.85

Calls 1

FetchCredentialsMethod · 0.80

Tested by 2

TestLclFunction · 0.74
TestAuditFunction · 0.68