New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

protonsdk-variant

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protonsdk-variant

The ProtonSDK Variant code done in Javascript to create or decode packets for games/servers that use ProtonSDK

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

Variant

The ProtonSDK Variant code done in Javascript to create or decode packets for games/servers that use ProtonSDK

Examples

Creating a Variant Packet

const { Variant } = require("protonsdk-variant");
const varlist = new Variant(); // create a new instance of Variant class

const packetData = varlist.call("OnConsoleMessage", "Hello"); // creates a packet and returns the data
/* Packet Data:
{
  type: 4,
  packetType: 1,
  netID: -1,
  state: 8,
  delay: 0,
  argsCount: 2,
  args: [ 'OnConsoleMessage', 'Hello' ],
  packet: <Buffer 04 00 00 00 01 00 00 00 ff ff ff ff 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 44 more bytes>
}*/

const packetData2 = varlist.call(
    {
        netID: 1,
        delay: 1000
    },
    "OnConsoleMessage",
    "Hello"
); // creates a packet with netID and delay options and returns the data
/* Packet Data:
{
  type: 4,
  packetType: 1,
  netID: 1,
  state: 8,
  delay: 1000,
  argsCount: 2,
  args: [ 'OnConsoleMessage', 'Hello' ],
  packet: <Buffer 04 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 e8 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 44 more bytes>
}*/

Converting a Buffer to Variant Class

const { Variant } = require("protonsdk-variant");
const varlist = Variant.from("0400000001000000ffffffff000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000020002100000004f6e436f6e736f6c654d65737361676501020500000048656c6c6f"); // returns a new instance of the Variant class containing the decoded data

/* Packet Data: 
{
  type: 4,
  packetType: 1,
  netID: -1,
  state: 8,
  delay: 0,
  argsCount: 2,
  args: [ 'OnConsoleMessage', 'Hello' ],
  packet: <Buffer 04 00 00 00 01 00 00 00 ff ff ff ff 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 44 more bytes>
}*/

FAQs

Package last updated on 19 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts