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 🙏

© 2026 – Pkg Stats / Ryan Hefner

trust-log

v1.2.0

Published

add and revoke trust over time

Downloads

19

Readme

trust-log

add and revoke trust over time

Stores trust events in a log so that sources of trust can evolve fluidly with a project. For example, you might add a key when you get a new laptop and revoke that key if your laptop is lost or stolen, but other people can still verify the old releases signed by the previous key.

example

generate a key and store it in the db:

var trust = require('trust-log');
var level = require('level')
var sodium = require('sodium').api
var minimist = require('minimist')
var argv = minimist(process.argv.slice(2))

var keypair = sodium.crypto_sign_keypair()
var value = {
  secretKey: keypair.secretKey.toString('hex'),
  publicKey: keypair.publicKey.toString('hex')
}

var db = level(argv.d, { valueEncoding: 'json' })
db.put('key', value, function (err) {
  if (err) console.error(err)
})

add another trusted key:

var trust = require('trust-log');
var level = require('level')
var sodium = require('sodium')
var hsodium = require('hyperlog-sodium')

var minimist = require('minimist')
var argv = minimist(process.argv.slice(2))

var db = level(argv.d, { valueEncoding: 'json' })
db.get('key', function (err, value) {
  var keypair = {
    secretKey: Buffer(value.secretKey, 'hex'),
    publicKey: Buffer(value.publicKey, 'hex')
  }
  var log = trust(db, hsodium(sodium, keypair, {
    publicKey: function (id, cb) { log.isTrusted(id, cb) }
  }))
  log.trust(argv._[0], function (err) {
    if (err) console.error(err)
  })
})

methods

var trust = require('trust-log')

var log = trust(db, opts)

Create a new trusted log with a levelup handle db and:

  • opts.identity - the public key of the current node
  • opts.sign - a signing function for the desired crypto
  • opts.verify - a verification function for the desired crypto

Optionally set opts.tofu to true to set "trust on first use" mode. This mode trusts the first replicated key during replication if the log is empty.

If opts.identity is not provided, trust will be written into a secondary location that is not signed. This is useful for relay servers that have no identity of their own but need to trust other keys.

Using sodium you can do:

var hsodium = require('hyperlog-sodium')
var sodium = require('sodium')
var opts = hsodium(sodium, keypair)

to generate the appropriate opts for a sodium keypair.

log.trust(id, cb)

Add trust for an identity/publicKey id.

log.revoke(id, cb)

Revoke trust for an identity/publicKey id.

log.trusted(from=null, cb)

Obtain a list of trusted nodes at from point in history or the most recent when null as cb(err, ids) for an array of ids.

log.isTrusted(from=null, id, cb)

Compute whether the identity/publicKey id is trusted at from as cb(err, ok).

log.verify(from=null, node, cb)

Compute whether a hyperlog node is correctly signed with an identity trusted at from as cb(err, ok).

var r = log.replicate(opts)

Return a full-duplex replication stream r for the underlying hyperlog. opts are passed through to hyperlog's replicate() after the indexes have caught up.

install

With npm do:

npm install trust-log

thanks

Thanks to blockai for sponsoring this project.

license

MIT