Home Assistant Unofficial Reference 2024.12.1
homeassistant.auth.mfa_modules.totp.TotpAuthModule Class Reference
Inheritance diagram for homeassistant.auth.mfa_modules.totp.TotpAuthModule:
[legend]
Collaboration diagram for homeassistant.auth.mfa_modules.totp.TotpAuthModule:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, dict[str, Any] config)
 
None async_depose_user (self, str user_id)
 
bool async_is_user_setup (self, str user_id)
 
SetupFlow async_setup_flow (self, str user_id)
 
str async_setup_user (self, str user_id, Any setup_data)
 
bool async_validate (self, str user_id, dict[str, Any] user_input)
 
vol.Schema input_schema (self)
 

Static Public Attributes

string DEFAULT_TITLE = "Time-based One Time Password"
 
int MAX_RETRY_TIME = 5
 

Private Member Functions

str _add_ota_secret (self, str user_id, str|None secret=None)
 
None _async_load (self)
 
None _async_save (self)
 
bool _validate_2fa (self, str user_id, str code)
 

Private Attributes

 _init_lock
 
 _user_store
 
 _users
 

Detailed Description

Auth module validate time-based one time password.

Definition at line 73 of file totp.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.auth.mfa_modules.totp.TotpAuthModule.__init__ (   self,
HomeAssistant  hass,
dict[str, Any]  config 
)
Initialize the user data store.

Definition at line 79 of file totp.py.

Member Function Documentation

◆ _add_ota_secret()

str homeassistant.auth.mfa_modules.totp.TotpAuthModule._add_ota_secret (   self,
str  user_id,
str | None   secret = None 
)
private
Create a ota_secret for user.

Definition at line 108 of file totp.py.

◆ _async_load()

None homeassistant.auth.mfa_modules.totp.TotpAuthModule._async_load (   self)
private
Load stored data.

Definition at line 93 of file totp.py.

◆ _async_save()

None homeassistant.auth.mfa_modules.totp.TotpAuthModule._async_save (   self)
private
Save data.

Definition at line 104 of file totp.py.

◆ _validate_2fa()

bool homeassistant.auth.mfa_modules.totp.TotpAuthModule._validate_2fa (   self,
str  user_id,
str  code 
)
private
Validate two factor authentication code.

Definition at line 164 of file totp.py.

◆ async_depose_user()

None homeassistant.auth.mfa_modules.totp.TotpAuthModule.async_depose_user (   self,
str  user_id 
)
Depose auth module for user.

Definition at line 138 of file totp.py.

◆ async_is_user_setup()

bool homeassistant.auth.mfa_modules.totp.TotpAuthModule.async_is_user_setup (   self,
str  user_id 
)
Return whether user is setup.

Definition at line 146 of file totp.py.

◆ async_setup_flow()

SetupFlow homeassistant.auth.mfa_modules.totp.TotpAuthModule.async_setup_flow (   self,
str  user_id 
)
Return a data entry flow handler for setup module.

Mfa module should extend SetupFlow

Definition at line 117 of file totp.py.

◆ async_setup_user()

str homeassistant.auth.mfa_modules.totp.TotpAuthModule.async_setup_user (   self,
str  user_id,
Any  setup_data 
)
Set up auth module for user.

Definition at line 126 of file totp.py.

◆ async_validate()

bool homeassistant.auth.mfa_modules.totp.TotpAuthModule.async_validate (   self,
str  user_id,
dict[str, Any]  user_input 
)
Return True if validation passed.

Definition at line 153 of file totp.py.

◆ input_schema()

vol.Schema homeassistant.auth.mfa_modules.totp.TotpAuthModule.input_schema (   self)
Validate login flow input data.

Definition at line 89 of file totp.py.

Member Data Documentation

◆ _init_lock

homeassistant.auth.mfa_modules.totp.TotpAuthModule._init_lock
private

Definition at line 86 of file totp.py.

◆ _user_store

homeassistant.auth.mfa_modules.totp.TotpAuthModule._user_store
private

Definition at line 83 of file totp.py.

◆ _users

homeassistant.auth.mfa_modules.totp.TotpAuthModule._users
private

Definition at line 102 of file totp.py.

◆ DEFAULT_TITLE

string homeassistant.auth.mfa_modules.totp.TotpAuthModule.DEFAULT_TITLE = "Time-based One Time Password"
static

Definition at line 76 of file totp.py.

◆ MAX_RETRY_TIME

int homeassistant.auth.mfa_modules.totp.TotpAuthModule.MAX_RETRY_TIME = 5
static

Definition at line 77 of file totp.py.


The documentation for this class was generated from the following file: