Webhook's signature verification
Verify the X-SIGNATURE header on each webhook payload with Cakewalk's public key before trusting the request.
To ensure the authenticity and integrity of webhook requests, Cakewalk signs each payload with a cryptographic signature. When your application receives a webhook, it must verify this signature using the public key provided by Cakewalk. The signature is included in the X-SIGNATURE header, and it is generated using the SHA hash of the raw request body, signed with Cakewalk’s private RSA key.
Your server retrieves the corresponding public key from the https://open-api.getcakewalk.io/api/Keys endpoint, using your API credentials for authorization. By verifying the signature against the raw payload using this public key, your application can confirm that the request was not tampered with and was genuinely sent by Cakewalk.
📦 Project Structure
cakewalk_webhook/
├── config.py
├── signature_service.py
├── models.py
├── main.py
├── requirements.txtconfig.py: 🔧 Configuration
from pydantic import Field
from pydantic_settings import BaseSettings
class CakewalkSettings(BaseSettings):
api_key: str = Field(..., alias="CAKEWALK_API_KEY")
api_secret: str = Field(..., alias="CAKEWALK_API_SECRET")
public_key_endpoint: str = "<https://open-api.getcakewalk.io/api/Keys>"
class Config:
env_file = ".env"
settings = CakewalkSettings()signature_service.py: 🔐 Signature Verification Logic
models.py: 📄 Webhook Payload (Example)
main.py: 🚀 FastAPI App with Validation
requirements.txt
✅ .env File or Environment Variables
▶️ Run Your Webhook Server
🧱 Project Structure:
CakewalkApiProperties - 📋 Configuration Class
SignatureService - 🔐 Signature Verification with Remote Public Key
WebhookController - 🛡️ Implement the webhook endpoint with the validation logic
application.properties Example
You can override via environment variables:
Dependencies (pom.xml)
Make sure you have these dependencies:
Expected test payload
When you create the webhook in cakewalk, the webhook URL will be validated by sending automatically the following test event payload:
📋 Prepare configuration options
1. Define a configuration class:
2. Register configuration in Program.cs or Startup.cs:
✅ Environment variables like CakewalkApi__ApiKey will automatically be bound if you use double underscores (__) in the name.
🔐 Signature Verification with Remote Public Key
SignatureService Implementation:
🧪 Interface and Registration
Interface:
Dependency Injection in Program.cs:
🛡️ Implement the webhook endpoint with the validation logic
✅ Sample appsettings.json or environment variables
Or via environment variables:
Last updated
Was this helpful?