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

Method GetAIProviderKeys

enterprise/dbcrypt/dbcrypt.go:559–570  ·  view source on GitHub ↗

GetAIProviderKeys returns AI provider key rows with their api_key decrypted. The list handler relies on the default scope (live providers only); the dbcrypt key rotation utility calls with includeDeleted=TRUE so it can walk every row holding a foreign-key reference to dbcrypt_keys before old keys ar

(ctx context.Context, includeDeleted bool)

Source from the content-addressed store, hash-verified

557// includeDeleted=TRUE so it can walk every row holding a foreign-key
558// reference to dbcrypt_keys before old keys are revoked.
559func (db *dbCrypt) GetAIProviderKeys(ctx context.Context, includeDeleted bool) ([]database.AIProviderKey, error) {
560 keys, err := db.Store.GetAIProviderKeys(ctx, includeDeleted)
561 if err != nil {
562 return nil, err
563 }
564 for i := range keys {
565 if err := db.decryptAIProviderKey(&keys[i]); err != nil {
566 return nil, err
567 }
568 }
569 return keys, nil
570}
571
572// UpdateEncryptedAIProviderKey re-encrypts the api_key column of a
573// key row, so that dbcrypt key rotation can move every FK reference

Callers

nothing calls this directly

Calls 2

decryptAIProviderKeyMethod · 0.95
GetAIProviderKeysMethod · 0.65

Tested by

no test coverage detected