Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@doctormckay/steam-crypto

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

@doctormckay/steam-crypto - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

system.pem

59

index.js

@@ -1,41 +0,42 @@

var crypto = require('crypto');
var publicKey = require('fs').readFileSync(__dirname + '/public.pub');
var Crypto = require('crypto');
var g_PubkeySystem = require('fs').readFileSync(__dirname + '/system.pem');
exports.verifySignature = function(data, signature, algorithm) {
var verify = crypto.createVerify(algorithm || "RSA-SHA1");
verify.update(data);
verify.end();
return verify.verify(publicKey, signature);
var verify = Crypto.createVerify(algorithm || "RSA-SHA1");
verify.update(data);
verify.end();
return verify.verify(g_PubkeySystem, signature);
};
exports.generateSessionKey = function() {
var sessionKey = crypto.randomBytes(32);
var cryptedSessionKey = crypto.publicEncrypt(publicKey, sessionKey);
return {
plain: sessionKey,
encrypted: cryptedSessionKey
};
var sessionKey = Crypto.randomBytes(32);
var cryptedSessionKey = Crypto.publicEncrypt(g_PubkeySystem, sessionKey);
return {
plain: sessionKey,
encrypted: cryptedSessionKey
};
};
exports.symmetricEncrypt = function(input, key) {
var iv = crypto.randomBytes(16);
var aesIv = crypto.createCipheriv('aes-256-ecb', key, '');
aesIv.setAutoPadding(false);
aesIv.end(iv);
var aesData = crypto.createCipheriv('aes-256-cbc', key, iv);
aesData.end(input);
return Buffer.concat([aesIv.read(), aesData.read()]);
var iv = Crypto.randomBytes(16);
var aesIv = Crypto.createCipheriv('aes-256-ecb', key, '');
aesIv.setAutoPadding(false);
aesIv.end(iv);
var aesData = Crypto.createCipheriv('aes-256-cbc', key, iv);
aesData.end(input);
return Buffer.concat([aesIv.read(), aesData.read()]);
};
exports.symmetricDecrypt = function(input, key) {
var aesIv = crypto.createDecipheriv('aes-256-ecb', key, '');
aesIv.setAutoPadding(false);
aesIv.end(input.slice(0, 16));
var aesData = crypto.createDecipheriv('aes-256-cbc', key, aesIv.read());
aesData.end(input.slice(16));
return aesData.read();
var aesIv = Crypto.createDecipheriv('aes-256-ecb', key, '');
aesIv.setAutoPadding(false);
aesIv.end(input.slice(0, 16));
var aesData = Crypto.createDecipheriv('aes-256-cbc', key, aesIv.read());
aesData.end(input.slice(16));
return aesData.read();
};
{
"name": "@doctormckay/steam-crypto",
"version": "0.0.1",
"description": "Node.js implementation of Valve's crypto",
"repository": {
"type": "git",
"url": "https://github.com/seishun/node-steam-crypto.git"
},
"keywords": [
"steam",
"crypto"
],
"author": "Nikolai Vavilov <vvnicholas@gmail.com>",
"license": "MIT"
"name": "@doctormckay/steam-crypto",
"version": "1.0.0",
"description": "Node.js implementation of Valve's crypto",
"repository": {
"type": "git",
"url": "https://github.com/DoctorMcKay/node-steam-crypto.git"
},
"keywords": [
"steam",
"crypto"
],
"author": {
"name": "Alexander Corn",
"email": "mckay@doctormckay.com",
"url": "https://www.doctormckay.com"
},
"contributors": [
{
"name": "Nikolai Vavilov",
"email": "vvnicholas@gmail.com"
}
],
"license": "MIT"
}
# node-steam-crypto
Node.js implementation of Steam crypto. All keys and data are passed as Buffers.
Node.js implementation of Steam crypto. All keys, data, and signatures are passed as Buffers.
Fork of, and compatible with, [steam-crypto](https://www.npmjs.com/package/steam-crypto).
## verifySignature(data, signature[, algorithm])
Verifies an RSA signature using the Steam system's public key. `data` and `signature` should both be Buffers. `algorithm` defaults to "RSA-SHA1". Returns `true` if the signature is valid, or `false` if not.
Verifies an RSA signature using the Steam system's public key. `algorithm` defaults to "RSA-SHA1". Returns `true` if the signature is valid, or `false` if not.

@@ -9,0 +11,0 @@ ## generateSessionKey()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc