GithubHelp home page GithubHelp logo

yoobiere / ubisoft-demux-node Goto Github PK

View Code? Open in Web Editor NEW
16.0 5.0 2.0 1.47 MB

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

Home Page: https://www.npmjs.com/package/ubisoft-demux

JavaScript 0.44% TypeScript 99.53% Shell 0.03%
ubisoft-connect ubisoft-api protobuf ubisoft uplay

ubisoft-demux-node's Introduction

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

ubisoft-demux-node's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

relm lariaa

ubisoft-demux-node's Issues

How to use uplaydll

Is there any way to communicate with (service_)uplaydll?

I've added uplaydll as service in some files but I'm getting the following error:

if (!connectionId) throw new Error(`Failed to establish connection for ${serviceName}`);

So I guess it's not possible the way I want to do it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.