{"name":"hypercore-crypto","version":"2.2.0","description":"The crypto primitives used in hypercore, extracted into a separate module","main":"index.js","dependencies":{"sodium-universal":"^3.0.0","uint64be":"^3.0.0"},"devDependencies":{"standard":"^14.3.3","tape":"^5.0.0"},"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":"608ec5b4d0a661575c3cb37a69c13d8f79d3e4ac","_id":"hypercore-crypto@2.2.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-YawYfsZl0RfKByNwir3ToNeGfKL4KVgEEQ/E/ZVLvYby+ayQ9wmNtqZlyW63YY9vdZ1d0i8WuYZnHb3H3z8qOQ==","shasum":"2789cd83f31469582ee4702d0767462c8a4617ed","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-2.2.0.tgz","fileCount":5,"unpackedSize":9491,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfz0A9CRA9TVsSAnZWagAAKjwP/jQDzqhvNfwUTS0mJTpg\nioNGwRxpUyLxN2n4hT/Uo5v3BMKuSHpvbrbYa5bVB94QKqdt9Az3toprXLyc\naxT8l642W1kb1NwIKV07TpzPcNXltq9/+htRantnDdF+f5ZjWooIHOokrmlZ\n30kXj9oaEHEcg37xhK50GF8U7SvSH4x4XoFYyzzKd9UZGf/WtoHjrQCoLp3s\nY2cELIaKpyWgQyok87SUs3UTctx8y1ad0LwvaoqdT2X62N0qAijoRqFSGB4Z\nWTImnAuNn59uJM598ntHXKqfnZr5jexStyldPycDb/Pb5sCVMOtVfhC608My\nil/Tmj0QM/dzOdc6VK5ia4QzgYwu1B/7P/UxsPFuH/1r+KtqmrZui6vB5MEj\nomujRue+3OQjAff4wxLbRBD+fo+aYZnvfw+CBha2ogVjQOEdPSGQocw0M+rO\npOmuynWCrMhyYi6h8nQJ3KoLXyi0kTzwtcqAwYa6nBHWLDBOUtg/r3YWI/yj\nffu3MVI4LnUB/5y/PNlIzBQkQmGt+R082IN9uwbSI0jTqYhbueIchnXk+p2m\ns5VWlFs2dniBpkCXP8RqDv3b2rAX1sUcNYoJpLZJ6+2JJouboyHK4taHSyG4\nxrJLcUq6K6WXOC43rjSJUTn1m6+f+jIRwS2k3vwEpozPoS1MuZIiX1mc6uBL\nlBu1\r\n=ZLrN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB0MtW3KksClWDuNPWQngNveP2ChvgxSyS1fXP7L6bB3AiBF/CPXzAgAKjQaGvWeDUxJw6rTVMbLz/6sUmgf3VryTg=="}],"size":3301,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-2.2.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-crypto_2.2.0_1607417917242_0.36019266954437024"},"_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":1607417917411,"_cnpm_publish_time":1607417917411,"dist-tags":{"latest":"3.7.0"}}