{"_id":"sodium-encryption","_rev":"480848","name":"sodium-encryption","description":"Sodium encryption that works in node and in the browser","dist-tags":{"latest":"1.2.3"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-08-05T09:35:37.000Z","created":"2016-03-10T11:42:57.173Z","1.2.3":"2017-02-17T11:05:28.486Z","1.2.2":"2016-10-09T20:07:59.649Z","1.2.1":"2016-10-08T21:30:10.516Z","1.2.0":"2016-10-08T21:22:50.507Z","1.1.0":"2016-05-03T15:17:44.600Z","1.0.1":"2016-03-10T11:48:12.594Z","1.0.0":"2016-03-10T11:42:57.173Z"},"users":{"akiva":true},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/sodium-encryption.git"},"versions":{"1.2.3":{"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","size":2713,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/sodium-encryption/download/sodium-encryption-1.2.3.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.2.3.tgz_1487329527742_0.25886591826565564"},"directories":{},"publish_time":1487329528486,"_cnpm_publish_time":1487329528486,"_hasShrinkwrap":false},"1.2.2":{"name":"sodium-encryption","version":"1.2.2","description":"Sodium encryption that works in node and in the browser","main":"index.js","dependencies":{"tweetnacl":"^0.14.3","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":"f725d4539439081870dd5dbfe52b8625df039035","_id":"sodium-encryption@1.2.2","_shasum":"8f709a9f56584c077e303e3e2869d7fac65d599e","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.6","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"8f709a9f56584c077e303e3e2869d7fac65d599e","size":2618,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/sodium-encryption/download/sodium-encryption-1.2.2.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.2.2.tgz_1476043677991_0.996773973107338"},"directories":{},"publish_time":1476043679649,"_cnpm_publish_time":1476043679649,"_hasShrinkwrap":false},"1.2.1":{"name":"sodium-encryption","version":"1.2.1","description":"Sodium encryption that works in node and in the browser","main":"index.js","dependencies":{"tweetnacl":"^0.14.3","sodium-prebuilt":"^1.1.15"},"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.1.15"},"gitHead":"b0be8779846904e8224986ee22a1f93367b0a314","_id":"sodium-encryption@1.2.1","_shasum":"c8c659bf1ed8e07a47f72c7751c439eeaa86ce6a","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.6","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"c8c659bf1ed8e07a47f72c7751c439eeaa86ce6a","size":2620,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sodium-encryption/download/sodium-encryption-1.2.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.2.1.tgz_1475962208891_0.3773949097376317"},"directories":{},"publish_time":1475962210516,"_cnpm_publish_time":1475962210516,"_hasShrinkwrap":false},"1.2.0":{"name":"sodium-encryption","version":"1.2.0","description":"Sodium encryption that works in node and in the browser","main":"index.js","dependencies":{"tweetnacl":"^0.14.3","sodium-prebuilt":"^1.1.15"},"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.1.15"},"gitHead":"822742b80b958af2afc0604d235af4011baba365","_id":"sodium-encryption@1.2.0","_shasum":"d1d069344fc9fd293618aff80062fe82ed03eb04","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.6","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"d1d069344fc9fd293618aff80062fe82ed03eb04","size":2697,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sodium-encryption/download/sodium-encryption-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.2.0.tgz_1475961768678_0.11515221954323351"},"directories":{},"publish_time":1475961770507,"_cnpm_publish_time":1475961770507,"_hasShrinkwrap":false},"1.1.0":{"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","size":2850,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sodium-encryption/download/sodium-encryption-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.1.0.tgz_1462288662206_0.4544892245903611"},"directories":{},"publish_time":1462288664600,"_cnpm_publish_time":1462288664600,"_hasShrinkwrap":false},"1.0.1":{"name":"sodium-encryption","version":"1.0.1","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":"080f7054dd9a86f37cd6c4d1f34652c7dd363302","_id":"sodium-encryption@1.0.1","_shasum":"a374070c8e6a74a005d7f9a71d46df1b63f61d65","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"a374070c8e6a74a005d7f9a71d46df1b63f61d65","size":2218,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sodium-encryption/download/sodium-encryption-1.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.0.1.tgz_1457610492190_0.08270715130493045"},"directories":{},"publish_time":1457610492594,"_cnpm_publish_time":1457610492594,"_hasShrinkwrap":false},"1.0.0":{"name":"sodium-encryption","version":"1.0.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":"98fbaf251c7e1d82c6eea2e9565a5337e58c06a9","_id":"sodium-encryption@1.0.0","_shasum":"b0bba385a56a199588cdf207f8861ad5aa873951","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"b0bba385a56a199588cdf207f8861ad5aa873951","size":2275,"noattachment":false,"key":"/sodium-encryption/-/sodium-encryption-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sodium-encryption/download/sodium-encryption-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sodium-encryption-1.0.0.tgz_1457610176774_0.7114700668025762"},"directories":{},"publish_time":1457610177173,"_cnpm_publish_time":1457610177173,"_hasShrinkwrap":false}},"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","_attachments":{},"homepage":"https://github.com/mafintosh/sodium-encryption","bugs":{"url":"https://github.com/mafintosh/sodium-encryption/issues"},"license":"MIT"}