Speed up camera tokens (#73098)
This commit is contained in:
parent
35a0f59ec9
commit
f7626bd511
1 changed files with 1 additions and 4 deletions
|
@ -10,7 +10,6 @@ from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import hashlib
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from random import SystemRandom
|
from random import SystemRandom
|
||||||
|
@ -675,9 +674,7 @@ class Camera(Entity):
|
||||||
@callback
|
@callback
|
||||||
def async_update_token(self) -> None:
|
def async_update_token(self) -> None:
|
||||||
"""Update the used token."""
|
"""Update the used token."""
|
||||||
self.access_tokens.append(
|
self.access_tokens.append(hex(_RND.getrandbits(256))[2:])
|
||||||
hashlib.sha256(_RND.getrandbits(256).to_bytes(32, "little")).hexdigest()
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_internal_added_to_hass(self) -> None:
|
async def async_internal_added_to_hass(self) -> None:
|
||||||
"""Run when entity about to be added to hass."""
|
"""Run when entity about to be added to hass."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue