/**
  * Returns serialized token.
  *
  * @param AuthToken $token
  * @return string
  */
 public function serializeToken(AuthToken $token)
 {
     $payload = array('id' => $token->getAuthIdentifier(), 'key' => $token->getPublicKey());
     return $this->encrypter->encrypt($payload);
 }
 /**
  * Retrive user from auth token.
  *
  * @param AuthToken $token
  * @return Authenticatable|null
  */
 public function user(AuthToken $token)
 {
     return $this->users->retrieveByID($token->getAuthIdentifier());
 }
 /**
  * Returns serialized token.
  *
  * @param AuthToken $token
  * @return string
  */
 public function serializeToken(AuthToken $token)
 {
     $payload = $this->encrypter->encrypt(array('id' => $token->getAuthIdentifier(), 'key' => $token->getPublicKey()));
     $payload = str_replace(array('+', '/', '\\r', '\\n', '='), array('-', '_'), $payload);
     return $payload;
 }