diff --git a/world-id/idkit/credentials.mdx b/world-id/idkit/credentials.mdx index ec910c3..bf7db5a 100644 --- a/world-id/idkit/credentials.mdx +++ b/world-id/idkit/credentials.mdx @@ -6,6 +6,73 @@ title: "Configure Credentials" A [Credential](https://docs.rs/world-id-primitives/latest/world_id_primitives/credential/struct.Credential.html) is a statement an issuer makes about a World ID holder. Fundamentally, when you as an RP request a proof, the choice of Credential matters significantly to fulfill your use case. For example, if you want to protect an action that should only be done once per human, you probably want to use the Proof of Human credential. +# World ID 4.0 Presets + +These presets create World ID 4.0 proof requests and automatically fall back to the matching legacy proof when a World ID 4.0 proof is not available. If you have an existing integration using legacy presets, please take a look at the [migration guide](/world-id/4-0-migration). + +## `proofOfHuman` + +Requires Proof of Human. Falls back to an Orb legacy proof. + + +```typescript title="JavaScript" +import { IDKit, proofOfHuman } from "@worldcoin/idkit-core"; + +const request = await IDKit.request({ + app_id: "app_xxxxx", + action: "my-action", + rp_context: { /* ... */ }, +}).preset(proofOfHuman({ signal: "user-123" })); +``` + +```tsx title="React" +import { IDKitRequestWidget, proofOfHuman } from "@worldcoin/idkit"; + + { /* ... */ }} +/>; +``` + + +## `passport` + +Requires a Passport credential. Falls back to a Document legacy proof. + + +```typescript title="JavaScript" +import { IDKit, passport } from "@worldcoin/idkit-core"; + +const request = await IDKit.request({ + app_id: "app_xxxxx", + action: "my-action", + rp_context: { /* ... */ }, +}).preset(passport({ signal: "user-123" })); +``` + +```tsx title="React" +import { IDKitRequestWidget, passport } from "@worldcoin/idkit"; + + { /* ... */ }} +/>; +``` + + +## Parameters + +Both World ID 4.0 presets accept an optional `signal` parameter: + +| Parameter | Type | Description | +|-----------|------|-------------| +| `signal` | `string?` | Binds specific context into the proof (e.g. user ID, wallet address). Your backend should enforce the same value. | # Legacy Presets