@freedomofpress/sigstore-browser

中文文档
0.3.1发布于 2026/11/05MITTypeScriptES Module构建来源已验证近 30 天下载 10.7万

A minimal browser-only Sigstore verification library.

原始使用文档
文档目录10 节
  1. Features
  2. Installation
  3. Usage
  4. Basic Verification
  5. Verification Options
  6. What Gets Verified
  7. Development
  8. Related Projects
  9. License
  10. Acknowledgments

Minimal Browser-Compatible Implementation of a Sigstore Verifier

Conformance

A minimal TypeScript implementation of Sigstore verification, optimized for browser compatibility.

This is a browser-compatible alternative to sigstore-js that focuses on verification functionality needed for secure software updates in browser environments.

[!CAUTION] This library has not received an independent security audit. Maintenance is performed by volunteers, and the project is not officially supported or endorsed by the Freedom of the Press Foundation.

Features

  • Full Sigstore Verification: Complete verification of Sigstore bundles including certificate chains, transparency logs, and timestamps
  • Browser-First: Designed for web browsers using the Web Crypto API
  • TUF Integration: Secure trusted root updates via The Update Framework
  • Policy Verification: Flexible identity and claim verification adapted from sigstore-python
  • Multiple Bundle Formats: Supports Sigstore bundle versions 0.2 and 0.3 by default, and 0.1 when enabled
  • Multiple Key Types: RSA, ECDSA, and Ed25519 signature verification via Web Crypto API
  • Minimal Dependencies: Only depends on @freedomofpress/crypto-browser, @freedomofpress/tuf-browser, and @noble/curves

Installation

npm install @freedomofpress/sigstore-browser

Usage

Basic Verification

import { SigstoreVerifier } from '@freedomofpress/sigstore-browser';

// Initialize the verifier
const verifier = new SigstoreVerifier();

// Load the Sigstore trusted root via TUF (recommended)
await verifier.loadSigstoreRootWithTUF();

// Or load a trusted root directly
// await verifier.loadSigstoreRoot(trustedRootJson);

// Verify an artifact
const bundle = JSON.parse(bundleJsonString);
const artifactData = new Uint8Array(/* artifact bytes */);

const verified = await verifier.verifyArtifact(
  '[email protected]',           // Expected signer identity (SAN)
  'https://accounts.google.com',    // Expected OIDC issuer
  bundle,
  artifactData,
  false
);

Verification Options

const verifier = new SigstoreVerifier({
  tlogThreshold: 1,   // Minimum distinct log operators with a fully verified entry (default: 1)
  ctlogThreshold: 1,  // Minimum distinct CT log operators with a verified SCT (default: 1)
  tsaThreshold: 0,    // Minimum distinct TSA operators with a verified timestamp (default: 0)
  bundleVersions: ["0.2", "0.3"], // Accepted bundle versions; add "0.1" for legacy bundles that carry only an inclusion promise (default: ["0.2", "0.3"])
});

Thresholds must be non-negative safe integers. Authorities without operator metadata can satisfy a threshold of one, but never add to the count of named operators. Thresholds above one require that many distinct, explicitly named operators.

When isDigestOnly is true, supply exactly 32 bytes containing the artifact's SHA-256 digest and construct the verifier with verifyDigest: verifySignatureOverDigest from @freedomofpress/crypto-browser/noble. Verifiers that always have the artifact can leave it out, and their bundles do not carry @noble/curves.

What Gets Verified

The verifyArtifact method performs the following checks:

  1. Bundle Validation: Structure, a 16 MiB aggregate encoded-data limit, bounded certificate chains and a supported media type
  2. Identity Verification: Certificate SAN matches the expected identity
  3. Issuer Verification: Certificate OIDC issuer matches the expected issuer
  4. Transparency Log: Every entry from a trusted Rekor log is verified (inclusion promise, Merkle proof, checkpoint, body and logged certificate); the threshold counts distinct log operators
  5. TSA Timestamp Verification: RFC 3161 timestamps (if present); the threshold counts distinct operators
  6. Observer Timestamps: At least one verified integrated time or TSA timestamp must anchor the signature
  7. Certificate Chain: Leaf certificate chains to a Fulcio CA that was trusted at every observer timestamp
  8. SCT Verification: Signed Certificate Timestamps from CT logs; the threshold counts distinct operators
  9. Signature Verification: Artifact signature using the certificate's public key

Use verifyArtifactPolicy(policy, bundle, artifactData, isDigestOnly) to enforce a custom VerificationPolicy, including the required identity and issuer checks. Policies may be synchronous or asynchronous; asynchronous policies are awaited before verification continues.

Development

# Install dependencies
npm install

# Build the project
npm run build

# Run tests (browser environment via Playwright)
npm test

# Lint and format
npm run lint

This library is part of a family of browser-compatible security libraries:

License

Apache License 2.0 - see LICENSE file for details. Portions of this package incorporate code from sigstore-js and sigstore-python.

Acknowledgments

This project is based on the Sigstore specification and adapted from:

版本与发布记录

@freedomofpress/sigstore-browser 共发布 21 个版本,首次发布于 2025/11/27;过去 12 个月发布了 21 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.1latest2026/11/0510 天前
0.3.02026/11/0214 天前
0.2.02026/10/3115 天前
0.1.172026/10/3116 天前
0.1.162026/10/3016 天前
0.1.152026/09/291 个月前

关于 @freedomofpress/sigstore-browser 的常见问题

@freedomofpress/sigstore-browser 是什么?

A minimal browser-only Sigstore verification library.

如何安装 @freedomofpress/sigstore-browser?

在项目目录运行 npm install @freedomofpress/sigstore-browser,或使用 pnpm add / yarn add / bun add。

@freedomofpress/sigstore-browser 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@freedomofpress/sigstore-browser 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@freedomofpress/sigstore-browser 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@freedomofpress/sigstore-browser 可以商用吗?

@freedomofpress/sigstore-browser 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@freedomofpress/sigstore-browser 的下载量有多少?

根据 npm 官方下载统计,@freedomofpress/sigstore-browser 在 2026/10/16 – 2026/11/14 这 30 天内被下载 107,173 次,日均约 3,572 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@freedomofpress/sigstore-browser 还在维护吗?

最新版本 0.3.1 发布于 2026/11/05(10 天前);至今共发布 21 个版本,其中过去 12 个月发布了 21 个;首次发布于 2025/11/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。