Repository navigation
feat: accept callback_secret in RequestValidator, deprecate api_key - #45
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesCallback secret validation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The callback-secret update has no established merge-blocking issue. Merge after the platform release introducing callback secrets, as planned. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Constructor ambiguity and removal of the public api_key attribute create avoidable compatibility risks.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Renames the webhook validation credential to callback_secret while preserving deprecated api_key constructor compatibility.
Changes:
- Adds callback-secret initialization and deprecated alias handling.
- Updates validator tests and webhook documentation.
| File | Description |
|---|---|
src/didww/callback/request_validator.py |
Renames the HMAC credential and adds compatibility handling. |
tests/test_request_validator.py |
Tests new and deprecated constructor arguments. |
README.md |
Documents callback secret configuration and usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
34423f3 to
63b30c3
Compare
The validator is keyed with the callback secret enabled in the DIDWW User Panel (APIs -> DIDWW API 3 -> Callback Secrets). The constructor argument and attribute are now callback_secret. The api_key keyword argument and attribute stay as deprecated aliases (DeprecationWarning); passing both, or neither, raises TypeError. The README example and its introduction say where the value comes from. Positional calls, the signature algorithm and the header are unchanged.
63b30c3 to
4789ed5
Compare
|




DIDWW signs callbacks with the callback secret that is enabled in the User Panel under APIs → DIDWW API 3 → Callback Secrets. The validator is keyed with that value, and this PR names it so.
What changed
RequestValidator:__init__(self, callback_secret=None, *, api_key=None); the HMAC is keyed with the callback secret. The signature algorithm (HMAC-SHA1), theX-DIDWW-Signatureheader and the URL/payload normalisation are unchanged.Compatibility
Positional calls keep working. Python exposes keyword arguments and attributes, so
api_key=andvalidator.api_keystay as deprecated aliases that emitDeprecationWarning(reading and writing the attribute both work). Passing both, or neither, raisesTypeError. Tests cover each case.Checks
CI is green; locally the whole suite passes (309 tests, 31 of them for the validator).
Merge order
Merge only after callback secrets are available in the User Panel and the public documentation describing them is published: until then the User Panel section the README points to does not exist. The version bump and the changelog are left to the release.