Open
Conversation
Contributor
There was a problem hiding this comment.
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.
packages/provider/src/api/captcha/submitImageCaptchaSolution.ts
Outdated
Show resolved
Hide resolved
packages/procaptcha-common/src/reactComponents/DemoKeyBanner.tsx
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.