Skip to content

Commit

Permalink
Fix bundled types and main entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
claabs committed Jul 19, 2022
1 parent 2dff467 commit cf9970e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# ubisoft-demux-node

[![npm](https://img.shields.io/npm/v/ubisoft-demux)](https://www.npmjs.com/package/ubisoft-demux)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/claabs/ubisoft-demux-node/Unit%20test%20and%20build)
[![Coverage Status](https://coveralls.io/repos/github/claabs/ubisoft-demux-node/badge.svg?branch=master)](https://coveralls.io/github/claabs/ubisoft-demux-node?branch=master)

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.
Expand All @@ -16,6 +20,7 @@ You should be using this package guided by knowledge gained from reverse enginee
Basic requests contain a `requestId` that must increment with each request. This method keeps track of all requests and manages the `requestId` for you.

```ts
import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
const resp = await ubiDemux.basicRequest({
getPatchInfoReq: {
Expand All @@ -31,6 +36,7 @@ const resp = await ubiDemux.basicRequest({
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.

```ts
import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
const resp = await ubiDemux.serviceRequest('utility_service', {
request: {
Expand All @@ -44,6 +50,7 @@ const resp = await ubiDemux.serviceRequest('utility_service', {
Most service interactions occur through an open "connection". This package will open a connection and manage incrementing its connection `requestId`.

```ts
import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
const connection = await ubiDemux.openConnection('ownership_service');
const resp = await connection.request({
Expand All @@ -63,6 +70,7 @@ const resp = await connection.request({
You can authenticate with the Demux API using a login ticket obtained from the UbiServices HTTP API. See below for more on it.

```ts
import { UbisoftDemux } from 'ubisoft-demux';
const ubiDemux = new UbisoftDemux();
await ubiDemux.basicRequest({
authenticateReq: {
Expand All @@ -88,6 +96,7 @@ Ubisoft's HTTP REST API is out of the scope of this package, but it contains som
Currently only supports fresh login without 2FA.

```ts
import { UbiServicesApi } from 'ubisoft-demux';
const ubiServices = new UbiServicesApi();
const { ticket } = await ubiServices.login(email, password);
```
Expand All @@ -97,6 +106,7 @@ const { ticket } = await ubiServices.login(email, password);
Since many of Ubisoft Connect's local files are also protobuf format, this package can also decode many of them.

```ts
import { UbisoftFileParser } from 'ubisoft-demux';
const data = readFileSync(`%LOCALAPPDATA%/Ubisoft Game Launcher/user.dat`);
const fileParser = new UbisoftFileParser();
const result = fileParser.parseUserDat(data);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "ubisoft-demux",
"version": "1.10690.0",
"version": "1.10690.1",
"description": "A Node.js client to interact with Ubisoft Connect's protobuf demux API",
"main": "dist/index.js",
"main": "dist/src/index.js",
"scripts": {
"test": "DEBUG=ubisoft-demux* jest",
"test:ci": "jest --coverage",
"build": "rimraf dist && tsc",
"lint": "tsc --noEmit && eslint .",
"gen-proto": "protoc proto/*/*.proto --proto_path=proto --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=src/generated/. --ts_proto_opt=onlyTypes=true --ts_proto_opt=outputEncodeMethods=false --ts_proto_opt=outputJsonMethods=false --ts_proto_opt=esModuleInterop=true --ts_proto_opt=env=node --ts_proto_opt=useOptionals=messages"
},
"types": "dist/src/index.d.ts",
"author": {
"name": "Charlie Laabs",
"url": "https://github.com/claabs"
Expand Down

0 comments on commit cf9970e

Please sign in to comment.