Functions | |
| bytes | _convert_legacy_encryption_key (str key) |
| JsonValueType|None | _decrypt_payload_helper (str|bytes key, bytes ciphertext, bytes key_bytes, type[RawEncoder|HexEncoder] key_encoder) |
| JsonValueType|None | decrypt_payload (str key, bytes ciphertext) |
| JsonValueType|None | decrypt_payload_legacy (str key, bytes ciphertext) |
| DeviceInfo | device_info (dict registration) |
| Response | empty_okay_response (dict|None headers=None, HTTPStatus status=HTTPStatus.OK) |
| Response | error_response (str code, str message, HTTPStatus status=HTTPStatus.BAD_REQUEST, dict|None headers=None) |
| Context | registration_context (Mapping[str, Any] registration) |
| dict | safe_registration (dict registration) |
| dict | savable_state (HomeAssistant hass) |
| Callable[[bytes, bytes], bytes] | setup_decrypt (type[RawEncoder|HexEncoder] key_encoder) |
| Callable[[bytes, bytes], bytes] | setup_encrypt (type[RawEncoder|HexEncoder] key_encoder) |
| Response | webhook_response (Any data, *Mapping[str, Any] registration, HTTPStatus status=HTTPStatus.OK, Mapping[str, str]|None headers=None) |
Variables | |
| _LOGGER = logging.getLogger(__name__) | |
Helpers for mobile_app.
|
private |
Convert legacy encryption key.
Definition at line 102 of file helpers.py.
|
private |
Decrypt encrypted payload.
Definition at line 74 of file helpers.py.
| JsonValueType | None homeassistant.components.mobile_app.helpers.decrypt_payload | ( | str | key, |
| bytes | ciphertext | ||
| ) |
Decrypt encrypted payload.
Definition at line 97 of file helpers.py.
| JsonValueType | None homeassistant.components.mobile_app.helpers.decrypt_payload_legacy | ( | str | key, |
| bytes | ciphertext | ||
| ) |
Decrypt encrypted payload.
Definition at line 110 of file helpers.py.
| DeviceInfo homeassistant.components.mobile_app.helpers.device_info | ( | dict | registration | ) |
Return the device info for this registration.
Definition at line 196 of file helpers.py.
| Response homeassistant.components.mobile_app.helpers.empty_okay_response | ( | dict | None | headers = None, |
| HTTPStatus | status = HTTPStatus.OK |
||
| ) |
Return a Response with empty JSON object and a 200.
Definition at line 122 of file helpers.py.
| Response homeassistant.components.mobile_app.helpers.error_response | ( | str | code, |
| str | message, | ||
| HTTPStatus | status = HTTPStatus.BAD_REQUEST, |
||
| dict | None | headers = None |
||
| ) |
Return an error Response.
Definition at line 131 of file helpers.py.
| Context homeassistant.components.mobile_app.helpers.registration_context | ( | Mapping[str, Any] | registration | ) |
Generate a context from a request.
Definition at line 117 of file helpers.py.
| dict homeassistant.components.mobile_app.helpers.safe_registration | ( | dict | registration | ) |
Return a registration without sensitive values.
Definition at line 145 of file helpers.py.
| dict homeassistant.components.mobile_app.helpers.savable_state | ( | HomeAssistant | hass | ) |
Return a clean object containing things that should be saved.
Definition at line 161 of file helpers.py.
| Callable[[bytes, bytes], bytes] homeassistant.components.mobile_app.helpers.setup_decrypt | ( | type[RawEncoder | HexEncoder] | key_encoder | ) |
Return decryption function and length of key. Async friendly.
Definition at line 40 of file helpers.py.
| Callable[[bytes, bytes], bytes] homeassistant.components.mobile_app.helpers.setup_encrypt | ( | type[RawEncoder | HexEncoder] | key_encoder | ) |
Return encryption function and length of key. Async friendly.
Definition at line 57 of file helpers.py.
| Response homeassistant.components.mobile_app.helpers.webhook_response | ( | Any | data, |
| *Mapping[str, Any] | registration, | ||
| HTTPStatus | status = HTTPStatus.OK, |
||
| Mapping[str, str] | None | headers = None |
||
| ) |
Return a encrypted response if registration supports it.
Definition at line 168 of file helpers.py.
|
private |
Definition at line 37 of file helpers.py.