Test Certificate Context

raw JSON →
1.0.2 verified Sat Apr 25 auth: no javascript maintenance

A JSON-LD context for medical test certificates, version 1.0.2. This package provides the W3C Verifiable Credential context for medical test results, used in the DIVOC digital vaccination certificate system. It is a stable, low-traffic library with no active development since 2021. Differentiator: specifically designed for interoperable health certificates in Indian e-governance.

error Cannot find module 'test-certificate-context'
cause Package is ESM-only and cannot be required with require().
fix
Use dynamic import: const context = await import('test-certificate-context');
error ERR_REQUIRE_ESM: require() of ES Module
cause Trying to use require() on an ESM-only package.
fix
Change to import syntax or use dynamic import.
error Unknown variable or property: TEST_CERTIFICATE_V1_CONTEXT_URL
cause Incorrect case for named import.
fix
Import as: import { TEST_CERTIFICATE_V1_CONTEXT_URL } from 'test-certificate-context';
gotcha Context URL is a placeholder example URL, not a resolvable JSON-LD document in production.
fix Do not rely on the context URL for resolution; embed the context object directly or use a cached copy.
deprecated Package is no longer actively maintained since 2021.
fix Consider migrating to a more current W3C Verifiable Credential framework if active development is needed.
gotcha ESM-only package; cannot be required with require().
fix Use dynamic import: const context = (await import('test-certificate-context')).default;
breaking Named export uses SCREAMING_SNAKE_CASE, which may conflict with linting rules or expectations.
fix Import as: import { TEST_CERTIFICATE_V1_CONTEXT_URL } from 'test-certificate-context';
npm install test-certificate-context
yarn add test-certificate-context
pnpm add test-certificate-context

Shows how to import and use the context object and URL, then create a W3C Verifiable Credential with medical test context.

import context, { TEST_CERTIFICATE_V1_CONTEXT_URL } from 'test-certificate-context';

console.log('Context URL:', TEST_CERTIFICATE_V1_CONTEXT_URL);
// Context URL: https://www.w3.org/2022/credentials/examples/v1

// Use the context when creating a Verifiable Credential
import { createVerifiableCredentialJwt } from '@transmute/vc.js';

const credential = {
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    context
  ],
  type: ['VerifiableCredential', 'MedicalTestCertificate'],
  issuer: process.env.ISSUER_DID ?? 'did:example:123',
  issuanceDate: new Date().toISOString(),
  credentialSubject: {
    id: 'did:example:subject',
    testResult: 'negative'
  }
};

console.log('Credential context set:', JSON.stringify(credential['@context'], null, 2));