
npm install vgp$ npm install --python=python2.7`
`$ npm install --global --production windows-build-tools`
It is available to install via the Node.js Package Manager (NPM) by using the command:
`$ npm install vgp`
or by cloning from Github and installing locally using NPM:
`$ git clone https://github.com/duality-solutions/node-vgp; cd node-vgp; git submodule update --init --recursive`
Linux:
`$ npm install`
Windows (using Chocolatey and NVM):
`$ npm install -g node-gyp; npm update; node-gyp clean; node-gyp configure; node-gyp build`
Usage
-----
Encrypt and decrypt a string using VGP
`js
// VGP encrypt example using ed25519 hex encoded pubkey
var message = 'VGP is easy to use!';
var publicKey = "bdc7d62d2bf3987fba434af854a2473935f12519909b3552a1b41e253aee4855";
var cipherText = vgp.Encrypt(Buffer.from(publicKey, 'hex'), Buffer.from(message, 'utf8'));
console.log("original message: " + message + ", cipher text byte size: " + cipherText.byteLength.toString());
// VGP decrypt example using ed25519 hex encoded private seed
var privateSeed = "8e05b7251e25ddc7369c071437b3175d9bb00ac4a89082398bb6f8bb68455cca";
var decryptedMessage = vgp.Decrypt(Buffer.from(privateSeed, 'hex'), cipherText);
console.log("decrypted message: " + decryptedMessage.toString());
if (message == decryptedMessage) {
console.log('Complete. VGP encrypt/decrypt successful!');
} else {
console.log('Complete. VGP encrypt/decrypt failed!');
}
``