Agent Skills
› keychat-io/keychat-app
› architecture
architecture
GitHub描述Keychat安全消息应用的架构,涵盖Nostr、Signal和MLS加密技术、Flutter包结构、GetX状态管理、Isar数据库及Rust FFI桥接。重点解析消息从加密到通过WebSocket发送至Nostr中继的完整流程。
Trigger Scenarios
询问Keychat应用的技术架构
解释核心组件如信号或MLS协议
了解代码库目录结构和包依赖
Install
npx skills add keychat-io/keychat-app --skill architecture -g -y
SKILL.md
Frontmatter
{
"name": "architecture",
"description": "Explains the Keychat app architecture and key components",
"user-invocable": true,
"disable-model-invocation": false
}
Keychat is a secure messaging app with a unique architecture. When explaining or working with the codebase, understand these key components:
Core Technologies
| Technology | Purpose | Implementation |
|---|---|---|
| Nostr Protocol | Message delivery/storage | lib/nostr-core/, WebSocket connections |
| Signal Protocol | 1:1 E2E encryption | api_signal.rs via FFI |
| MLS Protocol | Group E2E encryption | api_mls.rs via FFI |
| Bitcoin Ecash | Micropayments to relays | api_cashu.rs, keychat_ecash/ |
Package Structure
packages/
├── app/ # Main Flutter app
├── keychat_ecash/ # Ecash wallet functionality
└── keychat_rust_ffi_plugin/ # Native crypto via Rust
Key Services (packages/app/lib/service/)
- signal_chat.service.dart - Signal protocol session management
- mls_group.service.dart - MLS group key operations
- websocket.service.dart - Nostr relay connections
- chat.service.dart - High-level message routing
- relay.service.dart - Relay management
- identity.service.dart - User identity management
State Management
Uses GetX pattern:
- Controllers in
lib/controller/ - Services are singleton instances
- Reactive state with
.obsobservables
Database
Uses Isar (NoSQL for Flutter):
- Models in
lib/models/ - Models use
@collectionannotation - Generated code via build_runner (*.g.dart, *.isar.dart)
Rust FFI Bridge
Native crypto operations use flutter_rust_bridge:
- Rust code:
packages/keychat_rust_ffi_plugin/rust/src/ - Generated Dart bindings:
packages/keychat_rust_ffi_plugin/lib/ - Key APIs: Cashu, Nostr, Signal, MLS
Message Flow
- User composes message
- Signal/MLS encrypts content
- Message wrapped in Nostr event
- Ecash stamp attached (if relay requires payment)
- Sent via WebSocket to Nostr relay
- Recipient receives, decrypts, displays
Version History
- 294d00d Current 2026-07-05 10:51


