Skip to main content

Rust Backend for High-Performance Didit Webhook Processing

Building a robust, high-performance backend for processing webhooks is crucial for real-time identity verification. Rust offers unparalleled safety and speed, making it an ideal choice for handling Didit's secure, real-time KYC.

Rust Backend for High-Performance Didit Webhook Processing

Contents

In this guide

Jump to the part you need.

Leverage Rust for PerformanceRust's memory safety and concurrency features provide a powerful foundation for building high-throughput webhook processing systems, ensuring your identity verification workflows are fast and reliable.

Secure Webhook ProcessingImplementing HMAC-SHA256 signature verification in Rust is essential to validate that incoming Didit webhooks are authentic and untampered, protecting your system from malicious requests.

Real-time KYC NotificationsDidit's webhooks deliver instant updates on identity verification sessions, enabling your application to react immediately to statuses like 'approved' or 'declined' and streamline user onboarding.

Didit's Seamless IntegrationDidit provides a developer-first experience with clean APIs and detailed documentation, making it straightforward to configure and consume webhooks in a Rust backend, including support for v3 payload versions and secret key management.

The Need for Speed and Security in Webhook Processing

In today's digital landscape, real-time identity verification is paramount. Businesses need to onboard users quickly and securely, often relying on automated systems to process verification results. Webhooks serve as the backbone for these real-time notifications, pushing updates from identity verification providers directly to your application. However, processing these webhooks efficiently and securely presents a significant technical challenge. High volumes of verification requests, coupled with the critical need for data integrity, demand a robust and performant backend.

This is where Rust shines. Known for its performance, memory safety, and concurrency, Rust is an excellent choice for building systems that require both speed and reliability. When integrating with a sophisticated identity platform like Didit, which provides real-time KYC notifications through secure webhooks, a Rust backend can ensure your application keeps pace with verification outcomes without compromising security or scalability.

Understanding Didit Webhooks and Their Structure

Didit's webhooks are designed to provide real-time updates on the status of identity verification sessions. These notifications are critical for automating workflows, updating user statuses, and triggering subsequent actions within your application. Didit offers a flexible webhook configuration, allowing you to specify a URL, choose a webhook payload version (v3 is recommended for its comprehensive data structure), and manage a shared secret key for signature verification.

Each Didit webhook notification includes vital information about a verification session, such as its status (e.g., approved, declined, pending), the reason for a particular status, and details related to the verified identity. For example, if you're using Didit's ID Verification for document checks or Passive & Active Liveness for fraud prevention, the webhook will deliver the final verdict quickly and reliably. This real-time feedback is indispensable for applications that need to make immediate decisions based on identity verification outcomes.

A key aspect of Didit's webhook security is the HMAC-SHA256 signature. This signature is included in the X-Signatur header of each webhook request. By verifying this signature using your shared secret key, your Rust backend can confirm that the webhook originated from Didit and that its payload has not been tampered with during transit. This cryptographic assurance is non-negotiable for maintaining the integrity of your identity verification processes.

Building a Secure Rust Webhook Processor

Developing a secure Rust backend for Didit webhooks involves several critical steps. The first is setting up an HTTP server that can receive POST requests. Frameworks like Actix-web or Axum are excellent choices in Rust for their performance and robust feature sets. Once your server is ready, the core logic will involve:

  1. Receiving the Raw Request Body: It's crucial to read the incoming webhook request body as raw bytes before any JSON parsing. This is because the HMAC signature is calculated over the raw payload.
  2. Extracting the Signature and Timestamp: The X-Signatur and X-Timestamp headers must be retrieved from the incoming request.
  3. Verifying the HMAC-SHA256 Signature: Using your secret_shared_key (obtained from your Didit webhook configuration), calculate the expected HMAC signature of the raw request body. Compare this against the X-Signatur header. If they don't match, reject the request immediately as it could be forged.
  4. Validating the Timestamp: To prevent replay attacks, check that the X-Timestamp is recent, typically within a few minutes of the current time.
  5. Parsing and Processing the Payload: Only after successful signature and timestamp verification should you parse the request body as JSON. At this point, your Rust application can safely process the verification results, update your database, or trigger further actions based on the session_status and other data.

