JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q39953F
  • License MIT

Steam client connection encryption/decryption protocol.

Package Exports

  • @fcastrocs/steam-client-crypto
  • @fcastrocs/steam-client-crypto/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@fcastrocs/steam-client-crypto) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

steam-client-crypto

A Node.js module that implements crypto used in the Steam client. Mainly TCP connection encryption handshake, and payload encryption/decryption. Also, password RSA encryption. It is used here https://github.com/fcastrocs/steam-client

Installation

npm i @fcastrocs/steam-client-crypto

Usage

import SteamCrypto from "@fcastrocs/steam-client-crypto";

const sessionKey = SteamCrypto.genSessionKey(buffer);
...

Abstract Class: SteamCrypto

interface

export interface SessionKey {
  plain: Buffer;
  encrypted: Buffer;
}

export default abstract class SteamCrypto {
  /**
   * Generate a 32-byte symmetric sessionkey and encrypt it with Steam's public "System" key.
   * @param nonce - obtained in channelEncryptResponse when encrypting Steam TCP connection
   */
  static genSessionKey(nonce: Buffer): SessionKey;
  /**
   * Encrypt proto payload to be sent to Steam via TCP
   */
  static encrypt(data: Buffer, key: SessionKey["plain"]): Buffer;
  /**
   * Decrypt proto payload received from Steam via TCP
   */
  static decrypt(data: Buffer, key: SessionKey["plain"]): Buffer;

  /**
   * Compute a crc32 as an unsigned number
   */
  static crc32(str: Buffer): number;

  /**
   * Encrypt password with RSA
   */
  static rsaEncrypt(password: string, publicKeyMod: string, publicKeyExp: string): string;
}