Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.mobile_app.helpers Namespace Reference

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__)
 

Detailed Description

Helpers for mobile_app.

Function Documentation

◆ _convert_legacy_encryption_key()

bytes homeassistant.components.mobile_app.helpers._convert_legacy_encryption_key ( str  key)
private
Convert legacy encryption key.

Definition at line 102 of file helpers.py.

◆ _decrypt_payload_helper()

JsonValueType | None homeassistant.components.mobile_app.helpers._decrypt_payload_helper ( str | bytes  key,
bytes  ciphertext,
bytes  key_bytes,
type[RawEncoder | HexEncoder]  key_encoder 
)
private
Decrypt encrypted payload.

Definition at line 74 of file helpers.py.

◆ decrypt_payload()

JsonValueType | None homeassistant.components.mobile_app.helpers.decrypt_payload ( str  key,
bytes  ciphertext 
)
Decrypt encrypted payload.

Definition at line 97 of file helpers.py.

◆ decrypt_payload_legacy()

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.

◆ device_info()

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.

◆ empty_okay_response()

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.

◆ error_response()

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.

◆ registration_context()

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.

◆ safe_registration()

dict homeassistant.components.mobile_app.helpers.safe_registration ( dict  registration)
Return a registration without sensitive values.

Definition at line 145 of file helpers.py.

◆ savable_state()

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.

◆ setup_decrypt()

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.

◆ setup_encrypt()

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.

◆ webhook_response()

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.

Variable Documentation

◆ _LOGGER

homeassistant.components.mobile_app.helpers._LOGGER = logging.getLogger(__name__)
private

Definition at line 37 of file helpers.py.