3id-resolver

中文文档
1.0.1发布于 2020/07/03MITCommonJS近 30 天下载 3209

Resolve 3ID documents

此软件包已被标记为弃用

Deprecated in favor of Ceramic: https://developers.ceramic.network

原始使用文档

3ID Resolver

This library is intended to resolve 3ID DID documents. 3ID is a thin identity protocol that uses ipfs and ethereum to publish and rotate the cryptographic keys used by an identity.

It supports the proposed Decentralized Identifiers spec from the W3C Credentials Community Group.

It requires the did-resolver library, which is the primary interface for resolving DIDs.

Resolving a DID document

A 3ID resolver is created by passing an IPFS instance to the getResolver() function. To use the resolver returned, it must be passed to a did-resolver instance during instantiation, for example:

import { Resolver } from 'did-resolver'
import { getResolver } from '3id-resolver'

const threeIdResolver = getResolver(ipfs)
const resolver = new Resolver(threeIdResolver)

resolver.resolve('did:3:QmRhjfL4HLdB8LovGf1o43NJ8QnbfqmpdnTuBvZTewnuBV').then(doc => console.log)

// You can also use ES7 async/await syntax
const doc = await resolver.resolve('did:muport:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf')

See the did-resolver docs for more general usage information on DID resolvers.

Result:

{
  '@context': 'https://w3id.org/did/v1',
  id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf',
  publicKeys: [ {
    id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#signingKey',
    type: 'Secp256k1VerificationKey2018',
    publicKeyHex: '03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479'
  }, {
    id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#encryptionKey',
    type: 'Curve25519EncryptionPublicKey',
    publicKeyBase64: 'fake encryptionKey'
  }, {
    id: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#managementKey',
    type: 'Secp256k1VerificationKey2018',
    ethereumAddress: 'fake eth addr'
  }],
  authentication: [{
    type: 'Secp256k1SignatureAuthentication2018',
    publicKey: 'did:3:zdpuAt4qH8ur3vHpVrP1xb7rtJuyVUVbRiGatkkVcJZRgAXDf#signingKey'
  }]
}

Maintainers

@oed

版本与发布记录

3id-resolver 共发布 9 个版本,首次发布于 2019/05/16;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.1latest2020/07/036 年前
1.0.02020/04/246 年前
0.0.62019/08/017 年前
0.0.52019/05/307 年前
0.0.5-beta.1next2019/05/307 年前
0.0.42019/05/177 年前

关于 3id-resolver 的常见问题

3id-resolver 是什么?

Resolve 3ID documents注意:该包已被作者标记为弃用——Deprecated in favor of Ceramic: https://developers.ceramic.network

如何安装 3id-resolver?

在项目目录运行 npm install 3id-resolver,或使用 pnpm add / yarn add / bun add。

3id-resolver 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/3id-resolver 是否存在。

3id-resolver 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

3id-resolver 可以商用吗?

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

3id-resolver 的下载量有多少?

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

3id-resolver 还在维护吗?

最新版本 1.0.1 发布于 2020/07/03(6 年前);至今共发布 9 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/05/16。作者已将其标记为弃用,新项目建议寻找替代方案。