Skip to content

[New Feature] Webhook HMAC signing - #373

Open
mfyz wants to merge 2 commits into
coredevices:masterfrom
mfyz:feature/webhook-hmac-signing
Open

[New Feature] Webhook HMAC signing#373
mfyz wants to merge 2 commits into
coredevices:masterfrom
mfyz:feature/webhook-hmac-signing

Conversation

@mfyz

@mfyz mfyz commented Aug 23, 2026

Copy link
Copy Markdown

Index webhooks can now opt into HMAC-SHA256 request signing. Existing webhooks remain unsigned unless the new setting is enabled, so this is backward compatible.

The webhook configuration UI/screen now includes a Security section where users can enable signing and enter a secret. The secret is stored using the existing secure token storage instead of the regular webhook preferences.

Signed requests include:

  • X-Index-Webhook-Version
  • X-Index-Signature
  • X-Index-Timestamp
  • X-Index-Delivery

The signature covers the webhook version, timestamp, delivery ID, trigger, test status, and exact request body. The webhook API documentation includes the complete verification protocol and a Python example.

Implementation

  • Added the signing controls to the existing webhook screen.
  • Added shared signing-input and header logic, with platform-specific HMAC implementations for Android and iOS.
  • Stored signing secrets separately using Android Keystore-backed encrypted storage and Apple Keychain.
  • Added signature headers when sending regular and test webhook requests.
  • Filtered reserved webhook headers from user-defined headers.
  • Documented the protocol in INDEX_WEBHOOK_API.md.

Tests

Added focused tests in:

  • IndexWebhookSigningTest.kt: RFC 4231 vector, signing-input construction, signature formatting, request changes, reserved headers, and per-gesture secrets.
  • IndexWebhookSettingsViewModelTest.kt: secure secret storage, copied configurations, test events, and secret deletion.
  • IndexWebhookPreferencesTest.kt: backward compatibility and signed-configuration persistence.

Android build, unit tests, host tests, JVM tests, and lint pass. The app was also installed and tested on a physical Android device.

Screenshots

Signing disabled (default state)

Screenshot_20260822-215327

Signing enabled, shows secret field

Screenshot_20260822-215334

Disclosure: This implementation was developed with AI assistance (codex, 5.6-sol-xh). I reviewed the complete diff, iterated on it multiple times to get the UI/UX, documentation, contract right. I tested the Android build on Pixel Fold Pro 9, an my Index 01 device, and reviewed the webhook signing protocol and security behavior. Implemented it on my agentic back-end, and successfully using it in production.

@CLAassistant

CLAassistant commented Aug 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ericmigi
ericmigi requested a review from crc-32 August 23, 2026 21:07
@ericmigi

Copy link
Copy Markdown
Contributor

thanks @mfyz !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants