{"name":"hypercore-crypto","version":"2.0.1","description":"The crypto primitives used in hypercore, extracted into a separate module","main":"index.js","dependencies":{"sodium-javascript":"^0.5.6","sodium-native":"^3.1.1","uint64be":"^3.0.0"},"devDependencies":{"standard":"^14.3.3","tape":"^5.0.0"},"browser":{"./sodium":"sodium-javascript"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hypercore-crypto.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hypercore-crypto/issues"},"homepage":"https://github.com/mafintosh/hypercore-crypto","gitHead":"e253cf66a5d3b3268726f6865358cf85dd871737","_id":"hypercore-crypto@2.0.1","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-JwCksia/xIxNncVrP7emPyCN2J/Yn6LYgCJKh24DZvniZacrxZm7v0SuatRpvllLXzODEHVjyQxS2ZqE5F/DFw==","shasum":"5193fea993cb47a42f8f31c8310601cf08fb18a4","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-2.0.1.tgz","fileCount":6,"unpackedSize":8768,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevB5tCRA9TVsSAnZWagAAzEAP/j58mPDxpcXOknt0D0QR\nv+xEXB91oyUftihKYNVBiZCLWwI93GUv41Zhu5r2SfnfBSMOteuzcV57PoYX\n7ZoMtMCBU56BBugvUaoiUxlZgHYwrN3fQlMmTgL1d3nJJDefARU/0K6x176j\nEFhvuRn0rMH4DBMxA29bcb/mAazrtu2iTAE92AcGzYmKNQUKehluXqtPeUfs\ncDswYe4fU+W5aMvAzmM8kSfmY5IExyhPHijuV3OLA/jkPmtUq88CUNFeKBQt\n7dgYtayb2+PrwAZfBmzfUhEg4/kPrqtdft0BRQzyTwaLEVXgE7REUokcI/2k\nc2e5O3MZVdUqonp4ZSOnwBK9me4GcfN9f3iWtYxlWLInJT7tGYFJQN9CJOb8\nxVGMn8Yc5vq0bO4WOxgTh0irDUw0IYwgSW54+KLuIw7xSXhccXnEzQtTcdIa\neoPs3vXM9t8TuDxiucfIw75G86ndjLC7Uwms7VPEA3mrtsYydtrOE3Uusb4u\n3FpAd5RyBxRtU0243c0tK7epQZtD24aTQf0BvO40ATwz8tsMHH+7sE63pxTd\nuhPwcfte3v/LWGQBUg4DsTsNHDwEKsfg8dekWqsGoNfWaUNnXJn38HwKGCrZ\nysLqq0e3WhJzVsGICHBR9SCBg3ql/di/o7bl/sfaqZDY2Cz/H1n2TiROIJ+b\nWqjj\r\n=yV4x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLMjGSSYm0yc9Zt6TozyBMthGJRKmAP7JIN4YFUiRxNgIgWTb2uvLbSBLBR+MLC1C8myLw0ZUuXz078z6xUWQ3FQM="}],"size":3254,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-2.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-crypto_2.0.1_1589386861014_0.07596212239342393"},"_hasShrinkwrap":false,"readme":"# hypercore-crypto\n\n> :warning: Hypercore 9 uses v2 of this module while Hypercore 10 uses v3.\n\nThe crypto primitives used in hypercore, extracted into a separate module\n\n```\nnpm install hypercore-crypto\n```\n\n## Usage\n\n``` js\nconst crypto = require('hypercore-crypto')\n\nconst keyPair = crypto.keyPair()\nconsole.log(keyPair) // prints a ed25519 keypair\n```\n\n## API\n\n#### `keyPair = crypto.keyPair()`\n\nReturns an `ED25519` keypair that can used for tree signing.\n\n#### `signature = crypto.sign(message, secretKey)`\n\nSigns a message (buffer).\n\n#### `verified = crypto.verify(message, signature, publicKey)`\n\nVerifies a signature for a message.\n\n#### `hash = crypto.data(data)`\n\nHashes a leaf node in a merkle tree.\n\n#### `hash = crypto.parent(left, right)`\n\nHash a parent node in a merkle tree. `left` and `right` should look like this:\n\n```js\n{\n  index: treeIndex,\n  hash: hashOfThisNode,\n  size: byteSizeOfThisTree\n}\n```\n\n#### `hash = crypto.tree(peaks)`\n\nHashes the merkle root of the tree. `peaks` should be an array of the peaks of the tree and should look like above.\n\n#### `buffer = crypto.randomBytes(size)`\n\nReturns a buffer containing random bytes of size `size`.\n\n#### `hash = crypto.discoveryKey(publicKey)`\n\nReturn a hash derived from a `publicKey` that can used for discovery\nwithout disclosing the public key.\n\n#### `list = crypto.namespace(name, count)`\n\nMake a list of namespaces from a specific publicly known name.\nUse this to namespace capabilities or hashes / signatures across algorithms.\n\n## License\n\nMIT\n","publish_time":1589386861203,"_cnpm_publish_time":1589386861203,"dist-tags":{"latest":"3.7.0"}}