{"name":"hypercore-crypto","version":"3.6.0","author":{"url":"@mafintosh","name":"Mathias Buus"},"license":"MIT","_id":"hypercore-crypto@3.6.0","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":"6986cc4038339c4402282bbdf33a4fe2dea98db7","tarball":"http://registry-npm.ywwl.com/hypercore-crypto/download/hypercore-crypto-3.6.0.tgz","fileCount":4,"integrity":"sha512-0slkW1wzq4B95SD8Z5nt1Yf/3KrIcGsBWTJTsCjHzMXie+sZ5I2IkWcxX1mo4+c0xVESnKAKphKSpGf2kf2BGA==","signatures":[{"sig":"MEUCIQDk7NsSI+QD+yoXlEcahdFKxGeYfOEjePvTSMPNhxiGmgIgQwM7Ux9xqw7O7djEZ3uwZcIebDzqC3ZvOd7L9TAMhX4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8119,"size":3144,"noattachment":false,"key":"/hypercore-crypto/-/hypercore-crypto-3.6.0.tgz"},"main":"index.js","gitHead":"6590e97f402b157ce41144f8047b5c6bf56d69e5","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.0_1744483582257_0.04525712707588658","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":1744483582427,"_cnpm_publish_time":1744483582427,"dist-tags":{"latest":"3.7.0"}}