MCPcopy Index your code
hub / github.com/coder/coder / cryptoKeys

Method cryptoKeys

coderd/cryptokeys/cache.go:347–356  ·  view source on GitHub ↗

cryptoKeys queries the control plane for the crypto keys. Outside of initialization, this should only be called by fetch.

(ctx context.Context)

Source from the content-addressed store, hash-verified

345// cryptoKeys queries the control plane for the crypto keys.
346// Outside of initialization, this should only be called by fetch.
347func (c *cache) cryptoKeys(ctx context.Context) (map[int32]codersdk.CryptoKey, error) {
348 c.logger.Debug(ctx, "fetching crypto keys")
349 keys, err := c.fetcher.Fetch(ctx, c.feature)
350 if err != nil {
351 return nil, xerrors.Errorf("fetch: %w", err)
352 }
353 cache := toKeyMap(keys, c.clock.Now())
354 c.logger.Debug(ctx, "crypto key fetch complete")
355 return cache, nil
356}
357
358func toKeyMap(keys []codersdk.CryptoKey, now time.Time) map[int32]codersdk.CryptoKey {
359 m := make(map[int32]codersdk.CryptoKey)

Callers 3

newCacheFunction · 0.95
cryptoKeyMethod · 0.95
refreshMethod · 0.95

Calls 3

toKeyMapFunction · 0.85
FetchMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected