_mathRandom = $mathRandom; } /** * Generate random string for token or secret or verifier * * @param int $length String length * @return string */ public function generateRandomString($length) { return $this->_mathRandom->getRandomString( $length, \Magento\Framework\Math\Random::CHARS_DIGITS . \Magento\Framework\Math\Random::CHARS_LOWERS ); } /** * Generate random string for token * * @return string */ public function generateToken() { return $this->generateRandomString(self::LENGTH_TOKEN); } /** * Generate random string for token secret * * @return string */ public function generateTokenSecret() { return $this->generateRandomString(self::LENGTH_TOKEN_SECRET); } /** * Generate random string for verifier * * @return string */ public function generateVerifier() { return $this->generateRandomString(self::LENGTH_TOKEN_VERIFIER); } /** * Generate random string for consumer key * * @return string */ public function generateConsumerKey() { return $this->generateRandomString(self::LENGTH_CONSUMER_KEY); } /** * Generate random string for consumer secret * * @return string */ public function generateConsumerSecret() { return $this->generateRandomString(self::LENGTH_CONSUMER_SECRET); } }