Agent Skillskeychat-io/keychat-app › architecture

architecture

GitHub

解析 Keychat 应用架构,涵盖 Nostr、Signal、MLS 等核心协议及 Rust FFI 桥接,说明包结构、服务组件、GetX 状态管理和 Isar 数据库实现。

.claude/skills/architecture/SKILL.md keychat-io/keychat-app

Trigger Scenarios

询问应用整体架构设计 解释核心组件功能 理解消息加密与传输流程

Install

npx skills add keychat-io/keychat-app --skill architecture -g -y
More Options

Non-standard path

npx skills add https://github.com/keychat-io/keychat-app/tree/main/.claude/skills/architecture -g -y

Use without installing

npx skills use keychat-io/keychat-app@architecture

指定 Agent (Claude Code)

npx skills add keychat-io/keychat-app --skill architecture -a claude-code -g -y

安装 repo 全部 skill

npx skills add keychat-io/keychat-app --all -g -y

预览 repo 内 skill

npx skills add keychat-io/keychat-app --list

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 .obs observables

Database

Uses Isar (NoSQL for Flutter):

  • Models in lib/models/
  • Models use @collection annotation
  • 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

  1. User composes message
  2. Signal/MLS encrypts content
  3. Message wrapped in Nostr event
  4. Ecash stamp attached (if relay requires payment)
  5. Sent via WebSocket to Nostr relay
  6. Recipient receives, decrypts, displays

Version History

  • 294d00d Current 2026-07-05 10:51

Same Skill Collection

.claude/skills/batch/SKILL.md
.claude/skills/bootstrap/SKILL.md
.claude/skills/flutter-check/SKILL.md
.claude/skills/generate/SKILL.md
.claude/skills/lint/SKILL.md
.claude/skills/pods/SKILL.md
.claude/skills/clean/SKILL.md
.claude/skills/run/SKILL.md
.claude/skills/rust-build/SKILL.md
.claude/skills/test/SKILL.md

Metadata

Files
0
Version
0cdb462
Hash
3f9b3e5a
Indexed
2026-07-05 10:51

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-11 02:17
浙ICP备14020137号-1 $Map of visitor$