概述

认证模块使应用开发者能够在与 Interchain Accounts 控制器子模块的 MsgServer 交互时执行自定义逻辑。 控制器子模块用于账户注册和数据包发送。它只执行所有 Interchain Accounts 控制器都必须具备的通用逻辑。用于管理 Interchain Accounts 的认证类型并未被限定。对于不同的使用场景,可能存在多种更合适的认证方式。因此,认证模块的作用就是在控制器子模块外封装自定义认证逻辑。 在 ibc-go 中,认证模块可以通过 baseapp 的 MsgServiceRouter 传递消息,与控制器子模块通信。实现认证模块时,无需满足 IBCModule 接口;只需像普通的 Cosmos SDK 应用模块一样,实现 Cosmos SDK 的 AppModuleBasic 接口即可。 认证模块必须:
  • 对 Interchain Account 的所有者进行认证。
  • 跟踪某个所有者关联的 Interchain Account 地址。
  • 在完成认证后,代表所有者发送数据包。

集成到 app.go 文件

要将认证模块集成到你的链中,请按照 app.go 集成 中列出的步骤进行操作。

Synopsis

Authentication modules enable application developers to perform custom logic when interacting with the Interchain Accounts controller sumbmodule’s MsgServer. The controller submodule is used for account registration and packet sending. It executes only logic required of all controllers of interchain accounts. The type of authentication used to manage the interchain accounts remains unspecified. There may exist many different types of authentication which are desirable for different use cases. Thus the purpose of the authentication module is to wrap the controller submodule with custom authentication logic. In ibc-go, authentication modules can communicate with the controller submodule by passing messages through baseapp’s MsgServiceRouter. To implement an authentication module, the IBCModule interface need not be fulfilled; it is only required to fulfill Cosmos SDK’s AppModuleBasic interface, just like any regular Cosmos SDK application module. The authentication module must:
  • Authenticate interchain account owners.
  • Track the associated interchain account address for an owner.
  • Send packets on behalf of an owner (after authentication).

Integration into app.go file

To integrate the authentication module into your chain, please follow the steps outlined in app.go integration.