{"name":"hypercore-crypto","version":"3.6.1","author":{"url":"@mafintosh","name":"Mathias Buus"},"license":"MIT","_id":"hypercore-crypto@3.6.1","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"homepage":"https://github.com/mafintosh/hypercore-crypto","bugs":{"url":"https://github.com/mafintosh/hypercore-crypto/issues"},"dist":{"shasum":"582bc3d4c4e3e6f8adf6b86222c8db73006aadfa","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-3.6.1.tgz","fileCount":4,"integrity":"sha512-ltIz2uDwy9pO/ZGTvqcjzyBkvt6O4cVm4r/nNxh0GFs/RbQtqP/i4wCvLEdmU7ptgtnw7fI67WYD1aHPuv4OVA==","signatures":[{"sig":"MEUCIDIy0zq/OuSkzjYrCS2cInZyUIbIMs4g4yQgx7PCzoTdAiEAgd6xINvafHtRWgPE9JNndFZ8FtMu0r+e8GoLOfdmbLo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8339,"size":3212,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-3.6.1.tgz"},"main":"index.js","gitHead":"fb5ce6da30660db7489940b13940757a6e7f7fee","scripts":{"test":"standard && brittle test.js"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"repository":{"url":"git+https://github.com/mafintosh/hypercore-crypto.git","type":"git"},"_npmVersion":"10.9.0","description":"The crypto primitives used in hypercore, extracted into a separate module","directories":{},"_nodeVersion":"22.12.0","dependencies":{"b4a":"^1.6.6","compact-encoding":"^2.15.0","sodium-universal":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.5.0","standard":"^17.1.0"},"_npmOperationalInternal":{"tmp":"tmp/hypercore-crypto_3.6.1_1747920330125_0.548428228099678","host":"s3://npm-registry-packages-npm-production"},"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 be 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":1747920330296,"_cnpm_publish_time":1747920330296,"dist-tags":{"latest":"3.7.0"}}