diff --git a/src/Socialbox/Classes/Configuration.php b/src/Socialbox/Classes/Configuration.php index 3ef9567..c3abd6f 100644 --- a/src/Socialbox/Classes/Configuration.php +++ b/src/Socialbox/Classes/Configuration.php @@ -129,6 +129,10 @@ // The amount of time in seconds it takes before a session is considered expired due to inactivity // Default: 12hours $config->setDefault('policies.session_inactivity_expires', 43200); + // The amount of time in seconds it takes before an image captcha is considered expired due to lack of + // answer within the time-frame that the captcha was generated + // If expired; client is expected to request for a new captcha which will generate a new random answer. + $config->setDefault('policies.image_captcha_expires', 300); // Storage configuration $config->setDefault('storage.path', '/etc/socialbox'); // The main path for file storage diff --git a/src/Socialbox/Classes/Configuration/PoliciesConfiguration.php b/src/Socialbox/Classes/Configuration/PoliciesConfiguration.php index 3d9bef0..bf7de98 100644 --- a/src/Socialbox/Classes/Configuration/PoliciesConfiguration.php +++ b/src/Socialbox/Classes/Configuration/PoliciesConfiguration.php @@ -6,14 +6,18 @@ { private int $maxSigningKeys; private int $sessionInactivityExpires; + private int $imageCaptchaExpires; public function __construct(array $data) { $this->maxSigningKeys = $data['max_signing_keys']; $this->sessionInactivityExpires = $data['session_inactivity_expires']; + $this->imageCaptchaExpires = $data['image_captcha_expires']; } /** + * Returns the maximum amount of signing keys a peer can register with the server at once + * * @return int */ public function getMaxSigningKeys(): int @@ -22,10 +26,24 @@ } /** + * Returns the maximum amount of seconds before the session is considered expired due to inactivity + * * @return int */ public function getSessionInactivityExpires(): int { return $this->sessionInactivityExpires; } + + /** + * Returns the maximum amount of seconds before a captcha is considered expired due to the amount of time + * that has passed since the answer was generated, if a user fails to answer the captcha during the time + * period then the user must request for a new captcha with a new answer. + * + * @return int + */ + public function getImageCaptchaExpires(): int + { + return $this->imageCaptchaExpires; + } } \ No newline at end of file