ecdsa-sig-formatter

中文文档
1.0.11发布于 2019/01/26Apache-2.0TypeScriptCommonJS近 30 天下载 3.3亿

Translate ECDSA signatures between ASN.1/DER and JOSE-style concatenation

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. API
  4. Contributing
  5. Code Style

ecdsa-sig-formatter

Build Status Coverage Status

Translate between JOSE and ASN.1/DER encodings for ECDSA signatures

Install

npm install ecdsa-sig-formatter --save

Usage

var format = require('ecdsa-sig-formatter');

var derSignature = '..'; // asn.1/DER encoded ecdsa signature

var joseSignature = format.derToJose(derSignature);

API


.derToJose(Buffer|String signature, String alg) -> String

Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. Returns a base64 url encoded String.

  • If signature is a String, it should be base64 encoded
  • alg must be one of ES256, ES384 or ES512

.joseToDer(Buffer|String signature, String alg) -> Buffer

Convert the JOSE-style concatenated signature to an ASN.1/DER encoded signature. Returns a Buffer

  • If signature is a String, it should be base64 url encoded
  • alg must be one of ES256, ES384 or ES512

Contributing

  1. Fork the repository. Committing directly against this repository is highly discouraged.

  2. Make your modifications in a branch, updating and writing new unit tests as necessary in the spec directory.

  3. Ensure that all tests pass with npm test

  4. rebase your changes against master. Do not merge.

  5. Submit a pull request to this repository. Wait for tests to run and someone to chime in.

Code Style

This repository is configured with EditorConfig and ESLint rules.

版本与发布记录

ecdsa-sig-formatter 共发布 10 个版本,首次发布于 2015/06/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.11latest2019/01/267 年前
1.0.102018/05/148 年前
1.0.92016/12/059 年前
1.0.82016/11/159 年前
1.0.72016/06/1810 年前
1.0.62016/06/1710 年前

关于 ecdsa-sig-formatter 的常见问题

ecdsa-sig-formatter 是什么?

Translate ECDSA signatures between ASN.1/DER and JOSE-style concatenation

如何安装 ecdsa-sig-formatter?

在项目目录运行 npm install ecdsa-sig-formatter,或使用 pnpm add / yarn add / bun add。

ecdsa-sig-formatter 支持 TypeScript 吗?

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

ecdsa-sig-formatter 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

ecdsa-sig-formatter 可以商用吗?

ecdsa-sig-formatter 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

ecdsa-sig-formatter 的下载量有多少?

根据 npm 官方下载统计,ecdsa-sig-formatter 在 2026/10/05 – 2026/11/03 这 30 天内被下载 328,005,904 次,日均约 10,933,530 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

ecdsa-sig-formatter 还在维护吗?

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