1.2.0 • Published 5 years ago

tree-of-trust v1.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

tree-of-trust

NPM version

This is a reputation graph (trust graph, web of trust, etc) system for flextags. It could perhaps be more abstracted from them to be more clearer, but it's not there yet.

const {Tree} = require('tree-of-trust')
const opener = require('live-source')
const delay = require('delay')

const rootURL = 'https://www.w3.org/People/Sandro/tree-of-trust/alice'
const tree = new Tree({ rootURL, opener })

// We combine the delay of getting the data into generally assuming
// the data might change. There's no "crawl complete" because the web
// is never static, right?  Still we should have a crawl complete, but
// don't yet.
delay(2000).then(() => {
  const danyURL = 'https://www.w3.org/People/Sandro/tree-of-trust/dany'
  const dany = opener.open(danyURL)
  console.log(dany.trust)
  // => 0.512
  console.log(tree.accepted.has(dany))
  // => true
  opener.closeAll()
})