🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

hypercore-strong-identifier

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-strong-identifier

Generate a strong link to a hypercore seq that contains a root hash of the merkle tree at that time

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

hypercore-strong-identifier

Generate a "strong" link to a hypercore seq that contains a root hash of the merkle tree at that time.

npm install hypercore-strong-identifier

Usage

const strongIdentifier = require('hypercore-strong-identifier')

strongIdentifier.generate(someFeed, 42, function (err, link) {
  if (err) throw err
  console.log(link) // {feed: someFeed.key, seq: 42, treeHash: <buf>}
  strongIdentifier.verify(someFeed, link, function (err, data) {
    // returns an error the feed key doesn't match
    // or if the merkle tree hash is different
    if (err) throw err
    // otherwise the data at the seq is returned
    console.log(data)
  })
})

API

strongIdentifier.generate(feed, seq, cb)

Generate a strong identifier. Returns an object that looks like this:

{
  feed: <the-feed-key>,
  seq: <seq passed in>,
  treeHash: <the root hash of the merkle tree at seq>
}

Verifies a strong link and returns the data at the seq if it validates.

License

MIT

FAQs

Package last updated on 09 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts