3.4.0 • Published 9 months ago

hypercore-crypto v3.4.0

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

hypercore-crypto

:warning: Hypercore 9 uses v2 of this module while Hypercore 10 uses v3.

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-1884@dxos/cli-console@dxos/crypto@dxos/crypto-names@dxos/botkit-client@dxos/botkit-client-deprecated@dxos/cli-chatdropzone-protocol@frando/corestore-multifeed@hdegroote/instrumented-corestore@dazaar/sdkprotobeedatomwarehouserandom-access-corestorerebelwire-corerebelwire-clientsecret-handshake-over-hypercoresimple-hypercore-protocolsimple-rtmp@mapeo/core@lumeweb/rpc-client@p2pcommons/sdk-jswip-corestore@geut/permanent-seeder-core@garbados/pouchdb-cabalhypevaulthypnshyper-tcp-relayhyperdomainshyperdrive-daemonhyperdhthypercore-strong-identifierhypercore-strong-linkhypercore-upload-serverhypercore-xsalsa20-onwrite-hookhypergithypediscordhypehosthypenodehyper-blockchainhyper-ipchyper-ipc-securehyperlibhypernameserver1hypermultifeedhyper-content-dbhyper-nameserverhyper-relayhypercore-multi-keyhypercore-multiparthypercore-protocolhypercorehyperbolic-tunnelhypercore-authenticate-session-extensionhypersource@seandawson/hypermergejoyrider@sammacbeth/dat-api-corekappa-drivekappa-private@trac-network/hypercore@synonymdev/slashtags-core-data@synonymdev/slashtags-sdkmountable-hypertrie@arso-project/sonar-core@arso-project/sonar-dat@arsonar/coreautobaseara-identity-archiver@backbonedao/data-manager@connor-davis/dropzone-protocol@connor-davis/hymachimultifeed-sigridmasq-messaging-protocolcable-clientcabal-corecabal-client@coboxcoop/kappa-drive@coboxcoop/multifeed@coboxcoop/peer-fs@coboxcoop/repository@coboxcoop/cryptobitdhtcfsnetmapeo-web@wirelineio/cli-bot@wirelineio/cli-peer@wirelineio/credentials
3.4.0

9 months ago

3.3.1

1 year ago

3.3.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.0

3 years ago

2.2.0

3 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.0

6 years ago

0.0.0

6 years ago