scopeConfig = $scopeConfig; } /** * Get API key * @return string */ public function getApiKey() { return $this->scopeConfig->getValue(static::XML_PATH_API_KEY); } /** * Get authy API endpoint * @param string $path * @return string */ public function getProtectedApiEndpoint($path) { return static::AUTHY_BASE_ENDPOINT . 'protected/json/' . $path; } /** * Get authy API endpoint * @param string $path * @return string */ public function getOneTouchApiEndpoint($path) { return static::AUTHY_BASE_ENDPOINT . 'onetouch/json/' . $path; } /** * Get error from response * @param array $response * @return string */ public function getErrorFromResponse($response) { if ($response === false) { return 'Invalid authy webservice response'; } if (!isset($response['success']) || !$response['success']) { return $response['message']; } return false; } }