@govtechsg/dnsprove

中文文档
2.8.0发布于 2024/07/17Apache-2.0TypeScriptESM + CJS近 30 天下载 5763

Helper utility for retrieving OpenAttestations document store address records from DNS

原始使用文档
文档目录17 节
  1. Installation
  2. Debug
  3. Types
  4. API
  5. OpenAttestationDNSTextRecord
  6. OpenAttestationDnsDidRecord
  7. IDNSRecord
  8. IDNSQueryResponse
  9. CustomDnsResolver
  10. defaultDnsResolvers
  11. queryDns
  12. parseOpenAttestationRecord
  13. parseDocumentStoreResults
  14. parseDnsDidResults
  15. getDocumentStoreRecords
  16. getDnsDidRecords
  17. License

Open Attestation (dnsprove)

A helper library to retrieve OpenAttestation DNS-TXT records from domains using Google's public DNS service.

A valid OpenAttestation DNS-TXT record looks like:

[
  {
    name: "example.openattestation.com.",
    type: 16,
    TTL: 110,
    data: '"openatts net=ethereum netId=3 addr=0x2f60375e8144e16Adf1979936301D8341D58C36C"',
  },
];

Validation is run on all retrieved records to ensure they conform to the expected format, and records that fail validation will simply be omitted from the returned results.

Installation

npm i @govtechsg/dnsprove

Debug

To see validation failures run the library with the debug flag turned on, either

In Browser:

localStorage.debug="dnsprove*"

In NodeJS:

DEBUG="dnsprove*" npm run test

Types

This library uses runtypes for compile time static type checking as well as run time input validation. The generated documentation below is inaccurate for any Runtypes generated types due to documentation generator limitations.

API

Table of Contents

OpenAttestationDNSTextRecord

OpenAttestationDnsDidRecord

IDNSRecord

IDNSQueryResponse

CustomDnsResolver

Type: function (domain: string): Promise<IDNSQueryResponse>

defaultDnsResolvers

Type: Array<CustomDnsResolver>

queryDns

Parameters

Returns Promise<IDNSQueryResponse>

parseOpenAttestationRecord

Parses one openattestation DNS-TXT record and turns it into an OpenAttestationsDNSTextRecord object

Parameters

  • record string e.g: '"openatts net=ethereum netId=3 addr=0x0c9d5E6C766030cc6f0f49951D275Ad0701F81EC"'

Returns GenericObject

parseDocumentStoreResults

Takes a DNS-TXT Record set and returns openattestation document store records if any

Parameters

Returns Array<OpenAttestationDNSTextRecord>

parseDnsDidResults

Parameters

Returns Array<OpenAttestationDnsDidRecord>

getDocumentStoreRecords

Queries a given domain and parses the results to retrieve openattestation document store records if any

Parameters

Examples

> getDocumentStoreRecords("example.openattestation.com")
> [ { type: 'openatts',
net: 'ethereum',
netId: '3',
addr: '0x2f60375e8144e16Adf1979936301D8341D58C36C',
dnssec: true } ]

Returns Promise<Array<OpenAttestationDNSTextRecord>>

getDnsDidRecords

Parameters

Returns Promise<Array<OpenAttestationDnsDidRecord>>

License

MIT

版本与发布记录

@govtechsg/dnsprove 共发布 23 个版本,首次发布于 2019/07/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.8.0latest2024/07/172 年前
2.7.12024/05/082 年前
2.7.02024/04/162 年前
2.6.22023/11/103 年前
2.6.12023/07/253 年前
2.6.02023/04/183 年前

关于 @govtechsg/dnsprove 的常见问题

@govtechsg/dnsprove 是什么?

Helper utility for retrieving OpenAttestations document store address records from DNS

如何安装 @govtechsg/dnsprove?

在项目目录运行 npm install @govtechsg/dnsprove,或使用 pnpm add / yarn add / bun add。

@govtechsg/dnsprove 支持 TypeScript 吗?

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

@govtechsg/dnsprove 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@govtechsg/dnsprove 可以商用吗?

@govtechsg/dnsprove 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@govtechsg/dnsprove 的下载量有多少?

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

@govtechsg/dnsprove 还在维护吗?

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