{"name":"hypercore-crypto","version":"2.0.2","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":"7449a3a62c383f2e753806cca7a86b934c1922e8","_id":"hypercore-crypto@2.0.2","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-sCxubuIEjKoFInU3ZE1k3M6wP5uIUT7WZPWkIRBjwQI1L4P3MLISO0tb1imWs0Gwd7siWutgn/yAky75Co99XA==","shasum":"4af225622075d34fa7611f0c3cf866d7b1c82e84","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-2.0.2.tgz","fileCount":6,"unpackedSize":8766,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevEO6CRA9TVsSAnZWagAAResP/3wga16yml1KW3yV274x\nPURZOiBS5GZDSohZ2RgAq1Hq2hrZnY6W3dAS6oyzW0a7HCgfxvM5+Ymq/LjQ\naCpWp6O1Lfb33MmM8Slu6ZErJi0dh8kfnawU345Da4Tr2IP6dVBwkrQUQ6/O\nfheP3Dn819Ug7JR/8Go0dCOnwpASCb0hvZJX+u+FzgHsWqY8pGrO+SWGuim+\nQ1W8HGI372ITV3+kNozMQJamiytbRkath6YIW8ow2DsvpmX0JOYq13CQEKjD\nrbvZB2wnigcJ5DaFnfcBGU+v3+2MYRMKcEF3EGwtjUiosTyxPV+amypV2ZM7\nIDF0wkjstA2uk+/JNTr3UL4GiFJsE22PFGmNTQev3sFjzDDmnszZaKWCUa9/\nDl9uacfvkJwU3P2Q8XP64bkhvuhmUb7oZ6yGp72SNta7Us9QsO1+/NNKJOzS\nNwvwUpK5VRxddFWi23z1ppupzl9yjZ1e2zit69Kl873wB0h6NQOZ0e4LVDA0\n5tL8yRsNeKKQp3G0+o+GViss+zknN9Xgd2h8rUh9cbpjolO413/gX0ZCR+Yn\nhQvdvGFYlIgUEVtj80FiVaJVnIHh+VHP5tbaYddLTBL4eWumPV0Hi65LQ22o\nO9P6AQMKi9s+kcEe1BJtsTqgPWe8y+W3Q+zOWfsaNiFeR0QUpJiTlT2PYbWK\nL+Jd\r\n=YF7l\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEonQW7YJ5CI5PQXdadSuwtcf/E5Z/QUQGxvfS5zDKdfAiBq2WvqE1UDWRANt0fr38XfDqdKF+ndh2bJGFnbPq3YDA=="}],"size":3253,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-2.0.2.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.2_1589396410322_0.14406275976559435"},"_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":1589396410403,"_cnpm_publish_time":1589396410403,"dist-tags":{"latest":"3.7.0"}}