{"_id":"@arthas-chat/openclaw-channel","_rev":"6-c325b63bcf016e08e5b58414d4702a8a","name":"@arthas-chat/openclaw-channel","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@arthas-chat/openclaw-channel","version":"1.0.0","keywords":["openclaw","arthas","e2ee","channel","ai-agent","end-to-end-encryption","aes-256-gcm"],"author":{"name":"Arthas Contributors"},"license":"AGPL-3.0","_id":"@arthas-chat/openclaw-channel@1.0.0","maintainers":[{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"}],"dist":{"shasum":"c772c91177686c050c8d0a2b75908ef99d02a59e","tarball":"https://registry.npmjs.org/@arthas-chat/openclaw-channel/-/openclaw-channel-1.0.0.tgz","fileCount":42,"integrity":"sha512-FkK3eHH6Ap/d5xGFQxpFWhv1m/9R0eg/9Eg2ohDlk1wOPszvWSCA/nqrVcoAnEuDteaiE/aeMUqKeJDW7vX3bw==","signatures":[{"sig":"MEUCIDKdMVHqQVjvOQkUCfoMQqP+ix8gIlA+nTG2ve0w4BZwAiEA4tm3Dkq6/srDBAqeXdcU/SF9Qs45Q7pXe4gc1/Ea0ns=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":345894},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"b41783f052a01766e282880675ed6b4edff72ac2","scripts":{"test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"},"openclaw":{"channels":{"arthas":{"name":"Arthas E2EE Chat","description":"End-to-end encrypted communication channel via Arthas"}}},"_npmVersion":"11.6.2","description":"OpenClaw Channel Plugin for Arthas E2EE Chat — 将 Arthas 端到端加密聊天暴露为 AI Agent 通信通道","directories":{},"_nodeVersion":"24.11.1","dependencies":{"ws":"^8.18.0","@msgpack/msgpack":"^3.0.0-beta2"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","@types/ws":"^8.5.13","fast-check":"^4.8.0","typescript":"^5.7.2","@vitest/coverage-v8":"^4.1.7"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-channel_1.0.0_1779955704492_0.5222343760769541","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arthas-chat/openclaw-channel","version":"1.0.1","keywords":["openclaw","arthas","e2ee","channel","ai-agent","end-to-end-encryption","aes-256-gcm"],"author":{"name":"Arthas Contributors"},"license":"MIT","_id":"@arthas-chat/openclaw-channel@1.0.1","maintainers":[{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"}],"dist":{"shasum":"b440df0f8e2870a3f07dfc1a9aaa70322868e744","tarball":"https://registry.npmjs.org/@arthas-chat/openclaw-channel/-/openclaw-channel-1.0.1.tgz","fileCount":42,"integrity":"sha512-LQzIB22qB+/go0PmMD24LBVGL1YUr2oj9cr2LOhgm22D/QoBsqdxwErFFvA/8ZCE7bTKMxGO2z6qPm9E4kZmMQ==","signatures":[{"sig":"MEUCIEj236cCV1NLQ/UO2DKNX2mZfNfWBzNVH/sKgyQZ64s3AiEAvy4LmafTQk4ky02bdsj9oLEjq+Btpk/TgoZy2+ZDze0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":352547},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"316e5a5623db9701b3773eeae2d2a35489ba1859","scripts":{"test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"},"openclaw":{"channels":{"arthas":{"name":"Arthas E2EE Chat","description":"End-to-end encrypted communication channel via Arthas"}}},"_npmVersion":"11.6.2","description":"OpenClaw Channel Plugin for Arthas E2EE Chat — 将 Arthas 端到端加密聊天暴露为 AI Agent 通信通道","directories":{},"_nodeVersion":"24.11.1","dependencies":{"ws":"^8.18.0","@msgpack/msgpack":"^3.0.0-beta2"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","@types/ws":"^8.5.13","fast-check":"^4.8.0","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-channel_1.0.1_1780386495857_0.1277564539553464","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@arthas-chat/openclaw-channel","version":"1.0.2","keywords":["openclaw","arthas","e2ee","channel","ai-agent","end-to-end-encryption","aes-256-gcm"],"author":{"name":"Arthas Contributors"},"license":"MIT","_id":"@arthas-chat/openclaw-channel@1.0.2","maintainers":[{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"}],"dist":{"shasum":"5704504505596fbdb68df3fe1d95f20f855a97f6","tarball":"https://registry.npmjs.org/@arthas-chat/openclaw-channel/-/openclaw-channel-1.0.2.tgz","fileCount":42,"integrity":"sha512-T+iRCqNloN4Moz+87Vor29rQWNTqhZtD9hj9FYFlxdkOH2A4/ck/4MkUw5iV0W7tdztEkS1CdF91wVAKHTwrpA==","signatures":[{"sig":"MEYCIQCj9TK+wUQ7SDiz4Z+3TSt/oZmZ1sN2JyUOkAr9R9sGiwIhAL68GvRMcuEe0GFCnHDohCK0HQKKfXl1FmtiDOw5N3k9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":352575},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"316e5a5623db9701b3773eeae2d2a35489ba1859","scripts":{"test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"},"openclaw":{"channels":{"arthas":{"name":"Arthas E2EE Chat","description":"End-to-end encrypted communication channel via Arthas"}}},"_npmVersion":"11.6.2","description":"OpenClaw Channel Plugin for Arthas E2EE Chat — 将 Arthas 端到端加密聊天暴露为 AI Agent 通信通道","directories":{},"_nodeVersion":"24.11.1","dependencies":{"ws":"^8.18.0","@msgpack/msgpack":"^3.0.0-beta2"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","@types/ws":"^8.5.13","fast-check":"^4.8.0","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-channel_1.0.2_1780387342828_0.05286406608142591","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@arthas-chat/openclaw-channel","version":"1.0.3","keywords":["openclaw","arthas","e2ee","channel","ai-agent","end-to-end-encryption","aes-256-gcm"],"author":{"name":"Arthas Contributors"},"license":"MIT","_id":"@arthas-chat/openclaw-channel@1.0.3","maintainers":[{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"}],"dist":{"shasum":"143ee0b2f2d489d89e33bb8d7e20f295d2e764fb","tarball":"https://registry.npmjs.org/@arthas-chat/openclaw-channel/-/openclaw-channel-1.0.3.tgz","fileCount":42,"integrity":"sha512-frhdJz7oPwCsFptsrGoLbGKDju8u/61pkXo8CKqrMSqEQpOCFSsQH0GdGxM4gDk37oyfcOjVdBTci9p6rPOkvw==","signatures":[{"sig":"MEUCIGTR1QM/ZJaG5uNR6WA8HFMAhS2NSEnTkchGNNjNysY1AiEA+UZoR0tBZ1zK5jcrbnjp6ycgUbMIDoC0GnIS2VUdqW8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":352795},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"316e5a5623db9701b3773eeae2d2a35489ba1859","scripts":{"test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"},"openclaw":{"channels":{"arthas":{"name":"Arthas E2EE Chat","description":"End-to-end encrypted communication channel via Arthas"}}},"_npmVersion":"11.6.2","description":"OpenClaw Channel Plugin for Arthas E2EE Chat — 将 Arthas 端到端加密聊天暴露为 AI Agent 通信通道","directories":{},"_nodeVersion":"24.11.1","dependencies":{"ws":"^8.18.0","@msgpack/msgpack":"^3.0.0-beta2"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","@types/ws":"^8.5.13","fast-check":"^4.8.0","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-channel_1.0.3_1780387984516_0.565850423176546","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@arthas-chat/openclaw-channel","version":"1.0.4","keywords":["openclaw","arthas","e2ee","channel","ai-agent","end-to-end-encryption","aes-256-gcm"],"author":{"name":"Arthas Contributors"},"license":"MIT","_id":"@arthas-chat/openclaw-channel@1.0.4","maintainers":[{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"}],"dist":{"shasum":"bb34a6a51daf6e397b845eae3ba5797808f70a07","tarball":"https://registry.npmjs.org/@arthas-chat/openclaw-channel/-/openclaw-channel-1.0.4.tgz","fileCount":42,"integrity":"sha512-7LKTBnlBhI99eQbOD/oVF7yNCqmk5Q0NXBKC0wA9dUjnFmxI10vZ61dI1fg/i9vTQZ2ubtGGBWZV7cegPK8WQQ==","signatures":[{"sig":"MEQCIAQZU5wjTYZ9riqfgnX1OB9OBHCGd171YcPG51UwsSPlAiB+1DA41Sk2xh9O+ti7XtaKFRQ0AmedDJRqfxhQPUKO5A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":347627},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"316e5a5623db9701b3773eeae2d2a35489ba1859","scripts":{"test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"},"openclaw":{"channels":{"arthas":{"name":"Arthas E2EE Chat","description":"End-to-end encrypted communication channel via Arthas"}}},"_npmVersion":"11.6.2","description":"OpenClaw Channel Plugin for Arthas E2EE Chat — 将 Arthas 端到端加密聊天暴露为 AI Agent 通信通道","directories":{},"_nodeVersion":"24.11.1","dependencies":{"ws":"^8.18.0","@msgpack/msgpack":"^3.0.0-beta2"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","@types/ws":"^8.5.13","fast-check":"^4.8.0","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-channel_1.0.4_1780391488717_0.9778651586250531","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@arthas-chat/openclaw-channel","version":"1.0.5","description":"Arthas Node.js SDK for AI agents — connect any LLM to an E2EE encrypted chat room with AES-256-GCM","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","test":"vitest run","test:watch":"vitest","clean":"rm -rf dist","prepublishOnly":"npm run build"},"keywords":["openclaw","arthas","e2ee","channel","ai-agent","end-to-end-encryption","aes-256-gcm"],"author":{"name":"Arthas Contributors"},"license":"MIT","dependencies":{"@msgpack/msgpack":"^3.0.0-beta2","ws":"^8.18.0"},"devDependencies":{"@types/ws":"^8.5.13","fast-check":"^4.8.0","typescript":"^5.7.2","vitest":"^4.1.6"},"engines":{"node":">=18.0.0"},"openclaw":{"channels":{"arthas":{"name":"Arthas E2EE Chat","description":"End-to-end encrypted communication channel via Arthas"}}},"gitHead":"316e5a5623db9701b3773eeae2d2a35489ba1859","_id":"@arthas-chat/openclaw-channel@1.0.5","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-81I67QpBnd6sbEM3ILbGE8hPjfLsfI01FrVXe59daJJJJTTeO3dMsfq0vl9Fz3W1IVpCGgKngSZplL4oJCHpiQ==","shasum":"a402ad53252ab45de902ecb54237e8ae9d9abe09","tarball":"https://registry.npmjs.org/@arthas-chat/openclaw-channel/-/openclaw-channel-1.0.5.tgz","fileCount":42,"unpackedSize":347615,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF+Pjberr8dInovSauVE0j5ZfrJJrZdtRYoUv7QPTcUoAiEAwu0Tp83MwLRaJd547W2ugBEwzFcNUvuTB0kgRVtvCLQ="}]},"_npmUser":{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"},"directories":{},"maintainers":[{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-channel_1.0.5_1780391868531_0.7573039477060695"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-28T08:08:24.332Z","modified":"2026-06-02T09:17:48.834Z","1.0.0":"2026-05-28T08:08:24.744Z","1.0.1":"2026-06-02T07:48:16.075Z","1.0.2":"2026-06-02T08:02:23.005Z","1.0.3":"2026-06-02T08:13:04.756Z","1.0.4":"2026-06-02T09:11:28.857Z","1.0.5":"2026-06-02T09:17:48.682Z"},"author":{"name":"Arthas Contributors"},"license":"MIT","keywords":["openclaw","arthas","e2ee","channel","ai-agent","end-to-end-encryption","aes-256-gcm"],"description":"Arthas Node.js SDK for AI agents — connect any LLM to an E2EE encrypted chat room with AES-256-GCM","maintainers":[{"name":"michaelwang100","email":"beautifullifestrive@gmail.com"}],"readme":"# @arthas-chat/openclaw-channel\r\n\r\n📖 [Documentation](https://michaelwang123.github.io/arthas/openclaw-channel/) | [中文文档](https://michaelwang123.github.io/arthas/zh/openclaw-channel/)\r\n\r\nArthas Node.js client SDK for server-side AI agents — connect any LLM to an [Arthas](https://github.com/michaelwang123/arthas) encrypted chat room in 10 lines of code. The server never sees your prompts or the AI's responses.\r\n\r\n> **About the name:** \"openclaw-channel\" in the package name is a legacy label. Functionally this is Arthas's Node.js SDK, designed specifically for server-side (AI agent) use cases. It handles WebSocket connection, Arthas binary protocol, AES-256-GCM encryption, file transfer, and auto-reconnection — so you only write the LLM logic.\r\n\r\n## Quick Start (3 steps, 2 minutes)\r\n\r\nA free public server is running — no signup, no setup needed.\r\n\r\n### 1. Install\r\n\r\n```bash\r\nnpm install @arthas-chat/openclaw-channel\r\n```\r\n\r\nRequires Node.js >= 18.\r\n\r\n### 2. Get a share code (create an encrypted room)\r\n\r\nThe share code contains both the room address and the AES-256 encryption key. Create one using the CLI:\r\n\r\n```bash\r\n# Download CLI (single binary, zero dependencies)\r\ncurl -L https://github.com/michaelwang123/arthas/releases/latest/download/arthas-cli -o arthas-cli\r\nchmod +x arthas-cli\r\n\r\n# Create room → outputs share code (key generated locally, never sent to server)\r\n./arthas-cli create --server wss://arthas100-arthas-server.hf.space/ws --name \"My AI Room\"\r\n\r\n# ✓ Room created! Share code:\r\n# QYEq9uxfKP9h-KCUsPUay:NlZezXoUErYr92grhif3Y-Hy3FOOK1ocb3WocCJJrQM\r\n```\r\n\r\nOr create a room from the [web UI](https://michaelwang123.github.io/arthas/) and copy the share code from the share dialog.\r\n\r\n### 3. Connect your AI agent\r\n\r\n```typescript\r\nimport { ArthasChannelAdapter } from '@arthas-chat/openclaw-channel';\r\n\r\nconst adapter = new ArthasChannelAdapter();\r\n\r\nadapter.onMessage(async (message) => {\r\n  // message.text is already decrypted — E2EE handled by the SDK\r\n  const response = await yourLLM.generate(message.text);\r\n  await adapter.send({ id: crypto.randomUUID(), channelId: 'arthas', text: response });\r\n});\r\n\r\nawait adapter.connect({\r\n  serverUrl: 'wss://arthas100-arthas-server.hf.space/ws',\r\n  shareCode: 'QYEq9uxfKP9h-KCUsPUay:NlZezXoUErYr92grhif3Y-Hy3FOOK1ocb3WocCJJrQM',\r\n  displayName: 'AI Assistant',\r\n});\r\n```\r\n\r\nNow chat with your AI from the CLI or web — everything is encrypted end-to-end:\r\n\r\n```bash\r\n./arthas-cli join QYEq9uxfKP9h-KCUsPUay:NlZezXoUErYr92grhif3Y-Hy3FOOK1ocb3WocCJJrQM \\\r\n  --server wss://arthas100-arthas-server.hf.space/ws --name \"Michael\"\r\n\r\n> What's the capital of France?\r\nAI Assistant: The capital of France is Paris.\r\n```\r\n\r\n---\r\n\r\n## Real-World Example: OpenAI GPT Agent\r\n\r\nA complete, runnable example connecting GPT-4o-mini to an encrypted room:\r\n\r\n```typescript\r\n// agent.ts\r\nimport { ArthasChannelAdapter } from '@arthas-chat/openclaw-channel';\r\nimport OpenAI from 'openai';\r\n\r\nconst openai = new OpenAI(); // uses OPENAI_API_KEY env var\r\nconst adapter = new ArthasChannelAdapter();\r\n\r\nconst history: Array<{ role: 'user' | 'assistant'; content: string }> = [];\r\n\r\nadapter.onMessage(async (message) => {\r\n  history.push({ role: 'user', content: message.text });\r\n\r\n  const completion = await openai.chat.completions.create({\r\n    model: 'gpt-4o-mini',\r\n    messages: [\r\n      { role: 'system', content: 'You are a helpful assistant.' },\r\n      ...history,\r\n    ],\r\n  });\r\n\r\n  const reply = completion.choices[0].message.content ?? '';\r\n  history.push({ role: 'assistant', content: reply });\r\n\r\n  await adapter.send({ id: crypto.randomUUID(), channelId: 'arthas', text: reply });\r\n});\r\n\r\nadapter.onStatusChange((status) => {\r\n  console.log(`[Agent] Connection: ${status}`);\r\n});\r\n\r\nawait adapter.connect({\r\n  serverUrl: process.env.ARTHAS_SERVER_URL!,\r\n  shareCode: process.env.ARTHAS_SHARE_CODE!,\r\n  displayName: 'GPT Assistant',\r\n});\r\n\r\nconsole.log('[Agent] Running. Ctrl+C to stop.');\r\n```\r\n\r\nRun it:\r\n\r\n```bash\r\nexport ARTHAS_SERVER_URL=wss://arthas100-arthas-server.hf.space/ws\r\nexport ARTHAS_SHARE_CODE=your-share-code-here\r\nexport OPENAI_API_KEY=sk-...\r\n\r\nnpx tsx agent.ts\r\n```\r\n\r\n---\r\n\r\n## How It Works\r\n\r\nThis SDK is a standalone Node.js client for Arthas encrypted rooms. Under the hood it:\r\n\r\n1. **Connects** to the Arthas server via WebSocket (binary MessagePack protocol)\r\n2. **Joins** the room using the roomId from the share code\r\n3. **Decrypts** incoming messages with the AES-256-GCM key from the share code\r\n4. **Encrypts** outgoing messages before sending\r\n5. **Reconnects** automatically with exponential backoff (1s → 30s max)\r\n\r\n```\r\nYou (CLI/Web)              Arthas Server (blind relay)         AI Agent (this SDK)\r\n     │                            │                                  │\r\n     │── AES-256-GCM encrypt ──→  │── forward ciphertext ──→         │\r\n     │                            │                                  │→ decrypt → LLM → encrypt\r\n     │                            │  ←── forward ciphertext ──       │\r\n     │← AES-256-GCM decrypt ──   │                                  │\r\n```\r\n\r\nThe server only sees encrypted binary blobs. It cannot read, store, or parse message content. It cannot distinguish human traffic from AI traffic.\r\n\r\n---\r\n\r\n## Configuration\r\n\r\n### Environment Variables\r\n\r\n| Variable | Required | Description | Example |\r\n|----------|----------|-------------|---------|\r\n| `ARTHAS_SERVER_URL` | Yes | WebSocket URL | `wss://arthas100-arthas-server.hf.space/ws` |\r\n| `ARTHAS_SHARE_CODE` | Yes | Room share code (roomId + key) | `abc123:dGhpcyBpcyBhIGtleQ` |\r\n| `ARTHAS_DISPLAY_NAME` | No | Agent's name in room (default: `AI Assistant`) | `Code Bot` |\r\n| `ARTHAS_SIGNING_ENABLED` | No | Ed25519 message signing (default: `false`) | `true` |\r\n| `ARTHAS_ROOM_PASSWORD` | No | For password-protected rooms | `secret` |\r\n\r\n### Programmatic Config\r\n\r\n```typescript\r\nawait adapter.connect({\r\n  serverUrl: 'wss://arthas100-arthas-server.hf.space/ws',\r\n  shareCode: 'roomId:base64Key',\r\n  displayName: 'My Agent',\r\n  signingEnabled: false,\r\n});\r\n```\r\n\r\n### Share Code Format\r\n\r\n```\r\nroomId:base64Key[:ephemeralFlag[:expiresAt]]\r\n  │       │          │              │\r\n  │       │          │              └─ Unix timestamp (0 = no expiry)\r\n  │       │          └─ 0 or 1 (ephemeral room)\r\n  │       └─ Base64url AES-256 key (43 chars)\r\n  └─ Room ID (21 chars, NanoID)\r\n```\r\n\r\nMinimum required: `roomId:base64Key`. The ephemeral and expiry segments are optional.\r\n\r\n---\r\n\r\n## API Reference\r\n\r\n### ArthasChannelAdapter\r\n\r\n```typescript\r\nimport { ArthasChannelAdapter } from '@arthas-chat/openclaw-channel';\r\n\r\nconst adapter = new ArthasChannelAdapter();\r\n\r\n// Connect to an encrypted room\r\nawait adapter.connect(config);\r\n\r\n// Listen for decrypted messages from other room participants\r\nadapter.onMessage((msg) => {\r\n  msg.text;         // decrypted message text\r\n  msg.userName;     // sender's display name\r\n  msg.attachments;  // file attachments (if any)\r\n});\r\n\r\n// Send an encrypted response\r\nawait adapter.send({\r\n  id: crypto.randomUUID(),\r\n  channelId: 'arthas',\r\n  text: 'Hello!',\r\n});\r\n\r\n// Monitor connection status\r\nadapter.onStatusChange((status) => {\r\n  // 'connected' | 'disconnected' | 'reconnecting' | 'error'\r\n});\r\n\r\n// Disconnect (zeroes encryption keys from memory)\r\nawait adapter.disconnect();\r\n```\r\n\r\n### File Transfer\r\n\r\nSupports encrypted file exchange (up to 5MB):\r\n\r\n```typescript\r\n// Receiving files\r\nadapter.onMessage((msg) => {\r\n  if (msg.attachments?.length) {\r\n    for (const file of msg.attachments) {\r\n      console.log(`${file.fileName} (${file.size} bytes)`);\r\n      // file.data is a Buffer with decrypted content\r\n    }\r\n  }\r\n});\r\n\r\n// Sending files\r\nawait adapter.send({\r\n  id: crypto.randomUUID(),\r\n  channelId: 'arthas',\r\n  text: 'Here is the analysis:',\r\n  attachments: [{\r\n    fileName: 'report.pdf',\r\n    mimeType: 'application/pdf',\r\n    size: buffer.length,\r\n    data: buffer,\r\n  }],\r\n});\r\n```\r\n\r\n---\r\n\r\n## Security\r\n\r\n| Server CAN see | Server CANNOT see |\r\n|----------------|-------------------|\r\n| Message timestamps | Message content |\r\n| Ciphertext sizes | File contents |\r\n| Connection status | Sender names (encrypted) |\r\n| Room membership events | Encryption keys |\r\n\r\n- **AES-256-GCM** with unique random 12-byte IV per message\r\n- **Authenticated encryption** — tampering detected via 16-byte auth tag\r\n- **Keys in memory only** — never written to disk, zeroed on `disconnect()`\r\n- **Optional Ed25519 signing** — verify messages came from your agent (TOFU model)\r\n- **WSS (TLS 1.2+)** enforced in production — double encryption layer\r\n\r\n---\r\n\r\n## Troubleshooting\r\n\r\n| Error | Fix |\r\n|-------|-----|\r\n| `缺少必填配置: serverUrl` | Set `ARTHAS_SERVER_URL` env var |\r\n| `缺少必填配置: shareCode` | Set `ARTHAS_SHARE_CODE` — create a room first (see Quick Start step 2) |\r\n| `serverUrl 格式无效` | URL must start with `wss://` (production) or `ws://` (local dev only) |\r\n| `消息解密失败` | Share code is from a different room or was regenerated — get a fresh one |\r\n| Keeps reconnecting | Check: server URL reachable? Firewall allows 443? Room password set if needed? |\r\n\r\nReconnection uses exponential backoff: 1s → 2s → 4s → ... → 30s max.\r\n\r\n---\r\n\r\n## Development\r\n\r\n```bash\r\ncd packages/openclaw-channel\r\nnpm install\r\nnpm run build    # TypeScript → dist/\r\nnpm test         # Vitest\r\n```\r\n\r\n### Project Structure\r\n\r\n```\r\nsrc/\r\n├── index.ts         # Package entry point + exports\r\n├── adapter.ts       # ArthasChannelAdapter (main class)\r\n├── client.ts        # WebSocket client (connect, join, send)\r\n├── crypto.ts        # AES-256-GCM encrypt/decrypt\r\n├── signing.ts       # Ed25519 message signing (optional)\r\n├── protocol.ts      # MessagePack encode/decode\r\n├── config.ts        # Config loading + validation\r\n├── reconnect.ts     # Exponential backoff reconnection\r\n├── file-transfer.ts # Chunked encrypted file send/receive\r\n└── types.ts         # TypeScript type definitions\r\n```\r\n\r\n---\r\n\r\n## Links\r\n\r\n- **Public Server**: `wss://arthas100-arthas-server.hf.space/ws` (free, no signup)\r\n- **GitHub**: [github.com/michaelwang123/arthas](https://github.com/michaelwang123/arthas)\r\n- **Docs**: [michaelwang123.github.io/arthas](https://michaelwang123.github.io/arthas/)\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md"}