@digitalbazaar/credentials-context

中文文档
3.2.0发布于 2025/02/28SEE LICENSE IN LICENSE.mdESM + CJS零依赖近 30 天下载 8.5万

Verifiable Credentials Contexts for JavaScript

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

Verifiable Credentials Contexts (@digitalbazaar/credentials-context)

Node.js CI NPM Version

A Verifiable Credentials Data Model contexts library for JavaScript

This project packages the contexts for the Verifiable Credentials Data Model specs for use with Node.js and web apps.

Table of Contents

Background

See related specs:

Security

TBD

Install

Requires Node.js 18+

To install via NPM:

npm install @digitalbazaar/credentials-context

Usage

import {contexts, metadata, named} from '@digitalbazaar/credentials-context';
// or
const {contexts, metadata, named} = require('@digitalbazaar/credentials-context');

The contexts Map can be used to access individual contexts by id or load them into a JSON-LD document loader. The metadata Map contains extra information about each context.

This package can be used with bundlers, such as webpack, in browser applications.

API

The library exports the following properties:

  • contexts: A Map associating context URLs to context data.
  • metadata: A Map associating context URLs to context metadata.
  • named: A Map associating short package specific names to context metadata.

Note that the metadata format is experimental and subject to change. The id field is expected to stay stable and can be used with the named Map to get a context URL for a short name such as v2.

The context files are available in the published contexts/ directory. The metadata has a URL for each context. Note that these files are semantically equivalent to published spec contexts but the formatting may differ such that strict file digests are not equivalent.

Status

The following contexts are available as of mid-2024. They track the published spec contexts.

  • Verifiable Credentials v1.1 context
    • URL: https://www.w3.org/2018/credentials/v1
    • Short name: v1
    • Status: stable
  • Verifiable Credentials v2.0 context
    • URL: https://www.w3.org/ns/credentials/v2
    • Short name: v2
    • Status: under development
  • Verifiable Credentials v2.0 undefined terms context
    • URL: https://www.w3.org/ns/credentials/undefined-terms/v2
    • Short name: undefined-terms-v2
    • Status: under development

Developing

Source is available at:

WARNING: The .jsonld files in contexts/ are auto-generated by the npm run build script each time the test suite is run.

DO NOT edit them directly since changes will be overwritten.

Make all context changes to lib/*.js.

Commercial Support

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

License

  • Code: BSD 3-Clause © Digital Bazaar
  • Contexts: W3C Software and Document License
  • See the LICENSE file for details.

版本与发布记录

@digitalbazaar/credentials-context 共发布 3 个版本,首次发布于 2024/08/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.2.0latest2025/02/281.7 年前
3.1.02024/08/022 年前
3.0.02024/08/012 年前

关于 @digitalbazaar/credentials-context 的常见问题

@digitalbazaar/credentials-context 是什么?

Verifiable Credentials Contexts for JavaScript

如何安装 @digitalbazaar/credentials-context?

在项目目录运行 npm install @digitalbazaar/credentials-context,或使用 pnpm add / yarn add / bun add。

@digitalbazaar/credentials-context 支持 TypeScript 吗?

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

@digitalbazaar/credentials-context 支持 ESM 还是 CommonJS?

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

@digitalbazaar/credentials-context 可以商用吗?

@digitalbazaar/credentials-context 使用 SEE LICENSE IN LICENSE.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@digitalbazaar/credentials-context 的下载量有多少?

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

@digitalbazaar/credentials-context 还在维护吗?

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