cryptoKeys queries the control plane for the crypto keys. Outside of initialization, this should only be called by fetch.
(ctx context.Context)
| 345 | // cryptoKeys queries the control plane for the crypto keys. |
| 346 | // Outside of initialization, this should only be called by fetch. |
| 347 | func (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 | |
| 358 | func toKeyMap(keys []codersdk.CryptoKey, now time.Time) map[int32]codersdk.CryptoKey { |
| 359 | m := make(map[int32]codersdk.CryptoKey) |