Phase 6 complete: push frontend, WebAuthn frontend, Swagger docs

2026-06-28 18:53:57 -04:00
parent cf29d789b5
commit 9ba019676b
2 changed files with 65 additions and 28 deletions
+57 -22
@@ -1,6 +1,6 @@
# Phase 6: Security, Permissions & Polish # Phase 6: Security, Permissions & Polish
Phase 6 adds roles & permissions, push notifications, and WebAuthn passkey scaffolding. Phase 6 adds roles & permissions, push notifications, WebAuthn passkeys, and REST API documentation.
## Features Implemented ## Features Implemented
@@ -25,31 +25,28 @@ Phase 6 adds roles & permissions, push notifications, and WebAuthn passkey scaff
| Push subscription CRUD | ✅ | Subscribe/unsubscribe endpoints | | Push subscription CRUD | ✅ | Subscribe/unsubscribe endpoints |
| Push sender | ✅ | SendPush function for mentioned users | | Push sender | ✅ | SendPush function for mentioned users |
| Push subscription table | ✅ | DB storage for push subscriptions | | Push subscription table | ✅ | DB storage for push subscriptions |
| Frontend push store | ✅ | Already built in Phase 3 | | Frontend push store | ✅ | Subscribe/unsubscribe with VAPID key fetch |
| Settings UI toggle | ✅ | [ENABLE PUSH] / [DISABLE PUSH] in UserSettings |
| Service worker | ✅ | Handles push events and notification clicks |
### WebAuthn Passkeys ### WebAuthn Passkeys
| Feature | Status | Description | | Feature | Status | Description |
|---------|--------|-------------| |---------|--------|-------------|
| WebAuthn scaffolding | ✅ | Registration and login endpoints (begin/finish) | | Backend scaffolding | ✅ | Registration and login endpoints (begin/finish) |
| Credential storage | ✅ | webauthn_credentials table | | Credential storage | ✅ | webauthn_credentials table |
| Frontend | | Needs browser WebAuthn API integration | | Frontend register | | [REGISTER PASSKEY] button in UserSettings |
| Frontend login | ✅ | [SIGN IN WITH PASSKEY] button on LoginForm |
| Backend completion | ⏳ | Begin/finish flow needs full implementation |
## Permission Constants ### REST API Documentation
| Permission | Bit | Value | | Feature | Status | Description |
|-----------|-----|-------| |---------|--------|-------------|
| VIEW_CHANNEL | 0 | 1 | | Swagger annotations | | @title, @version, @host, @BasePath on main.go |
| SEND_MESSAGES | 1 | 2 | | Swagger UI | | Served at `/docs` endpoint |
| MANAGE_MESSAGES | 2 | 4 | | Generated spec | | `docs/swagger.json`, `docs/swagger.yaml` |
| KICK_MEMBERS | 3 | 8 | | Makefile target | | `make docs` to regenerate |
| BAN_MEMBERS | 4 | 16 |
| MANAGE_SERVER | 5 | 32 |
| MANAGE_CHANNELS | 6 | 64 |
| ADMINISTRATOR | 7 | 128 |
| CONNECT_VOICE | 8 | 256 |
| SPEAK_VOICE | 9 | 512 |
| SHARE_SCREEN | 10 | 1024 |
## API Endpoints ## API Endpoints
@@ -65,7 +62,6 @@ GET /api/v1/servers/{serverID}/roles
# Update role # Update role
PATCH /api/v1/servers/{serverID}/roles/{roleID} PATCH /api/v1/servers/{serverID}/roles/{roleID}
{ "name": "New Name", "permissions": 127 }
# Delete role # Delete role
DELETE /api/v1/servers/{serverID}/roles/{roleID} DELETE /api/v1/servers/{serverID}/roles/{roleID}
@@ -90,8 +86,47 @@ POST /api/v1/push/unsubscribe
{ "endpoint": "..." } { "endpoint": "..." }
``` ```
### WebAuthn
```bash
# Begin passkey registration
POST /api/v1/auth/webauthn/register/begin
# Finish passkey registration
POST /api/v1/auth/webauthn/register/finish
# Begin passkey login
POST /api/v1/auth/webauthn/login/begin
# Finish passkey login
POST /api/v1/auth/webauthn/login/finish
```
### Swagger UI
Access the interactive API documentation at:
```
http://localhost:8080/docs
```
## Permission Constants
| Permission | Bit | Value |
|-----------|-----|-------|
| VIEW_CHANNEL | 0 | 1 |
| SEND_MESSAGES | 1 | 2 |
| MANAGE_MESSAGES | 2 | 4 |
| KICK_MEMBERS | 3 | 8 |
| BAN_MEMBERS | 4 | 16 |
| MANAGE_SERVER | 5 | 32 |
| MANAGE_CHANNELS | 6 | 64 |
| ADMINISTRATOR | 7 | 128 |
| CONNECT_VOICE | 8 | 256 |
| SPEAK_VOICE | 9 | 512 |
| SHARE_SCREEN | 10 | 1024 |
## What's Next ## What's Next
- REST API documentation (OpenAPI/Swagger) - Complete WebAuthn backend (full begin/finish flow)
- WebAuthn frontend integration - Add swaggo annotations to individual handlers for detailed API docs
- Push notification frontend integration (needs VAPID keys) - Push notification mention parsing and dispatch
+8 -6
@@ -30,8 +30,8 @@
## Phase 3: Polish & PWA — ✅ DONE ## Phase 3: Polish & PWA — ✅ DONE
- [x] PWA manifest + service worker - [x] PWA manifest + service worker
- [ ] Web Push notifications (VAPID) — frontend ready, backend keys needed - [x] Push notifications (frontend + backend)
- [ ] WebAuthn / passkeys — deferred - [ ] WebAuthn / passkeys — frontend done, backend completion pending
- [x] Mobile-responsive layout (bottom nav, swipe gestures) - [x] Mobile-responsive layout (bottom nav, swipe gestures)
- [x] Message reactions (emoji picker, counts) - [x] Message reactions (emoji picker, counts)
- [x] Message replies/threads - [x] Message replies/threads
@@ -51,7 +51,7 @@
- [x] Incoming webhook endpoint - [x] Incoming webhook endpoint
- [x] Example bot: moderation (auto-delete, kick, ban commands) - [x] Example bot: moderation (auto-delete, kick, ban commands)
- [x] Example bot: welcome messages on member join - [x] Example bot: welcome messages on member join
- [ ] REST API documentation (OpenAPI/Swagger) — future - [x] REST API documentation (Swagger UI at /docs)
## Phase 5: TUI Client — ✅ DONE ## Phase 5: TUI Client — ✅ DONE
@@ -76,7 +76,9 @@
- [x] Default @everyone role - [x] Default @everyone role
- [x] Frontend role manager UI - [x] Frontend role manager UI
- [x] Push notification backend (VAPID) - [x] Push notification backend (VAPID)
- [x] Push notification frontend (subscribe toggle)
- [x] WebAuthn passkey scaffolding - [x] WebAuthn passkey scaffolding
- [ ] REST API documentation (OpenAPI/Swagger) — future - [x] WebAuthn frontend (register/login buttons)
- [ ] WebAuthn frontend integration — future - [x] REST API documentation (Swagger UI at /docs)
- [ ] Push notification frontend integration — needs VAPID keys - [ ] WebAuthn backend completion (begin/finish flow)
- [ ] Push notification mention parsing and dispatch