# Organization web admin (device-signed operations)

Source: https://botpassword.com/docs/guides/web-admin

The BotPassword web UI (`app.botpassword.com`) gives organization members and administrators a passkey-authenticated view of organization metadata without ever turning the web origin into a signing authority or vault client (ADR 0030, ADR 0038, ADR 0058, Spec 08).

## Trust boundary (H9)

| Capability | Web passkey session | Enrolled admin device |
|---|---|---|
| View org overview, roster head, epochs, members, roles, devices, invitations | Yes (read-only metadata) | Yes (verified from genesis) |
| View collection IDs, kinds, key epochs, access modes, rekey-due status | Yes (metadata only) | Yes |
| Read decrypted secrets, environment values, or encrypted item names | Never | Yes (after unlock) |
| Invite member, change role, remove member, revoke org device, cancel invite | Never (refused without device signature) | Yes (signs Spec 08 purpose-5 `RosterChange`) |

Every organization mutation must be signed by an enrolled admin device listed in the signed roster chain. A compromised web session cookie cannot add a member, promote a role, or alter collection access.

## Workflows

1. **Inspect organization state:** Sign in with a passkey at `app.botpassword.com` and open **Organizations** (`/orgs`). Select an organization to inspect its roster head, root fingerprint, membership and lease epochs, members, enrolled devices, pending invitations, collection metadata, and recent signed roster entries.
2. **Run a device-signed admin action:** Click **Invite member**, **Change role**, **Remove**, **Revoke device**, or **Cancel** in the web UI. The dialog checks Spec 08 role rules (owner vs admin permissions, last-owner protection, last-device protection, auditor collection restriction, restore-freeze holds) and prepares:
   - the exact `bpw org ...` command to copy and run on your enrolled admin device (`bpw org invite`, `bpw org role`, `bpw org remove`), and
   - an optional **Submit a pre-signed Spec 08 roster envelope** panel for relaying an already device-signed purpose-5 envelope with its `bpw-device`, `bpw-timestamp`, `bpw-nonce`, and `bpw-signature` proof.

## Control-plane web org routes

`apps/web` consumes three same-origin `/v1/web/*` endpoints forwarded through its Worker service binding:

- `GET /v1/web/orgs` — lists org summaries for the signed-in account from D1 `membership_index` and each `OrgDO`'s derived roster metadata.
- `GET /v1/web/orgs/:org` — returns derived `OrgDO` metadata (members, org devices, invitations, collection metadata, recent signed roster log entries — never secrets or ciphertext).
- `POST /v1/web/orgs/:org/roster` — relays a device-signed Spec 08 purpose-5 envelope plus its device request signature proof to `OrgDO.appendRoster` (which verifies the device signature and roster rules inside one `transactionSync`).
