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

Method DecryptingKey

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

Source from the content-addressed store, hash-verified

160}
161
162func (c *cache) DecryptingKey(ctx context.Context, id string) (interface{}, error) {
163 if !isEncryptionKeyFeature(c.feature) {
164 return nil, ErrInvalidFeature
165 }
166
167 seq, err := strconv.ParseInt(id, 10, 32)
168 if err != nil {
169 return nil, xerrors.Errorf("parse id: %w", err)
170 }
171
172 //nolint:gocritic // cache can only read crypto keys.
173 ctx = dbauthz.AsKeyReader(ctx)
174 _, secret, err := c.cryptoKey(ctx, int32(seq))
175 if err != nil {
176 return nil, xerrors.Errorf("crypto key: %w", err)
177 }
178 return secret, nil
179}
180
181func (c *cache) SigningKey(ctx context.Context) (string, interface{}, error) {
182 if !isSigningKeyFeature(c.feature) {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected