Skip to content

Commit 2087544

Browse files
authored
feat: enforce non-empty string for action in IDKit (#242)
1 parent c4a2821 commit 2087544

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/core/src/types/config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ export enum VerificationLevel {
1919
export type IDKitConfig = {
2020
/** Unique identifier for the app verifying the action. This should be the app ID obtained from the Developer Portal. */
2121
app_id: `app_${string}`
22+
/** Identifier for the action the user is performing. Should be left blank for [Sign in with Worldcoin](https://docs.worldcoin.org/id/sign-in). */
23+
action: AbiEncodedValue | string
2224
/** The description of the specific action (shown to users in World App). Only recommended for actions created on-the-fly. */
2325
action_description?: string
2426
/** Encodes data into a proof that must match when validating. Read more on the [On-chain section](https://docs.worldcoin.org/advanced/on-chain). */
2527
signal?: AbiEncodedValue | string
26-
/** Identifier for the action the user is performing. Should be left blank for [Sign in with Worldcoin](https://docs.worldcoin.org/id/sign-in). */
27-
action?: AbiEncodedValue | string
2828
/** URL to a third-party bridge to use when connecting to the World App. Optional. */
2929
bridge_url?: string
3030
/** The minimum required level of verification. Defaults to "orb". */

packages/react/src/components/IDKitWidget/BaseWidget.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ const IDKitWidget: FC<WidgetProps> = ({ children, ...config }) => {
3535
const { isOpen, onOpenChange, stage, setOptions } = useIDKitStore(getParams, shallow)
3636

3737
useEffect(() => {
38+
if (config.action === '') {
39+
throw new Error(__('Action cannot be an empty string.'))
40+
}
3841
setOptions(config, ConfigSource.PROPS)
3942
}, [config, setOptions])
4043

0 commit comments

Comments
 (0)