Remove no longer needed auth.util, use secrets instead (#29861)

This commit is contained in:
Ville Skyttä authored and Paulus Schoutsen committed 2019-12-12 16:46:33 +01:00
1 parent c58c10ab7c
commit 130571c478
11 files changed
+24 -34

No files matched your search

@@ -1,11 +1,11 @@
"""Provides an HTTP API for mobile_app."""
import secrets
from typing import Dict
import uuid
from aiohttp.web import Request, Response
from nacl.secret import SecretBox
from homeassistant.auth.util import generate_secret
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.const import CONF_WEBHOOK_ID, HTTP_CREATED
@@ -34,7 +34,7 @@ class RegistrationsView(HomeAssistantView):
"""Handle the POST request for registration."""
hass = request.app["hass"]
webhook_id = generate_secret()
webhook_id = secrets.token_hex()
if hass.components.cloud.async_active_subscription():
data[
@@ -46,7 +46,7 @@ class RegistrationsView(HomeAssistantView):
data[CONF_WEBHOOK_ID] = webhook_id
if data[ATTR_SUPPORTS_ENCRYPTION] and supports_encryption():
data[CONF_SECRET] = generate_secret(SecretBox.KEY_SIZE)
data[CONF_SECRET] = secrets.token_hex(SecretBox.KEY_SIZE)
data[CONF_USER_ID] = request["hass_user"].id