feat: filter response fields for /api/v1/payments/decode (#2612)
* feat: filter response fields * chore: `make format` * chore: comment * Update lnbits/helpers.py Co-authored-by: Pavol Rusnak <pavol@rusnak.io> * Update lnbits/helpers.py Co-authored-by: Pavol Rusnak <pavol@rusnak.io> * chore: code format --------- Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
This commit is contained in:
co-authored by
Pavol Rusnak
parent
94caa2e1ba
commit
80e7b9639d
@@ -223,3 +223,10 @@ def decrypt_internal_message(m: Optional[str] = None) -> Optional[str]:
|
||||
if not m:
|
||||
return None
|
||||
return AESCipher(key=settings.auth_secret_key).decrypt(m)
|
||||
|
||||
|
||||
def filter_dict_keys(data: dict, filter_keys: Optional[list[str]]) -> dict:
|
||||
if not filter_keys:
|
||||
# return shallow clone of the dict even if there are no filters
|
||||
return {**data}
|
||||
return {key: data[key] for key in filter_keys if key in data}
|
||||
|
||||
Reference in New Issue
Block a user