@emurgo/cardano-message-signing-asmjs

中文文档
1.1.0发布于 2024/10/16MITTypeScriptES Module零依赖近 30 天下载 1.6万

This is a library that implements the CIP-0008 message signing spec for the Cardano blockchain.

原始使用文档

Message Signing

This is a library that implements the CIP-0008 message signing spec for the Cardano blockchain.

The library is composed of structs for (de)serializing the CBOR defined in CIP-0008/COSE which lays at the core of the protocol, mostly defined in lib.rs, as well as many helper utilities for more specific cases useful to CIP-0008. These are mostly in builders.rs for building the CBOR structures specific to certain algorithms.

NPM packages

Building

It can be used from both rust or compiled to wasm as all public code works with wasm-bindgen via wasm-pack.

There are no rust crates/npm packages uploaded yet, but these will come in the future.

In the meantime to build a wasm package we can run one of

  • npm run rust:build-nodejs for nodejs targeted wasm
  • npm run rust:build-browser for browser targeted wasm
  • npm run asm:build for conversion for asm.js

and for use from rust simply use the lib that resides in /rust/.

Example Usage

It is important to read the CIP-0008 spec to properly understand how to use this library. As per CIP-0008/COSE, signing is done via constructing a SigStructure and then signing this with the proper keys. This can be simplified via the use of the COSESignBuilder (for multiparty signing) / COSESign1Builder (for single signer) builders. Encryption is not yet supported by this library but will be in the future. An example node.js (wasm option) project that signs a message with a Cardano address exists in the /example/ directory which has detailed comments describing each step.

版本与发布记录

@emurgo/cardano-message-signing-asmjs 共发布 3 个版本,首次发布于 2022/01/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.0latest2024/10/162 年前
1.0.12022/02/104 年前
1.0.02022/01/014 年前

关于 @emurgo/cardano-message-signing-asmjs 的常见问题

@emurgo/cardano-message-signing-asmjs 是什么?

This is a library that implements the CIP-0008 message signing spec for the Cardano blockchain.

如何安装 @emurgo/cardano-message-signing-asmjs?

在项目目录运行 npm install @emurgo/cardano-message-signing-asmjs,或使用 pnpm add / yarn add / bun add。

@emurgo/cardano-message-signing-asmjs 支持 TypeScript 吗?

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

@emurgo/cardano-message-signing-asmjs 支持 ESM 还是 CommonJS?

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

@emurgo/cardano-message-signing-asmjs 可以商用吗?

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

@emurgo/cardano-message-signing-asmjs 的下载量有多少?

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

@emurgo/cardano-message-signing-asmjs 还在维护吗?

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