Skip to content
Open
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
67 changes: 67 additions & 0 deletions world-id/idkit/credentials.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<CodeGroup title="proofOfHuman">
```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";

<IDKitRequestWidget
app_id="app_xxxxx"
action="my-action"
rp_context={rp_context}
preset={proofOfHuman({ signal: "user-123" })}
onSuccess={(result) => { /* ... */ }}
/>;
```
</CodeGroup>

## `passport`

Requires a Passport credential. Falls back to a Document legacy proof.

<CodeGroup title="passport">
```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";

<IDKitRequestWidget
app_id="app_xxxxx"
action="my-action"
rp_context={rp_context}
preset={passport({ signal: "user-123" })}
onSuccess={(result) => { /* ... */ }}
/>;
```
</CodeGroup>

## 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

Expand Down
Loading