GithubHelp home page GithubHelp logo

blaat01 / node-pogo-signature Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spencersharkey/node-pogo-signature

0.0 1.0 0.0 104 KB

"unknown6" bindings for node (repo previously titled node-pogo-u6)

Python 0.06% C++ 0.57% C 98.91% JavaScript 0.45%

node-pogo-signature's Introduction

node-pogo-signature

signature (aka "unknown6") encryption bindings for node

todo

  • look into native js implementation of encrypt.c
  • start writing signature builder (in progress)
  • submit PRs to node apis with signature patches

may include some signature building utils soon

install

on npm install the module will self-build. the c/c++ code is located within the /src directory.

you may require the node-gyp package installed globally to build:

npm install node-gyp -g

usage

module.encrypt(<Buffer> input, <Buffer> iv, <function> callback)
Info:

simply passes input and iv through the encrypt method found in the native module.

the callback's err is truthy when input validation occurs (note: iv must be 32 bytes long)

Arguments:
  • input (Buffer): a protobuf-encoded signature message to encrypt
  • initVector (Buffer): a 32-byte random initialization vector to encrypt the data against
  • cb(err, encryptedSignature) (Func): a callback function to execute when encryption by the moldue has been completed. success when err is null. encryptedSignature is a buffer containing the encrypted information.

example

the following will read an input buffer read directly from a file, in the real world this will most likely come from an encoded protobuf structure you generated with your api requests.

var pogoSignature = require('node-pogo-signature');

var dump = fs.readFileSync('./signatureBinary.bin');
var iv = crypto.randomBytes(32);


pogoSignature.encrypt(dump, iv, function(err, result) {
	if (err) return console.error(err);

	console.log('output length: ', result.length)
    console.log('output iv: ', result.slice(0, 32).toString('hex'));
});

notes

  • contribute whatever you can
  • credit for encrypt.c goes to friends @ /r/pkmngodev (repo is gone)

node-pogo-signature's People

Contributors

spencersharkey avatar segura2010 avatar

Watchers

 avatar

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.