@2060.io/credo-ts-didcomm-receipts

中文文档
0.1.1发布于 2026/03/12Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 1798

DIDComm Message Receipts protocol implementation for @credo-ts/core

原始使用文档
文档目录9 节
  1. Overview
  2. Installation
  3. Usage
  4. Sending Message Receipts
  5. Requesting Message Receipts
  6. Handling Receipt Events
  7. Features
  8. API Reference
  9. License

Credo Extension Module for Message Receipts Protocol

Credo logo

License TypeScript @2060.io/credo-ts-didcomm-receipts

Overview

The Message Receipts extension module for Credo enables agents to manage Receipts protocol, allowing tracking and acknowledgment of message states (e.g., received, viewed) between agents.

Installation

npm install @2060.io/credo-ts-didcomm-receipts

Usage

Adding the Module to Your Agent To use the Receipts module, add it to your agent's modules configuration:

import { ReceiptsModule } from '@2060.io/credo-ts-didcomm-receipts'

const agent = new Agent({
  modules: {
    // ...other modules
    receipts: new ReceiptsModule(),
  },
})

Sending Message Receipts

To send message receipts (e.g., when a message is received or viewed):

await agent.modules.receipts.send({
  connectionId: connection.id,
  receipts: [
    { messageId: 'message-id', state: MessageState.Received },
    { messageId: 'message-id', state: MessageState.Viewed },
  ],
})

Requesting Message Receipts

To request receipts for specific messages or message types:

await agent.modules.receipts.request({
  connectionId: connection.id,
  requestedReceipts: [
    {
      messageType: 'https://didcomm.org/my-protocol/1.0/my-message',
      states: [MessageState.Received, MessageState.Viewed],
    },
  ],
})

Handling Receipt Events

Subscribe to receipt events to react to incoming receipts:

import { ReceiptsEventTypes, MessageReceiptsReceivedEvent } from '@2060.io/credo-ts-didcomm-receipts'

agent.events.on(ReceiptsEventTypes.MessageReceiptsReceived, async ({ payload }: MessageReceiptsReceivedEvent) => {
  const connectionId = payload.connectionId
  const receipts = payload.receipts

  receipts.forEach((receipt) => {
    const { messageId, timestamp, state } = receipt
    sendMessageStateUpdatedEvent({ agent, messageId, connectionId, state, timestamp, config })
  })
})

Features

  • Send Message Receipts: Notify other agents about message states (received, viewed, etc.).
  • Request Receipts: Ask for receipts for specific messages or message types.
  • Event Subscription: Listen for receipt events to update UI or trigger workflows.
  • Protocol Integration: Seamless integration with Credo agent and DIDComm protocols.

API Reference

See the source code for details on available classes and methods:

License

Apache 2.0


For more information, see the didcomm.org.

版本与发布记录

@2060.io/credo-ts-didcomm-receipts 共发布 4 个版本,首次发布于 2025/02/16;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.1latest2026/03/127 个月前
0.1.02026/03/117 个月前
0.0.82025/12/1910 个月前
0.0.72025/02/161.7 年前

关于 @2060.io/credo-ts-didcomm-receipts 的常见问题

@2060.io/credo-ts-didcomm-receipts 是什么?

DIDComm Message Receipts protocol implementation for @credo-ts/core

如何安装 @2060.io/credo-ts-didcomm-receipts?

在项目目录运行 npm install @2060.io/credo-ts-didcomm-receipts,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@credo-ts/core(^0.6.1)、@credo-ts/didcomm(^0.6.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@2060.io/credo-ts-didcomm-receipts 支持 TypeScript 吗?

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

@2060.io/credo-ts-didcomm-receipts 支持 ESM 还是 CommonJS?

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

@2060.io/credo-ts-didcomm-receipts 可以商用吗?

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

@2060.io/credo-ts-didcomm-receipts 的下载量有多少?

根据 npm 官方下载统计,@2060.io/credo-ts-didcomm-receipts 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,798 次,日均约 60 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@2060.io/credo-ts-didcomm-receipts 还在维护吗?

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