@digitalcredentials/issuer-registry-client

中文文档
4.1.0发布于 2026/09/01MITTypeScriptES Module构建来源已验证近 30 天下载 1.1万

Known issuers / verifiers registry client, for use in Typescript, browser, and React Native.

原始使用文档
文档目录9 节
  1. Table of Contents
  2. Description
  3. Install
  4. NPM
  5. Development
  6. Usage
  7. Supplying your own fetch
  8. Contribute
  9. License

Known Issuer Registry Client (@digitalcredentials/issuer-registry-client)

Build status NPM Version

Isomorphic client for looking up DIDs in Known Issuer/Known Verifier registries. For Node, browser and React Native.

Table of Contents

Description

This is a client library that looks up DIDs in either:

Note that an individual DID can appear in multiple registries. Because of that, the order of registries loaded matters. For example, given a registry list:

const knownRegistries = [
  {
    type: 'oidf',
    fetchEndpoint: 'https://registry.dcconsortium.org/fetch?sub=',
    name: 'DCC Member Registry'
  },
  {
    name: 'DCC Sandbox Registry',
    url: 'https://digitalcredentials.github.io/sandbox-registry/registry.json',
    type: 'dcc-legacy'
  }
]

If an issuer DID is contained in both of those registries, the issuer entry (that contains the issuer name and URL) will come from the first registry, "DCC Member Registry".

In other words, verifiers and other implementers must order the registries in order of most authoritative to least.

Install

  • Node.js 24+ is recommended.

NPM

To install via NPM:

npm install @digitalcredentials/issuer-registry-client

Development

This project uses pnpm. To install locally (for development):

git clone https://github.com/digitalcredentials/issuer-registry-client.git
cd issuer-registry-client
pnpm install

Build, lint, and test:

pnpm run build         # compile to dist/ via tsc
pnpm run lint          # eslint
pnpm run test-node     # vitest (Node)
pnpm run test-browser  # playwright (browser); run `pnpm exec playwright install chromium` first
pnpm test              # fix + lint + node + browser

Usage

You'll need an array of known issuer and verifier registries you would like to check against, like this publicly available copy of the DCC known registries:

https://digitalcredentials.github.io/dcc-known-registries/known-did-registries.json

which as of apr 22 2025 looked like so (reproduced here for convenience):

[
  {
    "type": "oidf",
    "fetchEndpoint": "https://registry.dcconsortium.org/fetch?sub=",
    "name": "DCC Member Registry"
  },
  {
    "type": "dcc-legacy",
    "name": "DCC Sandbox Registry",
    "url": "https://digitalcredentials.github.io/sandbox-registry/registry.json"
  },
  {
    "type": "dcc-legacy",
    "name": "DCC Community Registry",
    "url": "https://digitalcredentials.github.io/community-registry/registry.json"
  },
  {
    "type": "dcc-legacy",
    "name": "MSP Registry",
    "url": "https://sandbox-issuer.myskillspocket.com/registry.json"
  }
]

You would use that list thusly:

import { RegistryClient } from '@digitalcredentials/issuer-registry-client'

const registryClient = new RegistryClient()

// get the list of known issuers from wherever you store it, which could just be in a variable,
// but here we show how to fetch the DCC's list from it's github repository:
const response = await fetch("https://digitalcredentials.github.io/dcc-known-registries/known-did-registries.json");
const knownRegistries = await response.json();

// set the registry client to use that list
await registryClient.use({ registries: knownRegistries })

// You can now query to see if a DID is known in any registry
const results = registryClient.lookupIssuersFor('did:key:z6MkpLDL3RoAoMRTwTgo3rs39ZwssfaPKtGdZw7AGRN7CK4W'))

The lookup returns:

  • a list of issuers in which the provided DID is registered
  • a list of any registries (from the provided known issuers list) that couldn't be checked

Each returned issuer includes metadata for the issuer and metadata for the registry in which the issuer was registered.

Supplying your own fetch

Every registry request goes through globalThis.fetch by default. Pass a fetch of your own to take that over -- to apply a timeout, add headers, serve from a cache, or reach a registry the runtime cannot request directly (in a browser, one that sends no CORS headers), which would otherwise come back in uncheckedRegistries:

