{"name":"hypercore-crypto","version":"3.1.1","description":"The crypto primitives used in hypercore, extracted into a separate module","main":"index.js","dependencies":{"b4a":"^1.1.0","compact-encoding":"^2.5.1","sodium-universal":"^3.0.0"},"devDependencies":{"brittle":"^1.6.0","standard":"^14.3.3"},"scripts":{"test":"standard && brittle 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":"7f23bc7e915d36e3a5eae65c155d0e981b7ca12c","_id":"hypercore-crypto@3.1.1","_nodeVersion":"16.8.0","_npmVersion":"6.14.15","dist":{"integrity":"sha512-FobsSSxNnFyTlRMVEZJ1JO1Vi1OTpa3KH73hvrdW5X89jlWi9c78x3wZW46cSYGxHaTxMOz9meImrBystogVQA==","shasum":"3404463cf0eaa1e9fe8643534774f6ab68afb027","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-3.1.1.tgz","fileCount":6,"unpackedSize":8037,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhnNIqCRA9TVsSAnZWagAA8jEP/ihghUjoWApMR9PvlUQd\n9H1dkNSN8TEP0zI/cxX/E7c5Xxa3/hOckF/5hC2MQMLbVIo96tqCNUBD8aoK\nf79OApemQp/kSw+JFXkOFQ+N9gF00f4IyOmEvHopidSB6lNFY5K917A+fmyc\n6AIFEA3npEU6I8UYIJspI0UpLvVjMGRPkopqAmaUtS1h0ml7NCizfdCBLt0l\nh11+Zy2zQx4UxstssQJGFuVO1ejNEUfGU9Pg17JCtAleIeE3s3OQ6tBqxRM8\n/eV1GdvF29/hpLoYxEhMusBFGgXNw8dUrTchHYlQWJ++KKXXk2ZBs8IxNOgJ\n1/VmhGJTaMW5kM2Gx3FgFecZDV9MxrdgpyIFLwc0MfT9pvItuaDUdQnP11n3\ndx7T/Ffs6BSx/dA7l1dMz6eem3qiLbRi+u5zM1BmU7IYd1nHo7MNoUh9EqbD\nwNY2HaCBQavfrCDllMKZOJ+O6PysLicWhCkG8VtQrc+wCiGUwAAOj96kxx40\n9bvC2zN5K9p9VMKqzeZAMH6GGAMW2o9fLs1q7TQXddXZl1CSWJTy9kbcG/jv\n1/zBAwXjXD8Yvmw6+SwAe7YQGwsWz58U2jFT1VlfdtoseEWMkAUXuxRUY6PJ\nxJ3hJr2J2Fkagc/JHirdfuYzAeuz59cjHX+4mVXraP/ydRnGjONfSbKm3K86\nsarq\r\n=yQi3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChLNf7Cqygc7Kygeq7xRbhd76dR9LwcN/2k8XqB2aGtAiEAyU5IZC+l29sJPD8KSF7n8ZMT5IVotxdjcW6BZP0gNG0="}],"size":3264,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-3.1.1.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-crypto_3.1.1_1637667370319_0.5076456766143664"},"_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":1637667370451,"_cnpm_publish_time":1637667370451,"dist-tags":{"latest":"3.7.0"}}