Rust's strong type system and ownership model inherently help prevent many common security vulnerabilities, making it an ideal language for handling sensitive data like identity verification results. Libraries like hmac and sha2 can be used for cryptographic operations, ensuring your signature verification is performed correctly and securely.

Optimizing for High Performance and Scalability

Beyond security, performance and scalability are key considerations for webhook processing. A high-volume identity verification scenario, perhaps involving Didit's AML Screening & Monitoring for financial institutions or Age Estimation for age-restricted services, can generate a significant number of webhooks. A Rust backend is inherently well-suited for this due to its:

  • Zero-cost Abstractions: Rust allows for high-level programming constructs without runtime overhead, leading to very efficient code.
  • Concurrency without Data Races: Rust's ownership system prevents data races at compile time, making concurrent programming safer and more reliable for handling multiple incoming webhooks simultaneously. Asynchronous runtimes like Tokio are perfect for building non-blocking I/O operations, allowing your server to handle many concurrent requests without blocking.
  • Minimal Runtime: Rust applications have a small memory footprint and fast startup times, which is beneficial for microservices architectures and serverless deployments.

To further optimize, consider using a message queue (e.g., Kafka, RabbitMQ) between your webhook receiver and the actual processing logic. This decouples the receiving and processing steps, providing a buffer against spikes in webhook traffic and allowing for asynchronous processing. Your Rust application can then consume messages from the queue at its own pace, ensuring consistent performance and resilience.

How Didit Helps

Didit is built to empower developers and businesses with a flexible, high-performance identity verification platform. Our modular architecture and AI-native approach mean you get a system that's both powerful and easy to integrate, making your Rust webhook processing even more effective. Didit's commitment to a developer-first experience is evident in our clean APIs and comprehensive documentation, which provide all the necessary details for configuring and consuming webhooks, including examples for signature verification.

With Didit, you can configure your webhook URL and secret key through a simple API call or the Business Console. Our webhooks support version 3 payloads, delivering rich, structured identity data directly to your Rust backend. This enables immediate decision-making for processes like ID Verification, 1:1 Face Match & Face Search, and Proof of Address.

Furthermore, Didit offers Core KYC with pay-per-use pricing, allowing you to get started with essential identity verification without upfront costs. Our pay-per-successful-check model and no setup fees align perfectly with a scalable, performance-driven approach, letting you focus on building your robust Rust backend without worrying about prohibitive infrastructure costs. Didit's platform is designed to be the open, modular identity layer of the internet, making it the ideal partner for your high-performance identity verification needs.

Ready to Get Started?

Ready to see Didit in action? Get a free demo today.

Start verifying identities for free with Didit's free tier.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Blog questions

Who writes the Didit blog?
The Didit team. Guides reviewed by Alberto Rosas, co-founder and CEO, carry his byline. The rest are published as Didit.
Which topics does the blog cover?
Eight topics: ID verification, business verification (KYB), AML, sanctions and compliance, fraud prevention, transaction monitoring and crypto, country guides, agents and developers, and product updates.
Is the blog available in my language?
Yes, in 15 languages: English, Spanish, French, German, Brazilian and European Portuguese, Catalan, Russian, Arabic, Chinese, Japanese, Hindi, Indonesian, Korean and Swahili. Not every post is translated, so each language shows the posts it has.
Where do I find product updates?
In the changelog at /changelog/ and under the Product updates topic.
Are these posts legal advice?
No. Regulation posts explain rules; your legal team decides how they apply.
How do I find posts on one topic?
Open one of the eight topics, or search the blog.
Are posts dated?
Yes. Every post shows when it was published and when it was last updated.
Do posts link to the docs?
Developer posts link to the matching page on docs.didit.me and to the API reference.
Is the blog the same as the docs?
No. The blog explains rules, markets and product changes for a general reader, while docs.didit.me holds the integration guides and the API reference. Developer posts link the matching docs page and the API reference they describe.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.