已知发行人注册客户端 (@数字证书/签发人-登记人-客户)
在已知发行人/已知验证人中查找的Isomorphic客户端 登记。 对于节点,浏览器和React Induct.
目录
说明
这是一个客户端库,在其中之一查找DIS:
- 使用 /fetch 的 OIDF 注册 ? 子= oidf 端点以查看已完成的, 将其传递为“ sub” 参数的值
- 以DCC以前使用的格式编码的DDs的静态列表 成员和社区注册, 并公开服务, 像这个: https://github.com/digitalcreditis/dcc-community-registry/registry.json 互联网档案馆的存檔,存档日期2013-12-22
请注意,个人在多个登记册中可以出现。 因为这样, 页:1 顺序 登记事项。 例如,提供一份登记册清单:
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'
}
]
如果两个登记处都包含一个签发人Did,则签发人输入 (包含发行人名称和URL)将来自 第一个 登记册, "DCC成员注册".
换言之,核查人和其他执行人必须下令登记 内 从最权威到最少的顺序。 。 。 .
安装
- 建议节点.js 24+.
国家预防机制
通过国家预防机制安装:
npm install @digitalcredentials/issuer-registry-client
发展
这个项目使用 小时本地安装(用于 发展:
git clone https://github.com/digitalcredentials/issuer-registry-client.git
cd issuer-registry-client
pnpm install
构建、提供和测试:
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
使用量
您需要一系列已知的 发行人和核查人注册 核对,例如公开的DCC已知登记册副本:
截至2025年4月22日,情况如此(为方便起见,在此转载):
[
{
"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"
}
]
你用这个列表:
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'))
查询返回 :
- 已登记所提供DAD的发行人名单
- 任何登记册的清单(来自所提供的已知发行人名单) 选中
每个返回的发行商包括发行商的元数据,以及发行商的元数据 签发人登记的登记处.
供应你自己 fetch
每一个登记请求都通过 globalThis.fetch 默认。 传出 a
fetch 自己来接手 - 应用超时,添加信头,服务
从缓存中获取,或到达一个登记册,运行时间不能直接请求(在
浏览器, 一个不发送 CORS 信头的浏览器, 否则会返回
uncheckedRegistries数字 :
const registryClient = new RegistryClient({
fetch: async url =>
await fetch(`https://gateway.example/fetch?url=${encodeURIComponent(url)}`)
})
它被称为 URL并返回 a Response完全一样 fetch。 。 。 .
注意,它被称为客户的一种方法, 所以一个赤裸裸的全球参考 -
{ fetch } 或者说 { fetch: globalThis.fetch } - 这是一个独立的呼叫。 在浏览器中
抛出 TypeError: Illegal invocation,每个注册都回来
uncheckedRegistries如上所举,将其包起来,或将其捆绑起来:
const registryClient = new RegistryClient({
fetch: globalThis.fetch.bind(globalThis)
})
以下是一个保存在一个遗产中的 DD 的搜索回复 注册,一个OIDF注册, 并列出一个无法检查的注册 由于某种原因(例如,服务器已关闭) :
{
"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"
}
]
}
贡献
公关接受.
请遵照 标准读取 规格.
许可证
MIT 许可证 2025年数字证书联合会.