You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HMAC-SHA256 signature verification using `node:crypto`. Compares `x-hub-signature-256` header against computed hash.
63
+
HMAC-SHA256 signature verification using `node:crypto.timingSafeEqual`. Compares `x-hub-signature-256` header against computed hash.
64
+
65
+
### Calendar integration: `src/calendar/`
66
+
67
+
Google Calendar polling feature that posts upcoming event reminders to Slashwork streams.
68
+
69
+
-`auth.ts` — JWT creation + Google OAuth token exchange with 5-minute-buffer caching
70
+
-`poller.ts` — Polls calendars at intervals, deduplicates via event keys, hourly cleanup
71
+
-`fetch-events.ts` — Google Calendar API v3 calls
72
+
-`format.ts` — Markdown formatting with video link extraction, HTML stripping
73
+
-`types.ts` — Types matching Google Calendar API response
74
+
75
+
Calendar config lives in root `config.ts` under `calendar` key. Requires `GOOGLE_SERVICE_ACCOUNT_KEY` env var (full JSON).
76
+
77
+
## Tests
78
+
79
+
Test files live next to source: `src/handlers/handlers.test.ts`, `src/webhook.test.ts`, `src/calendar/calendar.test.ts`. Pattern: import `{ test, expect, describe }` from `"bun:test"`.
80
+
81
+
```sh
82
+
bun test# All tests
83
+
bun test --filter "handler"# Match test file name
84
+
bun test src/calendar/calendar.test.ts # Run single file
85
+
```
86
+
87
+
## Error Response Patterns
88
+
89
+
- Missing/invalid signature → 401
90
+
- Missing headers or unknown event → 200 OK (logged, not forwarded)
91
+
- JSON parse failure → 200 OK (logged)
92
+
- Request body limit: 1MB (`maxRequestBodySize`)
64
93
65
94
## Environment Variables
66
95
67
96
See `.env.example`. Key vars:
68
97
-`GITHUB_WEBHOOK_SECRET` — shared secret for webhook signature verification
0 commit comments