mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-16 04:29:31 +00:00
refactor(proxy): drop routine docstrings from encryption helpers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a6a968b9fb
commit
591b752b6d
2 changed files with 0 additions and 5 deletions
|
|
@ -68,13 +68,11 @@ def decrypted_or_stored(key: str, value: str) -> str | None:
|
|||
|
||||
|
||||
def decrypted_values(values: Mapping[str, str]) -> Mapping[str, str]:
|
||||
"""``values`` with every entry decrypted, plaintext entries kept, and unreadable legacy entries dropped."""
|
||||
resolved: Final = {key: decrypted_or_stored(key, value) for key, value in values.items()}
|
||||
return MappingProxyType({key: value for key, value in resolved.items() if value is not None})
|
||||
|
||||
|
||||
def _decrypted(db_credential: CredentialItem) -> CredentialItem:
|
||||
"""The stored credential with every value decrypted, leaving already-plaintext values alone."""
|
||||
return CredentialItem(
|
||||
credential_name=db_credential.credential_name,
|
||||
credential_values=decrypted_values(db_credential.credential_values), # pyright: ignore[reportArgumentType] # declared dict[str, str], and pydantic copies this mapping into one on validation; LIT002 rules out building that dict here
|
||||
|
|
|
|||
|
|
@ -270,9 +270,6 @@ def legacy_unreadable(value: object) -> bool:
|
|||
|
||||
|
||||
def decrypt_for_rewrite(value: str, key: str) -> str | None:
|
||||
"""Decrypt a value a config writer submitted for storage: ciphertext read back from the store or a first-write
|
||||
plaintext. Without PyNaCl an unprefixed value cannot be told apart from plaintext, so it is kept as submitted
|
||||
instead of being dropped."""
|
||||
if legacy_unreadable(value):
|
||||
return value
|
||||
return decrypt_value_helper(value=value, key=key, return_original_value=True)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue