-
Notifications
You must be signed in to change notification settings - Fork 2
feat(webhooks & callbacks): add contracts for generic HMAC implementation #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rspective" This reverts commit 426171d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive webhook and callback support to the Python core library by introducing a templating system for flexible message construction and an HMAC signature verification system. The implementation provides a framework-agnostic approach to handling webhook events with secure signature verification capabilities.
- Introduces a template engine with JSON Pointer support for flexible message construction from HTTP requests
- Implements configurable HMAC signature verification with multiple hash algorithms and encoding options
- Adds comprehensive test coverage for all new components including edge cases and error handling
Reviewed Changes
Copilot reviewed 16 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apimatic_core/templating/template_engine.py | Core templating engine for parsing and rendering message templates with runtime expressions |
| apimatic_core/templating/template_resolver.py | Built-in resolvers for extracting HTTP method, URL, headers, query params, and JSON body data |
| apimatic_core/templating/json_pointer_resolver.py | RFC 6901 JSON Pointer implementation for extracting values from JSON request bodies |
| apimatic_core/security/hmac_signature_verifier.py | HMAC signature verification with configurable templates, hash algorithms, and encoders |
| apimatic_core/security/encoders.py | Digest encoding implementations (hex, base64, base64url) |
| apimatic_core/exceptions/signature_verification_error.py | Custom exception for signature verification failures |
| tests/ | Comprehensive test suites covering all new functionality with edge cases |
| setup.py | Version bump to 0.2.22 |
| README.md | Updated documentation with new templating and security features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
6142f23 to
9b78914
Compare
9b78914 to
e803faf
Compare
b391792 to
db79796
Compare
db79796 to
98621d9
Compare
…the signature verification package inside security
|



What
Why
To establish a solid foundation for Webhooks and Callbacks in the Python core library.
These additions provide secure, consistent handling of webhook events across SDKs while ensuring extensibility for future enhancements.
Closes #104
Type of change
Select multiple if applicable.
Dependency Change
If a new dependency is being added, please ensure that it adheres to the following guideline https://github.com/apimatic/apimatic-codegen/wiki/Policy-of-adding-new-dependencies-in-the-core-libraries
Breaking change
If the PR is introducing a breaking change, please ensure that it adheres to the following guideline https://github.com/apimatic/apimatic-codegen/wiki/Guidelines-for-maintaining-core-libraries
Testing
List the steps that were taken to test the changes
Checklist