swarm-matrix-client: document the room calls; test the whoami refusal
This commit is contained in:
parent
b17da10cfc
commit
ff256d0b1c
4 changed files with 58 additions and 10 deletions
|
|
@ -1,11 +1,11 @@
|
|||
# swarm-matrix-client
|
||||
|
||||
The appservice calls against the swarm's homeserver, shared by the two binaries
|
||||
The client-server API calls against a Matrix homeserver, shared by the binaries
|
||||
that make them: `swarm-matrix-ctl` (inside the matrix container, for a hive's
|
||||
sender account) and `swarm-controller` (for each agent's account, with the
|
||||
swarm's own appservice token).
|
||||
|
||||
Three calls, all client-server API: register an account as the appservice, log
|
||||
Three appservice calls: register an account as the appservice, log
|
||||
in to an existing one as the appservice, and ask a token who it is. Both mints
|
||||
pin the device id `hyperhive-<localpart>`, so a second login **replaces** that
|
||||
device's token instead of adding a device.
|
||||
|
|
@ -15,6 +15,12 @@ device's token instead of adding a device.
|
|||
the operator names. Neither call is an appservice call, so neither carries the
|
||||
appservice token.
|
||||
|
||||
`hive-c0re` provisions the hive Space and chat room with the room calls
|
||||
(`joined_rooms`, `room_state`, `put_state`, `create_room`, `invite`,
|
||||
`resolve_alias`), and `hive-matrix-mcp` recovers a session's user and device id
|
||||
with `whoami_session`. Each takes the caller's `reqwest::Client`, so the caller
|
||||
sets its own timeout; `client()` is the 10 second default.
|
||||
|
||||
## 🩸 A secret is a path, never a value
|
||||
|
||||
Every error here is built from the response's status and its `errcode`, never
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
//! The appservice calls against the swarm's homeserver: register, log in, ask
|
||||
//! a token who it is, and the room calls `swarm-controller`'s admin-room
|
||||
//! commands need (resolve an alias, list members, check an account exists,
|
||||
//! send a message). Also the password login and logout `swarm-controller` runs
|
||||
//! for an operator-linked account on any homeserver. Shared by `swarm-matrix-ctl` and `swarm-controller`;
|
||||
//! see the README for why both mint through the same device id.
|
||||
//! The calls against a Matrix homeserver's client-server API shared by the
|
||||
//! swarm and the hive: the appservice calls (register, log in, ask a token who
|
||||
//! it is), the room calls `swarm-controller`'s admin-room commands and
|
||||
//! `hive-c0re`'s Space and chat-room provisioning need (resolve an alias, list
|
||||
//! members and joined rooms, read and set room state, create a room, invite, send
|
||||
//! a message, check an account exists), and the password login and logout
|
||||
//! `swarm-controller` runs for an operator-linked account on any homeserver.
|
||||
//! Shared by `swarm-matrix-ctl`, `swarm-controller`, `hive-c0re` and
|
||||
//! `hive-matrix-mcp`. See the README for why both appservice mints go through
|
||||
//! the same device id.
|
||||
//!
|
||||
//! 🩸 **Every error in this module is built from the response's `status` and
|
||||
//! its `errcode`, never its body.** A successful `/register` or `/login` body
|
||||
|
|
|
|||
Loading…
Reference in a new issue