{"name":"sodium-encryption","version":"1.2.3","description":"Sodium encryption that works in node and in the browser","main":"index.js","dependencies":{"tweetnacl":"^0.14.3","sodium-native":"^1.5.1"},"devDependencies":{"standard":"^6.0.8","tape":"^4.5.1"},"browser":"./browser.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/sodium-encryption.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/sodium-encryption/issues"},"homepage":"https://github.com/mafintosh/sodium-encryption","optionalDependencies":{"sodium-native":"^1.5.1"},"gitHead":"42a7cba0f97718157e8c7a386ef94ba31e16837a","_id":"sodium-encryption@1.2.3","_shasum":"eb69ce283867960930d6526ea5800c7e04a8906e","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"eb69ce283867960930d6526ea5800c7e04a8906e","tarball":"http://registry-npm.ywwl.com/sodium-encryption/download/sodium-encryption-1.2.3.tgz","integrity":"sha512-rmyNwc1zGcuIOwrcOD+Rcxa35lmhG+WDU+ATy8pMF43ZPrx7KjALOj9vR5EivWON/LMSLdRkjfcqQj5nRegjog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGFeqih9bPzrp+owrFdsiFs/L8KRRKn1xUQp5sn6urigIhAKaVFl9cTI2p6l/d/tLDyhWlS0cmTPbSSv7Yme5L1oe/"}],"size":2713,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.2.3.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.2.3.tgz_1487329527742_0.25886591826565564"},"directories":{},"readme":"# sodium-encryption\n\n[Sodium encryption](https://github.com/paixaop/node-sodium) that works in node and in the browser\n\n```\nnpm install sodium-encryption\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/sodium-encryption.svg?style=flat)](http://travis-ci.org/mafintosh/sodium-encryption)\n\n## Usage\n\n``` js\nvar encryption = require('sodium-encryption')\n\nvar key = encryption.key()\nvar nonce = encryption.nonce()\nvar message = Buffer('a message')\n\nvar box = encryption.encrypt(message, nonce, key)\n\nconsole.log('encrypted message is:', box)\nconsole.log('decrypted message is:', encryption.decrypt(box, nonce, key))\n```\n\n## API\n\n#### `key = encryption.key()`\n\nGenerate a secret key. Returns a 32 byte buffer.\n\n#### `nonce = encryption.nonce()`\n\nGenerate a nonce. Returns a 24 byte buffer.\nA nonce can be public and you should use a new one everytime you use a key.\n\n#### `box = encryption.encrypt(message, nonce, key)`\n\nEncrypts a message.\n\n#### `message = encryption.decrypt(box, nonce, key)`\n\nDecrypt a message. Returns `null` is the message cannot be decrypted.\n\n#### `keys = encryption.scalarMultiplicationKeyPair([secretKey])`\n\nGenerate a key pair to be used for scalar multiplication. If you don't pass in a secret key, one will be generated for you.\nReturns a key pair consisting of a secret key and a public key.\n\n``` js\n{\n  secretKey: <Buffer>,\n  publicKey: <Buffer>\n}\n```\n\n#### `sharedKey = encryption.scalarMultiplication(secretKey, otherPublicKey)`\n\nGenerate a shared key based on a remote public scalar multiplication key and your own secret key.\nReturns the same shared key if called with corresponding secret and public key\n\n``` js\nvar keys = encryption.scalarMultiplicationKeyPair()\nvar otherKeys = encryption.scalarMultiplicationKeyPair()\n\nconsole.log('shared key', encryption.scalarMultiplication(keys.secretKey, otherKeys.publicKey))\nconsole.log('shared key', encryption.scalarMultiplication(otherKeys.secretKey, keys.publicKey))\n```\n\n## License\n\nMIT\n","publish_time":1487329528486,"_cnpm_publish_time":1487329528486,"dist-tags":{"latest":"1.2.3"}}