3.5.0 • Published 4 months ago

hypercore-crypto v3.5.0

Weekly downloads
1,273
License
MIT
Repository
github
Last release
4 months ago

hypercore-crypto

The crypto primitives used in hypercore, extracted into a separate module

npm install hypercore-crypto

Usage

const crypto = require('hypercore-crypto')

const keyPair = crypto.keyPair()
console.log(keyPair) // prints a ed25519 keypair

API

keyPair = crypto.keyPair()

Returns an ED25519 keypair that can used for tree signing.

signature = crypto.sign(message, secretKey)

Signs a message (buffer).

verified = crypto.verify(message, signature, publicKey)

Verifies a signature for a message.

hash = crypto.data(data)

Hashes a leaf node in a merkle tree.

hash = crypto.parent(left, right)

Hash a parent node in a merkle tree. left and right should look like this:

{
  index: treeIndex,
  hash: hashOfThisNode,
  size: byteSizeOfThisTree
}

hash = crypto.tree(peaks)

Hashes the merkle root of the tree. peaks should be an array of the peaks of the tree and should look like above.

buffer = crypto.randomBytes(size)

Returns a buffer containing random bytes of size size.

hash = crypto.discoveryKey(publicKey)

Return a hash derived from a publicKey that can used for discovery without disclosing the public key.

list = crypto.namespace(name, count)

Make a list of namespaces from a specific publicly known name. Use this to namespace capabilities or hashes / signatures across algorithms.

License

MIT

@screamingvoid/crypto@dxos/echodb@dxos/game-cli@dxos/xbox-cli@dxos/peer-cli@dxos/cli-peer@dxos/cli-xbox@dxos/dashboard-cli@dxos/cli-dashboard@dxos/app-cli@dxos/bot-cli@infinitebrahmanuniverse/nolb-hyperc@everything-registry/sub-chunk-1884symmetry-corewip-corestore@coboxcoop/crypto@coboxcoop/kappa-drive@coboxcoop/multifeed@coboxcoop/peer-fs@coboxcoop/repository@comapeo/core@connor-davis/dropzone-protocol@connor-davis/hymachijoyriderkappa-drivekappa-privatelog-fetch@arso-project/sonar-core@arso-project/sonar-dat@arsonar/core@andrewosh/corestore-migration@backbonedao/data-manager@dazaar/sdk@dxos/crypto-names@dxos/cli-chat@dxos/cli-console@dxos/botkit-client@dxos/botkit-client-deprecated@dxos/crypto@hdegroote/instrumented-corestore@frando/corestore-multifeed@garbados/pouchdb-cabal@geut/permanent-seeder-core@lumeweb/rpc-client@mapeo/core@hyperswarm/dht@hyperswarm/secret-stream@hyperspace/hyperdrive@hyperdivision/heimdall@hypercortex/hypertask-cli@hypercortex/wrapper@hypercortex/hyperpin-cli@pqmcgill/dat-js@pqmcgill/dat-js-hyperdb@sammacbeth/dat-api-core@p2pcommons/sdk-js@spacesprotocol/fabric@seandawson/hypermergemultifeed-sigridmountable-hypertriemerkle-collabmirrordbp2p-authoffgrid-clipeermqpear-radio-backendpeardeckpeardeckterminalpeardrive-core-alphapaperslippassive-core-watchersecret-handshake-over-hypercoreserve-driveprotomux-wakeupprotobeenot-secret-streampeer-pass-backendreplication-simulatorrandom-access-corestorerebelwire-clientrebelwire-coresimple-hypercore-protocolsimple-rtmphypercorehypercore-audithypercore-authenticate-session-extensionhypercore-blob-serverhypercore-storagehypercore-strong-identifierhypercore-strong-linkhypercore-upload-serverhypercore-xsalsa20-onwrite-hookhypercoreifyhypercore-multi-keyhypercore-multiparthypercore-protocolhyper-nameserverhyper-relayhyperbolic-tunnelhyper-content-db
3.5.0

4 months ago

3.4.2

1 year ago

3.4.1

1 year ago

3.4.0

2 years ago

3.3.1

2 years ago

3.3.0

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

7 years ago

0.0.0

7 years ago