-
Notifications
You must be signed in to change notification settings - Fork 8
Demo keys (Draft) #2247
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
base: main
Are you sure you want to change the base?
Demo keys (Draft) #2247
Conversation
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 introduces demo keys functionality for testing and development purposes. Demo keys are hardcoded site keys that automatically pass or fail CAPTCHA verification, enabling developers to test success and failure flows without requiring complex provider setup.
Key Changes:
- Added demo key utilities with "always pass" and "always fail" behaviors using Polkadot.js sr25519 well-known accounts (Alice and Eve)
- Integrated demo key logic into PoW and image CAPTCHA verification flows with environment-based enablement controls
- Updated PoW challenge ID schema to include a nonce component for uniqueness
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/types/src/datasets/captcha.ts | Extended PoW challenge ID type to include nonce field; improved type safety in schema validation |
| packages/provider/src/utils/demoKeys.ts | New utility for demo key management with environment-based controls and behavior detection |
| packages/provider/src/tests/unit/utils/demoKeys.unit.test.ts | Comprehensive unit tests for demo key utility functions |
| packages/provider/src/tests/unit/tasks/powCaptcha/powTasks.unit.test.ts | Updated PoW challenge ID format in tests to include nonce |
| packages/provider/src/tests/unit/tasks/client/clientTasks.unit.test.ts | Updated test data to match new challenge ID format |
| packages/provider/src/tasks/powCaptcha/powTasks.ts | Integrated demo key bypass logic into PoW verification |
| packages/provider/src/tasks/imgCaptcha/imgCaptchaTasks.ts | Integrated demo key bypass logic into image CAPTCHA verification |
| packages/provider/src/api/captcha/submitPoWCaptchaSolution.ts | Added demo key handling in PoW submission endpoint |
| packages/provider/src/api/captcha/submitImageCaptchaSolution.ts | Added demo key handling in image CAPTCHA submission endpoint |
| packages/provider/src/api/captcha/getPoWCaptchaChallenge.ts | Added demo key handling in PoW challenge generation endpoint |
| packages/provider/src/api/captcha/getFrictionlessCaptchaChallenge.ts | Added demo key handling in frictionless challenge endpoint |
| packages/procaptcha-react/src/components/ProcaptchaWidget.tsx | Integrated demo key banner display in React widget |
| packages/procaptcha-common/src/util/demoKeys.ts | Client-side demo key detection utilities |
| packages/procaptcha-common/src/tests/demoKeys.test.ts | Unit tests for client-side demo key utilities |
| packages/procaptcha-common/src/tests/DemoKeyBanner.test.tsx | Tests for demo key warning banner component |
| packages/procaptcha-common/src/reactComponents/DemoKeyBanner.tsx | Visual warning banner component for demo key usage |
| packages/procaptcha-common/src/index.ts | Exports for demo key utilities and banner component |
| integration/frameworks/react/react-procaptcha-wrapper/project.json | Formatting update to dependsOn arrays |
| demos/client-bundle-example/vite.config.ts | Added demo key demo pages to build configuration |
| demos/client-bundle-example/src/plugins/navigation-injector.ts | Added navigation for demo key pages |
| demos/client-bundle-example/src/demo-keys-always-pass.html | Demo page showcasing always-pass behavior |
| demos/client-bundle-example/src/demo-keys-always-fail.html | Demo page showcasing always-fail behavior |
| .changeset/funny-moments-remain.md | Changeset documenting the demo keys feature addition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.