MFA secret management class.
More...
|
| __construct (string $factor) |
| Initialises a secret manager instance.
|
|
| cleanup_temp_secrets ($userid=null) |
| Deletes any user secrets hanging around in the database.
|
|
| create_secret (int $expires, bool $session, string $secret=null) |
| This function creates or takes a secret, and stores it in the database or session.
|
|
| revoke_secret (string $secret, $userid=null) |
| Revokes the provided secret code for the user.
|
|
| validate_secret (string $secret, bool $keep=false) |
| Validates whether the provided secret is currently valid.
|
|
|
string const | NONVALID = 'nonvalid' |
|
string const | REVOKED = 'revoked' |
|
string const | VALID = 'valid' |
|
◆ __construct()
tool_mfa\local\secret_manager::__construct |
( |
string | $factor | ) |
|
Initialises a secret manager instance.
- Parameters
-
◆ cleanup_temp_secrets()
tool_mfa\local\secret_manager::cleanup_temp_secrets |
( |
| $userid = null | ) |
|
Deletes any user secrets hanging around in the database.
- Parameters
-
int | $userid | the userid to cleanup temp secrets for. |
- Return values
-
◆ create_secret()
tool_mfa\local\secret_manager::create_secret |
( |
int | $expires, |
|
|
bool | $session, |
|
|
string | $secret = null ) |
This function creates or takes a secret, and stores it in the database or session.
- Parameters
-
int | $expires | the length of time the secret is valid. e.g. 1 min = 60 |
bool | $session | whether this secret should be linked to the session. |
string | $secret | an optional provided secret |
- Return values
-
string | the secret code, or 0 if no new code created. |
◆ revoke_secret()
tool_mfa\local\secret_manager::revoke_secret |
( |
string | $secret, |
|
|
| $userid = null ) |
Revokes the provided secret code for the user.
- Parameters
-
string | $secret | the secret to revoke. |
int | $userid | the userid to revoke the secret for. |
- Return values
-
◆ validate_secret()
tool_mfa\local\secret_manager::validate_secret |
( |
string | $secret, |
|
|
bool | $keep = false ) |
Validates whether the provided secret is currently valid.
- Parameters
-
string | $secret | the secret to check |
bool | $keep | should the secret be kept for reuse until expiry? |
- Return values
-
string | a secret manager state constant |
The documentation for this class was generated from the following file: