パッケージの詳細

@digitalcredentials/open-badges-context

digitalcredentials18.8kMIT3.0.0

NPM package for the OBv3 (Open Badges version 3) JSON-LD context.

readme

OpenBadges v3 Context (@digitalcredentials/open-badges-context)

Node.js CI NPM Version

NPM package for the OBv3 (Open Badges version 3) JSON-LD context.

Table of Contents

Background

For use with JSON-LD document loaders (such as the DCC security-document-loader or DigitalBazaar's jsonld-document-loader).

Install

Requires Node.js 14+

To install via NPM:

npm install @digitalcredentials/open-badges-context

Usage

import obCtx from '@digitalcredentials/open-badges-context';
// or
const obCtx = require('@digitalcredentials/open-badges-context');

obCtx.CONTEXT_URL_V3
// 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json' <-- Latest URL

// get context data for a specific context
obCtx.contexts.get(obCtx.CONTEXT_URL_V3)
// full context object

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

API

The library exports the following properties:

  • Various OBv3 @context URLs, such as: CONTEXT_URL_V3, CONTEXT_URL_V3_0_0, CONTEXT_URL_V3_0_3 etc.
  • contexts: A Map that maps URLs to full context data.

See index.js for full list of exports.

Developing

When adding a new @context, do all of the following:

  1. Add the new context file to js/contexts
  2. Update js/index.js
  3. Update rollup.config.js with the new exports
  4. Update context.spec.js with the new exports
  5. Update README / Usage section.

License

更新履歴

@digitalcredentials/open-badges-context ChangeLog

3.0.0 - 2025-05-21

Changed

  • BREAKING: Update the 3.0.3 context to include the latest published changes from 1EdTech, in particular the new inLanguage and awardedDate properties.

2.1.0 - 2024-01-23

Added

  • Add support for OBv3 context 3.0.3 as well as the extensions context.

2.0.1 - 2023-06-16

Changed

  • Fixed the OBv3 BETA url, so ctx.CONTEXT_URL_V3_BETA resolves to OBv3_beta.

2.0.0 - 2023-06-16

Changed

  • BREAKING: Refactor contexts, export OBv3 contexts from 3.0-beta, to 3.0.2, setting latest CONTEXT_URL_V3 to 3.0.2

1.0.0

Updated to reflect OB V3 context posted by 1EdTech on Friday, 11/4 (NOTE: breaks verification of old credentials)

0.1.2

Exported JFF and IMS context URLs

0.1.1

Updated IMS Global OB V3 context to latest spec

0.1.0

Added additional context URL aliases