MCPcopy
hub / github.com/smallstep/cli / WithRootCA

Function WithRootCA

token/options.go:45–55  ·  view source on GitHub ↗

WithRootCA returns an Options function that calculates the SHA256 of the given root certificate to be used in the token claims. If this method it's not used the default root certificate in the $STEPPATH secrets directory will be used.

(path string)

Source from the content-addressed store, hash-verified

43// not used the default root certificate in the $STEPPATH secrets directory will
44// be used.
45func WithRootCA(path string) Options {
46 return func(c *Claims) error {
47 cert, err := pemutil.ReadCertificate(path)
48 if err != nil {
49 return err
50 }
51 sum := sha256.Sum256(cert.Raw)
52 c.Set(RootSHAClaim, hex.EncodeToString(sum[:]))
53 return nil
54 }
55}
56
57// WithSHA returns an Options function that sets the SHA claim to the given
58// value.

Callers 2

TokenMethod · 0.92
TestOptionsFunction · 0.85

Calls 1

SetMethod · 0.80

Tested by 1

TestOptionsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…