@dfinity/ic-pub-key

中文文档
1.0.2发布于 2026/05/21ISCTypeScriptESM + CJS构建来源已验证近 30 天下载 4501

Library for deriving public keys for threshold signature schemes used on the Internet Computer

原始使用文档

IC Public Key

TypeScript library for working with ICP public keys.

The Internet Computer protcol supports several threshold signature schemes including ECDSA, Ed25519, and BIP340 Schnorr. In these schemes, the various user public keys are derived from a master key which is split among the nodes in a subnet. This derivation can be done online, using the ecdsa_public_key and schnorr_public_key management canister calls, but since no secret is involved in the derivation process it can also be performed offline.

This library contains TypeScript implementations of this derivation, allowing keys to be derived by frontend applications without a call to the IC.

You can find Rust implementations of this same functionality in the ic_secp256k1 and ic_ed25519 crates.

Usage

npm

npm install @dfinity/ic-pub-key

Command line

To derive one public key from another:

npx @dfinity/ic-pub-key derive ecdsa secp256k1 --pubkey 02b84ff3f88329a887657d0309bd1a1af9e37601e5d1a535d6fe7d42e37f79f40a --chaincode 212891bc032f28d369bacf39dc369feb516eced9a3d83498246aead1546f8cd1 --derivationpath fee/fie/foo/fum

The command line also includes tools for working with the Chain Fusion Signer. For example, to get the Ethereum address of a principal on the chain fusion signer:

npx @dfinity/ic-pub-key signer eth address -u nggqm-p5ozz-i5hfv-bejmq-2gtow-4dtqw-vjatn-4b4yw-s5mzs-i46su-6ae

Or to get the Bitcoin mainnet address of a principal on the chain fusion signer:

npx @dfinity/ic-pub-key signer btc address -u nggqm-p5ozz-i5hfv-bejmq-2gtow-4dtqw-vjatn-4b4yw-s5mzs-i46su-6ae -n mainnet

版本与发布记录

@dfinity/ic-pub-key 共发布 7 个版本,首次发布于 2025/07/01;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.2latest2026/05/215 个月前
1.0.1-next-2026-05-21.2next2026/05/215 个月前
1.0.1-next-2026-05-21.12026/05/215 个月前
1.0.1-next-2026-05-212026/05/215 个月前
1.0.1-next-2026-01-282026/01/289 个月前
1.0.12026/01/279 个月前

关于 @dfinity/ic-pub-key 的常见问题

@dfinity/ic-pub-key 是什么?

Library for deriving public keys for threshold signature schemes used on the Internet Computer

如何安装 @dfinity/ic-pub-key?

在项目目录运行 npm install @dfinity/ic-pub-key,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ic-pub-key,可以用 npx ic-pub-key 直接运行。

@dfinity/ic-pub-key 支持 TypeScript 吗?

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

@dfinity/ic-pub-key 支持 ESM 还是 CommonJS?

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

@dfinity/ic-pub-key 需要什么版本的 Node.js?

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

@dfinity/ic-pub-key 可以商用吗?

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

@dfinity/ic-pub-key 的下载量有多少?

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

@dfinity/ic-pub-key 还在维护吗?

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