{"name":"hypercore-crypto","version":"3.5.0","description":"The crypto primitives used in hypercore, extracted into a separate module","main":"index.js","dependencies":{"b4a":"^1.6.6","compact-encoding":"^2.15.0","sodium-universal":"^4.0.1"},"devDependencies":{"brittle":"^3.5.0","standard":"^17.1.0"},"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","_id":"hypercore-crypto@3.5.0","gitHead":"08c51c249a24dc688bdc8e4d97540105d37b165e","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-jIhMtPsBfomxruq5TsCl+jhMYsjWBOsSllQy006OFInoRhfIpXpcE28o1wU6qdMRdvzoEIiWmFxJC3SRUmt3WA==","shasum":"01d4706bf49dce3ff98ddf88d401550127daccb4","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-3.5.0.tgz","fileCount":4,"unpackedSize":8119,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC9MvRdUjT6LX634ipbThtvPc32VbjAJjIP0dEtnuS7xQIhAKqvCQ0NXlhyzGi0JymLe2y4LLRhmWCaYe6h/ngDa3Q9"}],"size":3145,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-3.5.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hypercore-crypto_3.5.0_1739455648842_0.6149884874554017"},"_hasShrinkwrap":false,"readme":"# hypercore-crypto\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":1739455649026,"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_cnpm_publish_time":1739455649026,"dist-tags":{"latest":"3.7.0"}}