讀取示範資料庫
示範資料庫是隨本站提供的靜態庫:無需安裝,無需登入。
-
讀取握手文件
每個資料庫用一份文件說明它是什麼、提供哪些功能以及有哪些限制。
curl -s https://lantern.boreale.dev/demo/lantern.json -
列出其中的應用程式
某個平台的一頁應用程式:每個都帶有大小、sha256 與檔案路徑。
curl -s https://lantern.boreale.dev/demo/v1/apps/vita/pages/1.json -
下載並校驗
檔案的 SHA-256 與應用程式宣告的一致,不一致則用戶端拒絕。
curl -s https://lantern.boreale.dev/demo/v1/blobs/sha256/fa75492f7b78cad7ca4044e8fb548ac67bfd7fbf05242ceecb29ebe492218a0d | sha256sum
更多嘗試,包括專門用來刁難用戶端的資料庫: 示範庫
與你自己的伺服器通訊
有帳號的伺服器會先要求裝置配對。這些呼叫使用虛構的位址。
-
發現
在區域網路中用戶端用 UDP 資料包發現它;有位址時,則在約定路徑讀取握手文件。
curl -s https://shelf.example.org/.well-known/lantern -
配對
伺服器回傳一個代碼,擁有者在另一台裝置上登入、輸入並核准。
curl -s -X POST https://shelf.example.org/api/lantern/v1/pairing \ -H 'Content-Type: application/json' \ -d '{"schema":1,"device":"My console","scopes":["library"]}' -
呼叫
攜帶取得的令牌(Bearer);以金鑰配對的裝置還會對每個請求簽章。
curl -s https://shelf.example.org/api/lantern/v1/apps?page_size=5 \ -H 'Authorization: Bearer et_…'
完整流程
逐步查看:每按一次點亮一步,其餘變暗。
- 裝置 → 伺服器: UDP 47115 {"lantern":"discover"}
- 伺服器 → 裝置: {"lantern":"server", uid, port, base}
- 僅作提示:信任來自 TLS 與配對
- 裝置 → 伺服器: GET /.well-known/lantern
- 伺服器 → 裝置: handshake: uid, versions, platforms, features, limits
- 配對 (§ 5.2)
- 裝置 → 伺服器: POST /v1/pairing {device, scopes, key}
- 伺服器 → 裝置: code KQ4M-7TXD, verify_complete, poll, interval
- 顯示代碼、QR 碼 與金鑰的短指紋
- 使用者的手機 → 伺服器: 開啟連結、登入, 核對指紋並核准
- 裝置 → 伺服器: GET <poll> (every interval)
- 伺服器 → 裝置: 202 … then 200 {token: et_…} or 410 gone · 429 slow_down
- 為此 uid 固定 伺服器金鑰 (§ 5.3)
- 之後,每次呼叫
- 裝置 → 伺服器: Authorization: Bearer et_… + request signature
- 伺服器 → 裝置: 200 · 401 · 403