Skip to content

Commit

Permalink
feat: enforce non-empty string for action in IDKit (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xPenryn authored Mar 29, 2024
1 parent c4a2821 commit 2087544
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit 2087544

Please sign in to comment.