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

Method VerifyingKey

coderd/cryptokeys/cache.go:191–208  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

189}
190
191func (c *cache) VerifyingKey(ctx context.Context, id string) (interface{}, error) {
192 if !isSigningKeyFeature(c.feature) {
193 return nil, ErrInvalidFeature
194 }
195
196 seq, err := strconv.ParseInt(id, 10, 32)
197 if err != nil {
198 return nil, xerrors.Errorf("parse id: %w", err)
199 }
200 //nolint:gocritic // cache can only read crypto keys.
201 ctx = dbauthz.AsKeyReader(ctx)
202 _, secret, err := c.cryptoKey(ctx, int32(seq))
203 if err != nil {
204 return nil, xerrors.Errorf("crypto key: %w", err)
205 }
206
207 return secret, nil
208}
209
210func isEncryptionKeyFeature(feature codersdk.CryptoKeyFeature) bool {
211 return feature == codersdk.CryptoKeyFeatureWorkspaceAppsAPIKey

Callers

nothing calls this directly

Calls 4

cryptoKeyMethod · 0.95
AsKeyReaderFunction · 0.92
isSigningKeyFeatureFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected