@gainratio/avow

中文文档
0.5.3发布于 2026/10/03MITTypeScriptES Module构建来源已验证近 30 天下载 4033

Avow signs a JSON record into a receipt, a file anyone can check offline to confirm the record is unchanged and who signed it.

原始使用文档

Avow for TypeScript

TL;DR

Avow creates signed, tamper-evident records. Give it any JSON evidence; it returns a receipt that another machine can verify offline.

This is the 0.5.3 release of @gainratio/avow. It verifies receipts sealed by @edgeproc/avow 0.4.x and older again, which 0.5.0–0.5.2 wrongly refused. 0.5.2 was the first under the @gainratio scope; @edgeproc/avow 0.5.1 and older stay installable but are deprecated. 0.5.0 was the first built from this repository.

Usage

import {
  generateSeedHex,
  publicKeyHex,
  signPayload,
  verifySignature,
} from "@gainratio/avow";

const signingSeed = generateSeedHex();
const pinnedPublicKey = await publicKeyHex(signingSeed);
const receipt = await signPayload({ artifact: "sha256:abc" }, signingSeed);
await verifySignature(receipt, pinnedPublicKey);

The example derives the public key before the receipt exists. In a real verifier, obtain pinnedPublicKey independently through a trusted configuration or distribution channel—never from receipt.public_key. Every emitted receipt has schema avow.receipt/v1. Receipts sealed by @edgeproc/avow 0.4.x and older have no schema key and still verify; a schema that is present must be exactly avow.receipt/v1.

Verification proves that the payload is unchanged and was signed by the caller-pinned key. It does not prove correctness, freshness, wall-clock time, or the honesty of the signer.

Not a replay defence: a valid receipt verifies identically every time it is presented. Callers needing replay protection sign their own nonce, audience, and expiry claims into the payload and check them after verifySignature; the repository's docs/OPERATIONS.md ("Replay protection is caller-owned") has the recipe.

The signing seed is unencrypted hex held by the caller. This package never reads key files, so seed storage is the integrating application's responsibility; there is no KMS/HSM seam. The Python package's file-mode check (avow.key_permissions_insecure, raised by load_signing_key for a group- or other-accessible key file) has no TypeScript counterpart because no TypeScript API loads a key from disk.

版本与发布记录

@gainratio/avow 共发布 4 个版本,首次发布于 2026/10/02;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.5.3latest2026/10/031 个月前
0.5.22026/10/031 个月前
0.0.0-bootstrap.0bootstrap2026/10/021 个月前
0.0.0-stage2026/10/021 个月前

关于 @gainratio/avow 的常见问题

@gainratio/avow 是什么?

Avow signs a JSON record into a receipt, a file anyone can check offline to confirm the record is unchanged and who signed it.

如何安装 @gainratio/avow?

在项目目录运行 npm install @gainratio/avow,或使用 pnpm add / yarn add / bun add。

@gainratio/avow 支持 TypeScript 吗?

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

@gainratio/avow 支持 ESM 还是 CommonJS?

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

@gainratio/avow 需要什么版本的 Node.js?

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

@gainratio/avow 可以商用吗?

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

@gainratio/avow 的下载量有多少?

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

@gainratio/avow 还在维护吗?

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