npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iota-proof-tool

v1.1.2

Published

IOTA Signature command line tool

Downloads

8

Readme

Documentation for iota-proof-tool

iota-proof-tool its a small library and a command line tool that wraps commons functionalities that someone needs for building Proof of Existence kind of apps, this library have been used in this Proof of existence Poc.

API

The Library exports a couple of few APIs listed below:

  • publish(bundle, callBack)
  • async fetch(bundle)
  • async function verify(bundle, isBinaryInput, docpath, callBack)
  • [Optional] hash(agnosticData, isBinaryInput)

Bundle's properties

  {
  provider,
  data,
  seed,
  address,
  minWeightMagnitude,
  depth
  }

When using the CMD these bundles properties defaults to :

const dSeed = 'HEQLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORL9D'
const dAddress = 'MRDVKCDQAPYQOJEQTUWDMNYZKDUDBRNHJWV9VTKTCUUYQICLPFBETMYYVKEPFCXZE9EJZHFUWJZVEWUCWSGDUVMOYD'
const dProvider = 'https://altnodes.devnet.iota.org'
const dDepth = 3
const dMinWeightMagnitude = 14 // 9 for devenets

Sample codes

import { verify, hash, publish } from 'iota-proof-tool'
// ...
// Publishing to Tangle and putting the result to Clipboard
    publish({
      provider,
      data,
      address,
      seed,
      depth,
      minWeightMagnitude
    }, (retArr) => {
       alert(`TX Hash=${retArr[0].hash}`)
    })
//...

// Verifying if the file matches the previous signed one then reflecting the result into a React state

  const verified = await verify(bundle, true, file)
  this.setState({ isLoading: false, docMutated: verified })

Command line tool

All the functions are available via command line tool - very useful for quick testing and instant Tangle interaction. Here a quick demo:

Hashing the document is a necessary step but not necessarily done via this lib, however we highly recomend using it since it has been designed for easy usage/intergation with other functions:

> iotatool hash /home/myContract.doc
afeea52aa284ffa2110f2feaa67fffff2

Please note when using this in web you have to use the -b flag to mark it as Binary data, otherwise it will be treated as path!

Then we need to make this "safe" by publishing it to Tangle

> iotatool publish afeea52aa284ffa2110f2feaa67fffff2
TX Hash: OIC9B9TZEU9DTAPJ9XOJCQLIFLDRYANONPYWJI9VG9MMLFRKMIOENPSMNICJIQNKFMTQIMSSGOOJIH999

For simplicity, we have used all the defaults parameters but we could also use all of these flags if we wanted too:

  • -p, --provider [provider]
  • -s, --seed [seed]
  • -a, --address [address]
  • -m, --magnitude [magnitude]
  • -d, --depth [depth]

That is all what we can do with signing documents, in the next section we are going to fetch data from the Tangle.

> iotatool fetch OIC9B9TZEU9DTAPJ9XOJCQLIFLDRYANONPYWJI9VG9MMLFRKMIOENPSMNICJIQNKFMTQIMSSGOOJIH999
tx value = afeea52aa284ffa2110f2feaa67fffff2

Again, here we have omitted all bundle parameters thus using default ones. Using the same default parameters, we were able to retrieve the exact data that was stored in the Tangle, now we could just calculate the file hash and compare it with this Hash to say whether the document has been changed or not.

Even more easier we could also use a direct Command that does that for us verify fn :

> iotatool verify /home/myContract.doc
true

true means the document is same as original and no one has potentially tempted with!

That is it for now, we have covered the basic of Proof of existance using Tangle as a source of truth.