public function create()
    {
        $this->validate();

        $claims        = $this->processOptions();
        $claims['d']   = $this->data;
        $claims['v']   = 0;
        $claims['iat'] = time();

        try {
            $token = JWT::encode($claims, $this->secret, 'HS256');
        } catch (\Exception $e) {
            throw new TokenException($e->getMessage(), null, $e);
        }

        if (($tokenSize = mb_strlen($token, '8bit')) > static::MAX_TOKEN_SIZE) {
            throw new TokenException(
                sprintf('The generated token is larger than %d bytes (%d)', static::MAX_TOKEN_SIZE, $tokenSize)
            );
        }

        return $token;
    }