{"name":"hypercore-crypto","version":"2.1.0","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":"3f30a14c496561c567ef7beacdebf45cd693312a","_id":"hypercore-crypto@2.1.0","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-zFwn1vBLUTABZoy9pYJBXYVHRuKSGO5qj1K2rLnEou8zuI9MG73e9hi31PsH4r0oTKMYnhricknTcon+xhW1EA==","shasum":"8270002eb12b6b1ee11a59f6382a677179ba1323","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-2.1.0.tgz","fileCount":6,"unpackedSize":8936,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJewFGPCRA9TVsSAnZWagAAMBIQAJ5tEFffIlgKMsakZgDg\n4LF2ZLTCxdT0o8/AJ1tidn1/BE6SHfi6qS68qWFORHEp5zzq2dlJtNrWym+5\nJhjuHXXph8PprQqC9rHo9xvBRX1x4dZ1xcVSId4UjFxeWu7+KAOKnNLCJAi0\nfMRO5eism+KYbRlAtW8Pe9I2FlDdfclO7uqKhuyJCHraI3IukIU4M9Q3dI+f\n1B/kfjR2yd3z3fvbUyY1ePpDZW3wY9rIWupxwz3samzf3XidQglrT84MMq1E\nDutUyk2rxONzLyEwtRnfTQPdqAg4s6YuvHTsMBid2Y+CCj18D5Da3//FC45t\nnMF7dSW75ZMV8PSg8aGqDXCVxDswAg5pxhzGJVwwtrM2r8e8nGStSnNzv15G\n4y+Z4Cw6/JjngcJME7bc71Q3OFSr7b3akjpICc58LIV1SejGBfYGApPmbVFO\n6Fww0yVKo3Cz5WxUXbedZ9AQTzKAzPW9sCUy8cvIusC7K5XqsxmNWySUutI5\nvmuSrHpQM2YYj5NQARpf09JROSsX75E5PJXN0bFRcn8ry/8+Qbz6JvWpD3iK\nwUm/dpZ2xUCxNcgL/FTRd511Aw89ZF26R4EA2Tqa6gO+otwkVzYPAjDPDPIz\n6IGD59whpVG9yPaIuUDolWVE/uqAOKU4ImUKFl3j+RCITyFgdnBj+ugKMe1s\nb2LZ\r\n=K3qJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAI4KklD+MZAg7ZUuEPuOI48k7Dpm0EFRunAPQWKrTlJAiEA91IbE+e5f1P5zvQDoRXvWlyoxWhpcqyY2k23AHEJrg8="}],"size":3299,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-2.1.0.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.1.0_1589662094989_0.10813684934057921"},"_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":1589662095087,"_cnpm_publish_time":1589662095087,"dist-tags":{"latest":"3.7.0"}}