File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 99 validate_provider_credentials ,
1010 get_supported_providers ,
1111)
12- from app .core .security import encrypt_api_key
12+ from app .core .security import encrypt_api_key , decrypt_api_key
1313
1414
1515def set_creds_for_org (* , session : Session , creds_add : CredsCreate ) -> List [Credential ]:
@@ -88,7 +88,17 @@ def get_provider_credential(
8888 )
8989 creds = session .exec (statement ).first ()
9090
91- return creds .credential if creds else None
91+ if creds and creds .credential :
92+ # Decrypt api_key if present
93+ if "api_key" in creds .credential :
94+ try :
95+ creds .credential ["api_key" ] = decrypt_api_key (
96+ creds .credential ["api_key" ]
97+ )
98+ except Exception as e :
99+ raise ValueError (f"Failed to decrypt API key: { str (e )} " )
100+ return creds .credential
101+ return None
92102
93103
94104def get_providers (* , session : Session , org_id : int ) -> List [str ]:
You can’t perform that action at this time.
0 commit comments