@digitalbazaar/ecdsa-rdfc-2019-cryptosuite

中文文档
1.3.0发布于 2026/02/06BSD-3-ClauseES Module近 30 天下载 7188

An ECDSA-RDFC-2019 Data Integrity cryptosuite for use with jsonld-signatures.

原始使用文档
文档目录8 节
  1. Table of Contents
  2. Background
  3. Security
  4. Install
  5. Usage
  6. Contribute
  7. Commercial Support
  8. License

ECDSA RDFC 2019 Data Integrity Cryptosuite (@digitalbazaar/ecdsa-rdfc-2019-cryptosuite)

Build status Coverage status NPM Version

ECDSA RDFC 2019 Data Integrity Cryptosuite for use with jsonld-signatures.

Table of Contents

Background

For use with https://github.com/digitalbazaar/jsonld-signatures v11.0 and above.

See also related specs:

Security

TBD

Install

  • Browsers and Node.js 18+ are supported.

To install from NPM:

npm install @digitalbazaar/ecdsa-rdfc-2019-cryptosuite

To install locally (for development):

git clone https://github.com/digitalbazaar/ecdsa-rdfc-2019-cryptosuite.git
cd ecdsa-rdfc-2019-cryptosuite
npm install

Usage

The following code snippet provides a complete example of digitally signing a verifiable credential using this library:

import * as EcdsaMultikey from '@digitalbazaar/ecdsa-multikey';
import {DataIntegrityProof} from '@digitalbazaar/data-integrity';
import {cryptosuite as ecdsaRdfc2019Cryptosuite} from
  '@digitalbazaar/ecdsa-rdfc-2019-cryptosuite';
import jsigs from 'jsonld-signatures';
const {purposes: {AssertionProofPurpose}} = jsigs;


// create the unsigned credential
const unsignedCredential = {
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    {
      AlumniCredential: 'https://schema.org#AlumniCredential',
      alumniOf: 'https://schema.org#alumniOf'
    }
  ],
  id: 'http://example.edu/credentials/1872',
  type: [ 'VerifiableCredential', 'AlumniCredential' ],
  issuer: 'https://example.edu/issuers/565049',
  issuanceDate: '2010-01-01T19:23:24Z',
  credentialSubject: {
    id: 'https://example.edu/students/alice',
    alumniOf: 'Example University'
  }
};

// create the keypair to use when signing
const controller = 'https://example.edu/issuers/565049';
const keyPair = await EcdsaMultikey.from({
  '@context': 'https://w3id.org/security/multikey/v1',
  id: 'https://example.edu/issuers/565049#zDnaekGZTbQBerwcehBSXLqAg6s55hVEBms1zFy89VHXtJSa9',
  type: 'Multikey',
  controller: 'https://example.edu/issuers/565049',
  publicKeyMultibase: 'zDnaekGZTbQBerwcehBSXLqAg6s55hVEBms1zFy89VHXtJSa9',
  secretKeyMultibase: 'z42tqZ5smVag3DtDhjY9YfVwTMyVHW6SCHJi2ZMrD23DGYS3'
});

// export public key and add to document loader
const publicKey = await keyPair.export({publicKey: true, includeContext: true});
addDocumentToLoader({url: publicKey.id, document: publicKey});

// create key's controller document
const controllerDoc = {
  '@context': [
    'https://www.w3.org/ns/did/v1',
    'https://w3id.org/security/multikey/v1'
  ],
  id: controller,
  assertionMethod: [publicKey]
};
addDocumentToLoader({url: controllerDoc.id, document: controllerDoc});

// create suite
const suite = new DataIntegrityProof({
  signer: keyPair.signer(), cryptosuite: ecdsaRdfc2019Cryptosuite
});

// create signed credential
const signedCredential = await jsigs.sign(unsignedCredential, {
  suite,
  purpose: new AssertionProofPurpose(),
  documentLoader
});

// results in the following signed VC
{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    {
      "AlumniCredential": "https://schema.org#AlumniCredential",
      "alumniOf": "https://schema.org#alumniOf"
    },
    "https://w3id.org/security/data-integrity/v2"
  ],
  "id": "http://example.edu/credentials/1872",
  "type": [
    "VerifiableCredential",
    "AlumniCredential"
  ],
  "issuer": "https://example.edu/issuers/565049",
  "issuanceDate": "2010-01-01T19:23:24Z",
  "credentialSubject": {
    "id": "https://example.edu/students/alice",
    "alumniOf": "Example University"
  },
  "proof": {
    "type": "DataIntegrityProof",
    "created": "2023-03-01T21:29:24Z",
    "verificationMethod": "https://example.edu/issuers/565049#zDnaekGZTbQBerwcehBSXLqAg6s55hVEBms1zFy89VHXtJSa9",
    "cryptosuite": "ecdsa-rdfc-2019",
    "proofPurpose": "assertionMethod",
    "proofValue": "z5grbn9Tp8xC7p6LpmUdxxRdAx37azC2GQDdHBqq7ivFsaFUJtC81b8puwe2NmaEUYpxXQooXNnXL3M2NqySrzC5Z"
  }
}

Contribute

See the contribute file!

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

Commercial Support

Commercial support for this library is available upon request from Digital Bazaar: [email protected]

License

New BSD License (3-clause) © 2023 Digital Bazaar

版本与发布记录

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 共发布 6 个版本,首次发布于 2023/11/14;过去 12 个月发布了 1 个版本。

版本发布日期距今
1.3.0latest2026/02/069 个月前
1.2.02024/11/262 年前
1.1.12024/08/272 年前
1.1.02024/08/022 年前
1.0.12023/11/142 年前
0.0.02023/11/142 年前

关于 @digitalbazaar/ecdsa-rdfc-2019-cryptosuite 的常见问题

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 是什么?

An ECDSA-RDFC-2019 Data Integrity cryptosuite for use with jsonld-signatures.

如何安装 @digitalbazaar/ecdsa-rdfc-2019-cryptosuite?

在项目目录运行 npm install @digitalbazaar/ecdsa-rdfc-2019-cryptosuite,或使用 pnpm add / yarn add / bun add。

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/digitalbazaar__ecdsa-rdfc-2019-cryptosuite 是否存在。

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 支持 ESM 还是 CommonJS?

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

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 需要什么版本的 Node.js?

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

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 可以商用吗?

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 的下载量有多少?

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

@digitalbazaar/ecdsa-rdfc-2019-cryptosuite 还在维护吗?

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