Stop processing when we hit bad encryption in mobile app (#88150)

* Stop processing when we hit bad encryption

* Accept webhook payload that is a list

* Rename functions because we import them

* Revert a debug thing

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
Paulus Schoutsen 2023-02-16 13:05:16 -05:00 committed by GitHub
parent 57738fbb8c
commit bc2b35765e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 38 deletions

View file

@ -92,7 +92,7 @@ def _decrypt_payload_helper(
return message
def _decrypt_payload(key: str | None, ciphertext: str) -> JsonValueType | None:
def decrypt_payload(key: str | None, ciphertext: str) -> JsonValueType | None:
"""Decrypt encrypted payload."""
def get_key_bytes(key: str, keylen: int) -> str:
@ -101,7 +101,7 @@ def _decrypt_payload(key: str | None, ciphertext: str) -> JsonValueType | None:
return _decrypt_payload_helper(key, ciphertext, get_key_bytes, HexEncoder)
def _decrypt_payload_legacy(key: str | None, ciphertext: str) -> JsonValueType | None:
def decrypt_payload_legacy(key: str | None, ciphertext: str) -> JsonValueType | None:
"""Decrypt encrypted payload."""
def get_key_bytes(key: str, keylen: int) -> bytes: