public function getToken() { if (!isset($this->session['request_token'])) { $this->session['request_token'] = Binary::base64Encode(Random::bytes(32), true); } return $this->session['request_token']; }
/** * {@inheritdoc} */ public function createSession($userData, $validUntil) { $sessionId = Binary::base64Encode(Random::bytes(32), true); $this->lock['session'] = $sessionId; $this->lock->save(); return $sessionId; }
/** * Generate a random salt. * @return string Salt. */ public function genSalt() { $bytes = Random::bytes($this->saltLength); $b64 = rtrim(base64_encode($bytes), '='); $salt = Binary::slice(str_replace('+', '.', $b64), 0, $this->saltLength); return $this->prefix . $salt; }