{"name":"sodium-encryption","version":"1.1.0","description":"Sodium encryption that works in node and in the browser","main":"index.js","dependencies":{"tweetnacl":"^0.14.1","sodium-prebuilt":"^1.0.22"},"devDependencies":{"standard":"^6.0.8","tape":"^4.5.1"},"browser":"./browser.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"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-prebuilt":"^1.0.22"},"gitHead":"863361d19731775667be6ccea042979c25f57da7","_id":"sodium-encryption@1.1.0","_shasum":"f3afd00c5ae5ec9c953430cd560c3b4504ba0d9a","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"f3afd00c5ae5ec9c953430cd560c3b4504ba0d9a","tarball":"http://registry-npm.ywwl.com/sodium-encryption/download/sodium-encryption-1.1.0.tgz","integrity":"sha512-THtS5QWBVo9zySjmUBE/zeLizlz0j0Jja0U3uc+UOXsw+GtE7vsSQw7Wu5Lu09LzDj020oIEUNkryoRGB2gLOw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDy9hAZSKPHGqUx/gXqn8CTM7yv30V5wHvmLa7Z3QZXrgIgEY8kSfgFiUSRnD5YQZEEoG0RFHHiX/hsS7m36NrXU28="}],"size":2850,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.1.0.tgz_1462288662206_0.4544892245903611"},"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":1462288664600,"_cnpm_publish_time":1462288664600,"dist-tags":{"latest":"1.2.3"}}