const registryClient = new RegistryClient({
  fetch: async url =>
    await fetch(`https://gateway.example/fetch?url=${encodeURIComponent(url)}`)
})

It is called with a URL and returns a Response, exactly like fetch.

Note that it is called as a method of the client, so a bare global reference -- { fetch } or { fetch: globalThis.fetch } -- is a detached call. In a browser that throws TypeError: Illegal invocation, and every registry comes back in uncheckedRegistries. Wrap it, as in the example above, or bind it:

const registryClient = new RegistryClient({
  fetch: globalThis.fetch.bind(globalThis)
})

Here is an example lookup response for a DID that is registered in one legacy registry, one OIDF regsitry, and also lists one registry that couldn't checked for some reason (e.g., the server was down):

{
  "matchingIssuers": [
    {
      "issuer": {
        "federation_entity": {
          "organization_name": "OneUni University",
          "homepage_uri": "https://oneuni.edu",
          "logo_uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAB4SURBVEhLY1Da6ENTNGoBQTRqAUE0Yixwkq3X5tNgAANBkRlosvgQERbM0OaAmAwFNLFAkMNdW2KGkwjIE1S3AIFGLSCIRi0giEYtwIHq5Tk0BCEIaDwIwLh89RiKMRBRFkDNxQBUsoAyNGoBQTRqAUE01C3Y6AMAsDxJowXOs6oAAAAASUVORK5CYII="
        },
        "institution_additional_information": {
          "legal_name": "Board and Trustees of OneUni University"
        },
        "credential_registry_entity": {
          "ctid": "ce-e8a41a52-6ff6-48f0-9872-889c87b093b7",
          "ce_url": "https://credentialengineregistry.org/resources/ce-e8a41a52-6ff6-48f0-9872-889c87b093b7"
        },
        "ror_entity": {
          "rorid": "042nb2s44",
          "ror_url": "https://ror.org/042nb2s44"
        }
      },
      "registry": {
        "type": "oidf",
        "fetchEndpoint": "https://test.registry.dcconsortium.org/fetch?sub=",
        "name": "DCC Member Registry"
      }
    },
    {
      "issuer": {
        "federation_entity": {
          "organization_name": "Issuer Registry Client test",
          "homepage_uri": "https://dcconsortium.org/",
          "location": "here"
        }
      },
      "registry": {
        "type": "dcc-legacy",
        "name": "DCC Community Registry",
        "url": "https://digitalcredentials.github.io/community-registry/registry.json"
      }
    }
  ],
  "uncheckedRegistries": [
    {
      "type": "oidf",
      "fetchEndpoint": "https://registryyyyy.dcconsortium.org/fetch?sub=",
      "name": "DCC Member Registry Not Real"
    }
  ]
}

Contribute

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

License

MIT License © 2025 Digital Credentials Consortium.

版本与发布记录

@digitalcredentials/issuer-registry-client 共发布 12 个版本,首次发布于 2022/12/01;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.1.0latest2026/09/012 个月前
4.0.02026/06/055 个月前
3.2.0-beta.5beta2025/05/151.5 年前
3.2.0-beta.42025/05/141.5 年前
3.2.0-beta.32025/05/031.5 年前
3.2.0-beta.22025/05/021.5 年前

关于 @digitalcredentials/issuer-registry-client 的常见问题

@digitalcredentials/issuer-registry-client 是什么?

Known issuers / verifiers registry client, for use in Typescript, browser, and React Native.

如何安装 @digitalcredentials/issuer-registry-client?

在项目目录运行 npm install @digitalcredentials/issuer-registry-client,或使用 pnpm add / yarn add / bun add。

@digitalcredentials/issuer-registry-client 支持 TypeScript 吗?

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

@digitalcredentials/issuer-registry-client 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@digitalcredentials/issuer-registry-client 需要什么版本的 Node.js?

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

@digitalcredentials/issuer-registry-client 可以商用吗?

@digitalcredentials/issuer-registry-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@digitalcredentials/issuer-registry-client 的下载量有多少?

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

@digitalcredentials/issuer-registry-client 还在维护吗?

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