Skip to content

Quickstart ​

Prerequisites ​

  • Node.js 24 or newer
  • A pnpm version compatible with the consumer workspace; repository contributors use pnpm 11.25.0
  • Selected Ledger9 migration: Compact 0.36.0 / runtime 0.21.0, measured backend zkir-3.2.0-rc.2. Published VC 1.0.0 pins published DID 1.0.0 where the optional binding needs it. Strict packed consumers pass against that stable graph. The earlier bounded native signer proof evidence covers the compiler/runtime profile separately and has not been rerun with the final DID 1.0.0 graph. Read the migration guide before adopting it. Do not mix older generated keys/artifacts or interpret compiler backend identity as the public @midnightntwrk/ledger-v9@1.0.2 npm version.

Install ​

The examples pin the published stable 1.0.0 package cohort. Install only the boundaries the consumer needs:

bash
# Metadata only
pnpm add -E @midnightntwrk/credential-model@1.0.0

# Metadata plus schema-neutral Compact primitives
pnpm add -E \
  @midnightntwrk/credential-model@1.0.0 \
  @midnightntwrk/credential-compact@1.0.0

# Add only for did:midnight method binding
pnpm add -E @midnightntwrk/credential-did-midnight@1.0.0

The packages do not provide a concrete credential implementation, wallet flow, exchange protocol, DID resolver, status authority, or issuer trust policy. A consumer repository owns those choices.

Use Build with VC Core to see the shipped capabilities, the checks a verifier must add, and an annotated age-eligibility journey before choosing an application architecture.

As verified on 2026-12-03, latest points to 1.0.0 for all three packages. The rc tag still points to 1.0.0-rc3, which has a different DID dependency graph. Keep stable and RC packages separate.

For release-sensitive automation, this guarded function verifies each immutable stable version before recording the exact cohort:

bash
install_stable_graph() (
  set -euo pipefail
  EXPECTED_STABLE="${1:?usage: install_stable_graph VERSION}"
  NPM_REGISTRY="${NPM_REGISTRY:-https://registry.npmjs.org/}"
  for package in \
    @midnightntwrk/credential-model \
    @midnightntwrk/credential-compact \
    @midnightntwrk/credential-did-midnight; do
    if ! actual_version="$(npm view --registry "$NPM_REGISTRY" \
      "${package}@${EXPECTED_STABLE}" version)"; then
      printf 'could not resolve %s@%s\n' \
        "$package" "$EXPECTED_STABLE" >&2
      exit 1
    fi
    if [[ "$actual_version" != "$EXPECTED_STABLE" ]]; then
      printf 'expected %s version=%s, got %s\n' \
        "$package" "$EXPECTED_STABLE" "$actual_version" >&2
      exit 1
    fi
  done
  pnpm add --registry "$NPM_REGISTRY" -E \
    "@midnightntwrk/credential-model@${EXPECTED_STABLE}" \
    "@midnightntwrk/credential-compact@${EXPECTED_STABLE}" \
    "@midnightntwrk/credential-did-midnight@${EXPECTED_STABLE}"
)

# In a consumer project, invoke as: install_stable_graph 1.0.0

Keep the package graph on one exact version for reproducible consumer builds. To evaluate an RC intentionally, the moving rc dist-tag may identify a prerelease older or newer than latest; inspect it before opting in:

bash
NPM_REGISTRY="${NPM_REGISTRY:-https://registry.npmjs.org/}"
MODEL_RC="$(npm view --registry "$NPM_REGISTRY" @midnightntwrk/credential-model dist-tags.rc)"
COMPACT_RC="$(npm view --registry "$NPM_REGISTRY" @midnightntwrk/credential-compact dist-tags.rc)"
DID_RC="$(npm view --registry "$NPM_REGISTRY" @midnightntwrk/credential-did-midnight dist-tags.rc)"
printf 'model=%s compact=%s did=%s\n' "$MODEL_RC" "$COMPACT_RC" "$DID_RC"

Only after confirming that all three rc tags identify the prerelease graph you intend to evaluate, record that exact version as EXPECTED_RC. The guarded install rechecks every moving tag against that approved version before using the immutable version:

bash
install_rc_graph() (
  set -euo pipefail
  EXPECTED_RC="${1:?usage: install_rc_graph VERSION}"
  NPM_REGISTRY="${NPM_REGISTRY:-https://registry.npmjs.org/}"
  MODEL_RC="$(npm view --registry "$NPM_REGISTRY" @midnightntwrk/credential-model dist-tags.rc)"
  COMPACT_RC="$(npm view --registry "$NPM_REGISTRY" @midnightntwrk/credential-compact dist-tags.rc)"
  DID_RC="$(npm view --registry "$NPM_REGISTRY" @midnightntwrk/credential-did-midnight dist-tags.rc)"
  if [[ "$MODEL_RC" != "$EXPECTED_RC" || \
    "$COMPACT_RC" != "$EXPECTED_RC" || "$DID_RC" != "$EXPECTED_RC" ]]; then
    printf 'refusing unapproved RC graph: expected=%s model=%s compact=%s did=%s\n' \
      "$EXPECTED_RC" "$MODEL_RC" "$COMPACT_RC" "$DID_RC" >&2
    exit 1
  fi
  pnpm add --registry "$NPM_REGISTRY" -E \
    "@midnightntwrk/credential-model@${EXPECTED_RC}" \
    "@midnightntwrk/credential-compact@${EXPECTED_RC}" \
    "@midnightntwrk/credential-did-midnight@${EXPECTED_RC}"
)

Use those install commands only when the reported rc versions are the exact prerelease graph you intend to evaluate. After recording that version, invoke the function explicitly, for example install_rc_graph 1.0.0-rc3. Keep all three packages on that same exact version. Prerelease adoption should not happen implicitly.

Define Metadata ​

credential-model validates protocol-neutral credential schema metadata:

ts
import { defineCredentialSchema } from "@midnightntwrk/credential-model";

export const membershipSchema = defineCredentialSchema({
  id: "urn:example:membership",
  version: "1.0.0",
  credentialTypes: ["VerifiableCredential", "MembershipCredential"],
  claims: [
    {
      id: "memberId",
      path: ["memberId"],
      disclosure: "selective",
      required: true,
    },
  ],
});

This validates schema metadata only. It does not check the member ID value or ensure that a claim classified as selective is absent from public credential fields; the schema implementation must enforce that split.

Select a Compact Entrypoint ​

credential-compact publishes exactly two supported Compact roots:

EntrypointUse
./credentials.compactStandalone use of the complete core surface
./credentials/composable.compactInclude shared declarations once before schema composition

Use only package exports. Do not import repository src, generated managed, or dist internals.

For Midnight DID-aware contracts, include either the binding package's standalone ./did-midnight.compact root or include the core composable root once followed by ./did-midnight/composable.compact.

Verify the Repository ​

From a source checkout:

bash
pnpm install --frozen-lockfile
./run.sh --light
./run.sh docs

Midnight Verifiable Credentials core