@did-core/did-ld-json

中文文档
0.1.1-unstable.15发布于 2021/07/01Apache-2.0TypeScriptESM + CJS近 30 天下载 1.4万

npm i @did-core/did-ld-json --save

中文使用文档

@ 二分数/ 二分数- json

npm i @did-core/did-ld-json --save

使用量

import { factory, DidDocument } from '@did-core/data-model';
import { representation } from '@did-core/did-ld-json';

const didDocument: DidDocument = factory.build({
  entries: {
    '@context': [
      'https://www.w3.org/ns/did/v1',
      'https://ns.did.ai/suites/jws-2020/v1',
    ],
    id: 'did:example:123',
    verificationMethod: [
      {
        id: '#z6MktjiTVhTt2NWEYUjbqrkRVLWqJgpw85jFRmHcGrYFD7jM',
        type: 'JsonWebKey2020',
        controller: 'did:example:123',
        publicKeyJwk: {
          kty: 'OKP',
          crv: 'Ed25519',
          x: '1DrGM08j2Agl8F14fN69RexmNON2Yczq3hp47wMRilA',
        },
      },
    ],
  },
});

const representation: Buffer = await didDocument
  .addRepresentation({ 'application/did+ld+json': representation })
  .produce('application/did+ld+json');

版本与发布记录

@did-core/did-ld-json 共发布 15 个版本,首次发布于 2021/02/14;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.1-unstable.15latest2021/07/015 年前
0.1.1-unstable.142021/07/015 年前
0.1.1-unstable.132021/06/015 年前
0.1.1-unstable.122021/05/315 年前
0.1.1-unstable.112021/05/205 年前
0.1.1-unstable.102021/05/095 年前

关于 @did-core/did-ld-json 的常见问题

@did-core/did-ld-json 是什么?

npm i @did-core/did-ld-json --save

如何安装 @did-core/did-ld-json?

在项目目录运行 npm install @did-core/did-ld-json,或使用 pnpm add / yarn add / bun add。

@did-core/did-ld-json 支持 TypeScript 吗?

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

@did-core/did-ld-json 支持 ESM 还是 CommonJS?

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

@did-core/did-ld-json 需要什么版本的 Node.js?

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

@did-core/did-ld-json 可以商用吗?

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

@did-core/did-ld-json 的下载量有多少?

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

@did-core/did-ld-json 还在维护吗?

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