BotRelay

Developers開發者

Build on BotRelay

以 BotRelay 開發

Two ways in: connect a bot as a client, or give a gateway new abilities with a worker. Full documentation is coming.

兩種方式:把 bot 接駁為 client,或以 worker 為 gateway 增加能力。完整文件即將推出。

A

Connect a bot (client)

接駁 bot(client)

HTTPS to send, a webhook to receive. Everything is signed and encrypted with the client's key.

以 HTTPS 送出、以 webhook 接收;所有內容均以 client 的金鑰簽署及加密。

  • POST /http/inrequests, replies, reply parts, reports請求、回覆、分段回覆、報告
  • GET /http/workersthe live worker list - what you may use即時 worker 清單——你可以使用甚麼
  • GET /http/outanything your webhook missedwebhook 錯過的內容
  • POST /http/ackconfirm results and notices確認結果及通知
  • webhookresults, calls from the gateway, notices結果、gateway 的呼叫、通知

The integration specification is shared with gateway owners for their bot developers.接駁規格由 gateway 擁有人提供給其 bot 開發者。

B

Write a worker

撰寫 worker

A worker package is a folder with worker.toml and a program: JSON in on stdin, JSON out on stdout.

Worker package 是一個資料夾,內含 worker.toml 及程式:stdin 輸入 JSON,stdout 輸出 JSON。

today

Packages

Package

Install from a folder in the app; declare [action] to be usable as an action.

在 app 中從資料夾安裝;聲明 [action] 即可作為 action 使用。

soon

Worker Development Kit

Worker 開發套件

An open-source Python kit: a base class, status updates, test and pack tools.

開源 Python 套件:父類別、狀態更新、測試及打包工具。

today

Package Store

Package Store

Signed worker packages and applications, open source; pick them in the portal, the gateway installs them after you confirm.

已簽署、開源的 worker package 及應用程式;在 Portal 挑選,你確認後 gateway 才安裝。

C

Security in detail

安全設計詳情

The relay routes and rate-limits; only your bot and your computer hold the keys.

Relay 只負責轉送及限流;金鑰只在你的 bot 與你的電腦手上。

gate 1 · gate 2

Two security gates

兩道安全閘

The relay checks the token, expiry and rate. Your computer checks every signature, timestamp and replay.

Relay 檢查 token、期限及頻率;你的電腦再檢查每個簽署、時間戳及重送。

chacha20-poly1305

End-to-end encrypted

端對端加密

Requests, results and replies are encrypted before they leave. The relay only ever sees ciphertext.

請求、結果及回覆在送出前已加密,relay 永遠只看到密文。

opened from inside

No open ports

無需開放連接埠

Your computer opens one tunnel to the relay; jobs, replies and your applications' visitors travel both ways inside it. Nothing on the internet can connect in.

你的電腦主動開啟一條通往 relay 的通道;工作、回覆及應用程式的訪客都在通道內雙向傳送。互聯網上沒有任何東西可以直接連入。

approval

You approve actions

由你批准動作

Anything that can't be undone can wait for your click in the app.

無法撤回的操作,可以先等你在 app 中按下批准。

keychain

Secrets stay in the keychain

secret 存於 keychain

Tokens and keys live in your system keychain - never in config files.

Token 及金鑰存於系統 keychain,從不寫入設定檔。

your rules

One bot, one gateway

一個 bot,一個 gateway

Each gateway serves exactly one client, with its own workers, limits and expiry.

每個 gateway 只服務一個 client,各有自己的 worker、限制及期限。