Skip to content
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

feat: enforce non-empty string for action in IDKit #242

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export enum VerificationLevel {
export type IDKitConfig = {
/** Unique identifier for the app verifying the action. This should be the app ID obtained from the Developer Portal. */
app_id: `app_${string}`
/** Identifier for the action the user is performing. Should be left blank for [Sign in with Worldcoin](https://docs.worldcoin.org/id/sign-in). */
action: AbiEncodedValue | string
/** The description of the specific action (shown to users in World App). Only recommended for actions created on-the-fly. */
action_description?: string
/** Encodes data into a proof that must match when validating. Read more on the [On-chain section](https://docs.worldcoin.org/advanced/on-chain). */
signal?: AbiEncodedValue | string
/** Identifier for the action the user is performing. Should be left blank for [Sign in with Worldcoin](https://docs.worldcoin.org/id/sign-in). */
action?: AbiEncodedValue | string
/** URL to a third-party bridge to use when connecting to the World App. Optional. */
bridge_url?: string
/** The minimum required level of verification. Defaults to "orb". */
Expand Down
3 changes: 3 additions & 0 deletions packages/react/src/components/IDKitWidget/BaseWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const IDKitWidget: FC<WidgetProps> = ({ children, ...config }) => {
const { isOpen, onOpenChange, stage, setOptions } = useIDKitStore(getParams, shallow)

useEffect(() => {
if (config.action === '') {
throw new Error(__('Action cannot be an empty string.'))
}
setOptions(config, ConfigSource.PROPS)
}, [config, setOptions])

Expand Down
Loading