@exodus/key-challenge

中文文档
1.0.1发布于 2026/10/14MITTypeScriptES Module零依赖近 30 天下载 1.2万

Challenge envelope for proving control of a key, shared by the verifier and the prover

原始使用文档
文档目录3 节
  1. Envelope
  2. Use
  3. What this package does not do

@exodus/key-challenge

The challenge envelope used to prove control of a key. The verifier and the prover both build the same bytes, so this package is the one place the layout is defined.

Envelope

exodus/challenge/v1:{"verifier":…,"purpose":…,"challenge":…}

The exodus/challenge/v1 namespace is fixed by this package and versioned with it. It sits outside the JSON body, so the plaintext is not itself valid JSON and nothing another protocol produces as JSON can collide with it. The nonce is what makes a challenge unguessable; every other field is a constant a caller could produce without holding any key.

verifier names the service that issued the challenge and purpose names the operation within it. Which key is being proven is not part of the envelope: the verifier already knows it, because it sealed to that key or is checking a signature from it, so repeating it inside the bytes adds nothing.

Use

A verifier that seals to an encryption key, or issues a nonce for a signing key, builds the payload:

import { serializeChallenge } from '@exodus/key-challenge'

const plaintext = serializeChallenge({
  verifier: 'exodus-pay',
  purpose: 'fusion-key-ownership',
  challenge: nonce,
})

A prover that receives a payload asserts it before reading the nonce:

import { parseChallenge } from '@exodus/key-challenge'

const nonce = parseChallenge({
  plaintext,
  verifier: 'exodus-pay',
  purpose: 'fusion-key-ownership',
})

parseChallenge compares an ordered literal rather than parsing and comparing fields. JSON.parse resolves a duplicated key to its last occurrence while a prefix pins the first, so parse-and-compare would accept a payload whose first purpose is wrong. Only the nonce is read from the parse.

A prover that already knows the nonce — because the verifier issued it in the clear for it to sign — builds the same payload with serializeChallenge instead. It must never sign bytes the verifier supplied, or it becomes a signing oracle for whatever those bytes were.

Fields may be appended after challenge without a prover release. Nothing may be inserted before it.

What this package does not do

No key material, no crypto, no storage. Generating the nonce, sealing or signing, and remembering what was issued belong to the verifier.

版本与发布记录

@exodus/key-challenge 共发布 2 个版本,首次发布于 2026/09/18;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.0.1latest2026/10/141 个月前
1.0.02026/09/181 个月前

关于 @exodus/key-challenge 的常见问题

@exodus/key-challenge 是什么?

Challenge envelope for proving control of a key, shared by the verifier and the prover

如何安装 @exodus/key-challenge?

在项目目录运行 npm install @exodus/key-challenge,或使用 pnpm add / yarn add / bun add。

@exodus/key-challenge 支持 TypeScript 吗?

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

@exodus/key-challenge 支持 ESM 还是 CommonJS?

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

@exodus/key-challenge 可以商用吗?

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

@exodus/key-challenge 的下载量有多少?

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

@exodus/key-challenge 还在维护吗?

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