npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ubisoft-demux

v1.10931.1

Published

A Node.js client to interact with Ubisoft Connect's protobuf demux API

Downloads

419

Readme

ubisoft-demux-node

npm GitHub Workflow Status

The Ubisoft Connect game launcher uses a bespoke socket-level protocol sending protocol buffer encoded messages to perform the majority of its core functionality. This package implements the Demux protocol and assists with communicating directly with the Demux API.

Usage

The package is well documented with JSDoc and TypeScript. Hovering and IntelliSense should give you plenty of information on each function. The types for the protobuf data are undocumented as of now due to being internal Ubisoft knowledge.

You should be using this package guided by knowledge gained from reverse engineering requests in the Ubisoft Connect launcher. It is very low level and you can easily do things out of order as the Demux API is not meant to be directly consumed by users.

Demux API

Send a basic request

Basic requests contain a requestId that must increment with each request. This method keeps track of all requests and manages the requestId for you.

import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
const resp = await ubiDemux.basicRequest({
    getPatchInfoReq: {
        patchTrackId: 'DEFAULT',
        testConfig: false,
        trackType: 0,
    },
});

Send a service request

A service is a set of requests restricted to a certain domain's data model. This package will keep track of a request's service type and decode it appropriately.

import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
const resp = await ubiDemux.serviceRequest('utility_service', {
    request: {
        geoipReq: {},
    },
});

Use a service connection

Most service interactions occur through an open "connection". This package will open a connection and manage incrementing its connection requestId.

import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
const connection = await ubiDemux.openConnection('ownership_service');
const resp = await connection.request({
    request: {
        requestId: 1,
        initializeReq: {
            getAssociations: true,
            protoVersion: 7,
            useStaging: false,
        },
    },
});

Authentication

You can authenticate with the Demux API using a login ticket obtained from the UbiServices HTTP API. See below for more on it.

import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
await ubiDemux.basicRequest({
    authenticateReq: {
        clientId: 'uplay_pc',
        sendKeepAlive: false,
        token: {
            ubiTicket: `<your ticket here>`,
        },
    },
});

Errors

The Demux API does not return errors. If you do something wrong, you will just see a timeout error. The default timeout is 10 seconds.

UbiServices API

Ubisoft's HTTP REST API is out of the scope of this package, but it contains some basic requests that are complementary to the Demux API.

Login

Currently only supports fresh login without 2FA.

import { UbiServicesApi } from 'ubisoft-demux';
const ubiServices = new UbiServicesApi();
const { ticket } = await ubiServices.login(email, password);

File Parser

Since many of Ubisoft Connect's local files are also protobuf format, this package can also decode many of them.

import { UbisoftFileParser } from 'ubisoft-demux';
const data = readFileSync(`%LOCALAPPDATA%/Ubisoft Game Launcher/user.dat`);
const fileParser = new UbisoftFileParser();
const result = fileParser.parseUserDat(data);

Use IntelliSense to see all the available file parsers.

How to get the .proto's

Only needed if you need to update the protos

  1. Follow steps 1-3 of this guide.
  2. Copy the protos folder to ./proto

How to capture and decode Ubisoft Connect Demux requests

Follow the documentation on ubisoft-dmx-decode