# 3id-resolver 中文文档

规范地址：https://npmcn.com/package/3id-resolver/

版本：1\.0\.1
npm 元数据更新时间：2024-10-23T15:43:11.606Z
中文译文更新时间：2026-11-06T12:25:39.277Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/3id-resolver
原文对照：https://npmcn.com/package/3id-resolver/?lang=original
项目主页：https://github.com/uport-project/muport-did-resolver#readme
源码仓库：https://github.com/uport-project/muport-did-resolver

弃用说明：Deprecated in favor of Ceramic: https://developers\.ceramic\.network

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：20.7 kB，6 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：5 个
- 首次发布：2019-05-16T09:24:47.862Z
- 最新版本发布：2020-07-02T17:46:45.152Z
- 近 30 天下载量：3209（2026-10-04 至 2026-11-02，npm 官方下载统计）
- 已发布版本数：9（近 12 个月 0 个）

## 中文简介

解析3ID 文档

## 安装

```sh
npm install 3id-resolver
```

也可以使用：`pnpm add 3id-resolver`、`yarn add 3id-resolver`、`bun add 3id-resolver`

## README

# 3ID 解析器

此库旨在解析 3IDDD 文档 。 3ID是一种稀薄的身份协议,使用ipfs和etheum来发布和旋转身份所使用的密码密钥.

它支持拟议的 [分散式标识符](https://w3c-ccg.github.io/did-spec/) 从 [W3C 证书社区小组](https://w3c-ccg.github.io/)。 。 。 .

它要求 `did-resolver` 库,是解析 DIDs 的主要接口.

## 解析已执行的文档

将 IPFS 实例传递给 `getResolver()` 函数。 使用返回的解析器必须传递给 `did-resolver` 例如:

```js
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')
```

见 [已解析文件](https://github.com/decentralized-identity/did-resolver) 用于更一般的使用信息 .

结果 :

```js
{
  '@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'
  }]
}
```

## 维护者

[@ooed (英语)](https://github.com/oed)

## 常见问题

### 3id-resolver 是什么？

解析3ID 文档注意：该包已被作者标记为弃用——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。作者已将其标记为弃用，新项目建议寻找替代方案。

