Skip to main content

Module login

Module login 

Source
Expand description

The password + Secret Key login state machine.

One attempt runs: start a session (registering the device if the server asks), exchange SRP, confirm the key, then complete authentication over the MAC-signed encrypted channel, driving 2FA when the account requires it.

Enumsยง

LoginOutcome ๐Ÿ”’
The result of a single login attempt: a finished session, or a rejected OTP that asks for a full restart.

Constantsยง

AUTH_COMPLETE_ENDPOINT ๐Ÿ”’
AUTH_METHODS_ENDPOINT ๐Ÿ”’
AUTH_START_ENDPOINT ๐Ÿ”’
MAX_DEVICE_ATTEMPTS ๐Ÿ”’
How many times the server may send us back to register or reauthorize the device before we give up. One round is the normal case.

Functionsยง

fetch_auth_methods ๐Ÿ”’
Confirms the account offers a given auth method.
login_attempt ๐Ÿ”’
Runs one full login sequence: start a session, exchange SRP, verify the key, and drive 2FA if the server asks for it.
start_new_session ๐Ÿ”’
Starts a new session, looping through device registration/reauthorization until the server returns SRP parameters.
verify_session_key ๐Ÿ”’
Completes authentication over the MAC-signed, encrypted channel, returning the enabled 2FA methods when the account needs a second factor.