private function generateToken($expired = false)
    {
        $life = $this->tokenConfig['life'];

        if (!$expired) {
            $expire = time() + $life;
        } else {
            $expire = time() - ($life * 2);
        }

        $generator = new RandomGenerator();
        $tokenString = $generator->randomToken();

        $e = PasswordEncryptor::create_for_algorithm('blowfish'); //blowfish isn't URL safe and maybe too long?
        $salt = $e->salt($tokenString);
        $token = $e->encrypt($tokenString, $salt);

        return array(
            'token' => substr($token, 7),
            'expire' => $expire,
        );
    }