Class

PasscodeState

PasscodeState()

A class that manages passcodes via local storage.
Constructor

# new PasscodeState()

View Source lib/state/PasscodeState.ts, line 11

Extends

Members

LocalStorage

# protected ls

Inherited From:

View Source lib/state/State.ts, line 24

Methods

# getActiveID(userID) → {string}

Gets the UUID of the active passcode.
Parameters:
Name Type Description
userID string The UUID of the user.

View Source lib/state/PasscodeState.ts, line 145

string

# getResendAfter(userID) → {number}

Gets the number of seconds until when the next passcode can be sent.
Parameters:
Name Type Description
userID string The UUID of the user.

View Source lib/state/PasscodeState.ts, line 187

number

# getTTL(userID) → {number}

Gets the TTL in seconds. When the seconds expire, the code is invalid.
Parameters:
Name Type Description
userID string The UUID of the user.

View Source lib/state/PasscodeState.ts, line 170

number

# protected getUserState(userID) → {LocalStorageUser}

Gets the state of the specified user.
Parameters:
Name Type Description
userID string The UUID of the user.
Overrides:

View Source lib/state/UserState.ts, line 26

# read() → {PasscodeState}

Reads the current state.
Overrides:

View Source lib/state/PasscodeState.ts, line 137

# reset(userID) → {PasscodeState}

Removes the active passcode.
Parameters:
Name Type Description
userID string The UUID of the user.

View Source lib/state/PasscodeState.ts, line 162

# setActiveID(userID, passcodeID) → {PasscodeState}

Sets the UUID of the active passcode.
Parameters:
Name Type Description
userID string The UUID of the user.
passcodeID string The UUID of the passcode to be set as active.

View Source lib/state/PasscodeState.ts, line 154

# setResendAfter(userID, seconds) → {PasscodeState}

Sets the number of seconds until a new passcode can be sent.
Parameters:
Name Type Description
userID string The UUID of the user.
seconds string Number of seconds the passcode is valid for.

View Source lib/state/PasscodeState.ts, line 196

# setTTL(userID, seconds) → {PasscodeState}

Sets the passcode's TTL and stores it to the local storage.
Parameters:
Name Type Description
userID string The UUID of the user.
seconds string Number of seconds the passcode is valid for.

View Source lib/state/PasscodeState.ts, line 179

# write() → {State}

Encodes and writes the data to the local storage.
Inherited From:

View Source lib/state/State.ts, line 51

State