signature (aka "unknown6") encryption bindings for node
may include some signature building utils soon
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
module.encrypt(<Buffer> input, <Buffer> iv, <function> callback)
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)
input
(Buffer): a protobuf-encoded signature message to encryptinitVector
(Buffer): a 32-byte random initialization vector to encrypt the data againstcb(err, encryptedSignature)
(Func): a callback function to execute when encryption by the moldue has been completed. success whenerr
is null.encryptedSignature
is a buffer containing the encrypted information.
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'));
});
- contribute whatever you can
- credit for
encrypt.c
goes to wchill and friends @ /r/pkmngodev