@copilotkit/license-verifier

中文文档
0.5.0发布于 2026/06/19MITTypeScriptESM + CJS零依赖近 30 天下载 235.9万

CopilotKit license verification

原始使用文档
文档目录4 节
  1. Public API
  2. Organization-entitlement merge
  3. Online Key Attestation
  4. License

@copilotkit/license-verifier

Public runtime package for offline CopilotKit license verification.

Public API

The package exports one root entry point:

import {
  LICENSED_FEATURES,
  addRuntimeKeyAttestation,
  clearRuntimeKeys,
  createLicenseChecker,
  getFeatureDisplayName,
  getFeatureLimit,
  getMasterPublicKey,
  getPublicKey,
  isComponentFeature,
  isFeatureEnabled,
  isRuntimeFeature,
  organizationEntitlementSchema,
  parseOrganizationEntitlement,
  verifyKeyAttestation,
  verifyLicense,
  type EntitlementReader,
  type KeyAttestationData,
  type LicenseChecker,
  type LicenseFeatures,
  type LicenseOwner,
  type LicensePayload,
  type LicenseStatus,
  type LicenseTier,
  type OrganizationEntitlement,
} from "@copilotkit/license-verifier";

verifyLicense(token) parses the signed payload, verifies the Ed25519 signature, checks expiration, and returns a LicenseStatus. Signed payloads may contain extra feature keys so older verifiers can still parse newer tokens structurally; helper reads still deny those unknown keys by default.

Feature reads are catalog-gated. isFeatureEnabled(license, feature) returns true only when feature is a known boolean feature in LICENSED_FEATURES and the signed payload value is exactly true. getFeatureLimit(license, feature) returns a number only when feature is a known numeric feature and the signed payload value is a non-negative integer. Unknown feature keys and value-kind mismatches deny by default.

LICENSED_FEATURES is re-exported from the internal @cpki/license-catalog projection used at build time. The verifier should not define a separate feature catalog.

createLicenseChecker(token?) verifies once, caches the signed payload, and re-evaluates expiration on each getStatus() call. checkFeature(feature) uses the same catalog-gated boolean feature behavior as isFeatureEnabled.

Organization-entitlement merge

createLicenseChecker(token?) returns a LicenseChecker whose withOrganizationEntitlement(org) derives a non-mutating EntitlementReader that merges a parsed OrganizationEntitlement overlay with the deployment base:

  • reader.checkFeature(feature) — boolean OR: granted if the deployment (grace-respecting; expired-but-in-grace contributes nothing) OR the active org grants it. An inactive org, or an active org with an empty features map, contributes nothing.
  • reader.getFeatureLimit(feature) — numeric most-generous: 0 means unlimited and wins over any finite value; otherwise the larger present value wins; null only when neither side is present.

The reader is fresh per call, never mutates the base payload, and never stores overlay state on the checker, so a long-lived multi-tenant process can call it per request with a different org without leaking entitlements. The reader deliberately does not expose getStatus() — use the base checker.getStatus() for deployment diagnostics. Feed withOrganizationEntitlement an already-parseOrganizationEntitlement'd value; overlay values are catalog-gated the same way as the base, so unknown ids and value-kind mismatches are ignored.

Online Key Attestation

The package does not export a network client for online verification. Hosts that fetch signing keys from an online endpoint should validate that response outside this package, then call addRuntimeKeyAttestation({ keyId, publicKey, attestationSig }). The attestation signature must be over keyId:publicKey and signed by the master key baked into the package.

License

MIT — see LICENSE.

版本与发布记录

@copilotkit/license-verifier 共发布 8 个版本,首次发布于 2026/03/27;过去 12 个月发布了 8 个版本。

版本发布日期距今
0.5.0latest2026/06/194 个月前
0.4.22026/05/295 个月前
0.4.12026/05/275 个月前
0.4.02026/05/066 个月前
0.3.02026/05/056 个月前
0.2.02026/04/226 个月前

关于 @copilotkit/license-verifier 的常见问题

@copilotkit/license-verifier 是什么?

CopilotKit license verification

如何安装 @copilotkit/license-verifier?

在项目目录运行 npm install @copilotkit/license-verifier,或使用 pnpm add / yarn add / bun add。

@copilotkit/license-verifier 支持 TypeScript 吗?

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

@copilotkit/license-verifier 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@copilotkit/license-verifier 可以商用吗?

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

@copilotkit/license-verifier 的下载量有多少?

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

@copilotkit/license-verifier 还在维护吗?

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