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

sphior-verify

v0.2.0

Published

SPHIOR 非依存で Evidence Pack を独立検証する CLI/ライブラリ。record 完全性(canonical 封筒の再ハッシュ)と RFC6962 Merkle 包含を、Node 標準暗号のみ(外部依存ゼロ)で検証する。外部アンカー(OpenTimestamps / RFC3161)は標準ツールで検証するためのファイルとコマンドを出力する。

Readme

sphior-verify

SPHIOR を一切信用せずに、SPHIOR が発行した Evidence Pack が改竄されていないことを独立検証する CLI / ライブラリ。

外部依存はゼロ(Node 標準の node:crypto のみ)。監査人・顧客・第三者は、このツールと標準ツール(OpenTimestamps クライアント / OpenSSL)だけで、SPHIOR のサーバに一切接続することなく検証できます。


何を証明するのか

Evidence Pack 1 件は「ある技術的事実(例: 診断で検出された事象)を記録した不変封筒」です。sphior-verify は次の 2 つの暗号学的束縛 を、標準プリミティブ(SHA-256 / RFC6962 Merkle)だけで再現・照合します。

  1. record 完全性 — SHA-256(envelope_json) == record_hash 保存された封筒のバイト列を再ハッシュし、記録されたハッシュに一致するかを確かめる。1 ビットでも改竄されれば一致しない。
  2. Merkle 包含 — record_hash + inclusion proof → epoch root_hash その記録が、外部にアンカーされた epoch の Merkle ツリー(RFC6962)に確かに含まれることを確かめる。

補助として canonical 形の確認(envelope_json が RFC8785 JCS 正規形か)も行い、ハッシュが一意に再現可能であることを保証します。

「時刻」と「公開アンカー」は誰が保証するのか

epoch root が いつ存在したか は、sphior-verify では検証しません(意図的)。これは SPHIOR に依存しない標準の外部アンカーを、監査人自身が標準ツールで検証します。--emit がそのための成果物を書き出します。

  • OpenTimestamps(Bitcoin 公開アンカー・全 tier)
    ots verify root.bin
  • RFC3161 署名タイムスタンプ(qualified tier)
    openssl ts -verify -digest <root_hex> -in root.tsr -CAfile <TSA の CA 証明書>

「SPHIOR が『検証した』と主張する」よりも、あなたが自分で数学と公開アンカーを再計算する方が強い。それがこのツールの存在理由です。


インストール / 実行

Node.js 18 以上。インストール不要で実行できます。

# パックを検証
npx sphior-verify pack.json

# 外部アンカー検証用の成果物も書き出す
npx sphior-verify pack.json --emit ./out

# 機械可読 JSON
npx sphior-verify pack.json --json

pack.json は SPHIOR の Evidence Pack API(GET .../evidence/pack)が返す JSON をそのまま保存したものです。

終了コード

  • 0 — record 完全性 + Merkle 包含ともに一致(改竄なし)
  • 1 — いずれかが不一致(検証失敗)
  • 2 — 入力エラー(ファイル不正など)

完全な独立検証の手順(監査人向け)

# 1. record 完全性 + Merkle 包含(このツール・SPHIOR 非依存)
npx sphior-verify pack.json --emit ./out

# 2. 公開ブロックチェーンアンカー(OpenTimestamps クライアント)
cd out && ots verify root.bin

# 3. 署名タイムスタンプ(OpenSSL・qualified tier のみ)
#    TSA の CA 証明書は pack の tsa_url が示す機関から入手
openssl ts -verify -digest <pack の root_hash> -in root.tsr -CAfile tsa-ca.pem

3 つすべてが通れば、「この記録は改竄されておらず、記録された時刻に、公開/署名アンカー済みの root のツリーに含まれていた」ことを、SPHIOR を信用せずに確認したことになります。


Pack の形式

{
  "envelope_json": "…canonical(RFC8785 JCS)な封筒文字列…",
  "record_hash": "<hex>",
  "merkle": {
    "leaf_index": 0,
    "proof": [{ "hash": "<hex>", "position": "left|right" }],
    "root_hash": "<hex>",
    "tree_size": 1
  },
  "epoch": { "epoch_id": "…", "tier": "base|qualified" },
  "anchors": [
    { "anchor_type": "opentimestamps", "status": "pending|confirmed", "ots_b64": "…" },
    { "anchor_type": "rfc3161", "status": "confirmed", "gen_time": "…", "token_b64": "…", "tsa_url": "…" }
  ]
}

設計上の約束

  • 外部依存ゼロ — サプライチェーン経由の改竄面を最小化。監査人がコードを丸ごと読める規模。
  • オフライン — SPHIOR のサーバに接続しない。ネットワークが必要なのは外部アンカー検証(ots / TSA CA 入手)のみ。
  • 標準準拠 — SHA-256 / RFC6962(Merkle)/ RFC8785(JCS)/ RFC3161(TSA)/ OpenTimestamps。独自形式なし。

ライセンス

Apache-2.0

期間パック(0.2.0+)

SPHIOR の検証センターからダウンロードした期間パック(records[] 同梱)はそのまま全件検証できます:

npx sphior-verify sphior-verification-pack_2026-07-01_2026-07-26.json --emit out/
  • 全 record をループ検証し、一致 / 不一致 / エポック封緘待ち を区別して集計します
  • --emit はエポック(root)ごとに root-<hex8>.bin(+ .ots / .tsr)を書き出します
  • 終了コード: 不一致が 1 件でもあれば 1、なければ 0