Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9b8dfea
let's see what claude can do
Oct 31, 2025
91c2e80
more robust
Nov 3, 2025
88817c6
clippy
Nov 3, 2025
9e54c19
remove generated mobile code
Nov 3, 2025
5669d37
use walletkit structure
Nov 3, 2025
3377b14
more like idkit-rs
Nov 3, 2025
72e04ba
doc updates
Nov 3, 2025
cc9fabe
Merge origin/main into full-implementation (accepting main as source …
Nov 4, 2025
6971569
rebase
Nov 4, 2025
be6b262
simpler
Nov 4, 2025
b933520
doc updates
Nov 4, 2025
0edef22
js wasm progress
Nov 6, 2025
9dbc79f
js impl
Nov 6, 2025
8501485
Merge remote-tracking branch 'origin/main' into language-bindings-swi…
Nov 6, 2025
806adcc
simpler
Nov 6, 2025
dbc30e4
remove deprecated cred type
Nov 6, 2025
fa0c7bc
more drop in
Nov 6, 2025
8f434a5
updates to match api
Nov 6, 2025
986e2e8
ci
Nov 6, 2025
e652b19
Potential fix for code scanning alert no. 1: Workflow does not contai…
decentralgabe Nov 6, 2025
5d96902
Potential fix for code scanning alert no. 2: Workflow does not contai…
decentralgabe Nov 6, 2025
4012ede
remove old tests
Nov 6, 2025
8906a98
formatting
Nov 6, 2025
b77b0c5
smoke tests
Nov 6, 2025
ed9803e
update
Nov 6, 2025
7e87e9e
update ci
Nov 6, 2025
8d5b192
Merge branch 'main' into language-bindings-swift-kotlin-js
decentralgabe Nov 6, 2025
1475821
update wasm'
Nov 6, 2025
fb89e04
Merge origin/main favoring main branch changes
Nov 7, 2025
15f3ceb
update ci
Nov 7, 2025
4e43acc
Fix cargo formatting - add trailing newlines
Nov 7, 2025
e197ab9
Merge branch 'main' into language-bindings-swift-kotlin-js
decentralgabe Nov 7, 2025
9c08f25
Merge branch 'main' into gabe-id-1139-add-rust-core-js-bindings-examples
decentralgabe Nov 7, 2025
56d64f1
remove codeql
Nov 7, 2025
b26bbfd
update v2/v3 api
Nov 7, 2025
b04faee
Merge branch 'main' into gabe-id-1139-add-rust-core-js-bindings-examples
decentralgabe Nov 7, 2025
5473c1a
update lint
Nov 7, 2025
8df303f
lints
Nov 7, 2025
6e0bc26
update
Nov 7, 2025
c8bd897
Rename
Nov 7, 2025
cf347e5
Merge remote-tracking branch 'origin/main' into gabe-id-1139-add-rust…
Nov 24, 2025
439821b
simplify styling
Nov 24, 2025
ab106cb
fix anbi encoding
Nov 24, 2025
99d16d2
pr feedback
Nov 24, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/publish-swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ jobs:
gh release edit "$VERSION" \
--repo worldcoin/idkit-swift \
--draft=false \
--latest
--latest
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ hex = "0.4"

# Async
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
reqwest = { version = "0.12", default-features = false }

# Error handling
thiserror = "1.0"
anyhow = "1.0"

# UUID
uuid = { version = "1.10", features = ["v4", "serde"] }
uuid = { version = "1.10", default-features = false, features = ["serde"] }

# URL handling
url = "2.5"
Expand Down
22 changes: 22 additions & 0 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "idkit-monorepo",
"version": "3.0.0",
"private": true,
"description": "World ID SDK for Relying Parties - JavaScript packages",
"scripts": {
"build": "pnpm -r build",
"dev": "pnpm -r dev",
"lint": "pnpm -r lint",
"test": "pnpm -r test"
},
"devDependencies": {
"@changesets/cli": "^2.27",
"prettier": "^3.3",
"typescript": "^5.6",
"turbo": "^2.2"
},
"packageManager": "pnpm@9.12.2",
"engines": {
"node": ">=18"
}
}
164 changes: 164 additions & 0 deletions js/packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# @worldcoin/idkit-core

Core bridge logic for IDKit (World ID SDK) powered by Rust/WASM.

## Installation

```bash
npm install @worldcoin/idkit-core
# or
pnpm add @worldcoin/idkit-core
```

## Quick Start

```typescript
import {
useWorldBridgeStore,
VerificationLevel,
} from '@worldcoin/idkit-core'

// 1. Get store instance
const store = useWorldBridgeStore()

// 2. Create client - returns immutable client object
const client = await store.createClient({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of similar to the session hook. But, I like it!
https://docs.world.org/world-id/id/web-react#session-hook

app_id: 'app_staging_xxxxx',
action: 'my-action',
verification_level: VerificationLevel.Orb,
signal: 'user-id-123',
})

// 3. Display QR code for World App
console.log('Scan this:', client.connectorURI)

// 4. Poll for proof (handles polling automatically)
try {
const proof = await client.pollForUpdates()
console.log('Success:', proof)
} catch (error) {
console.error('Verification failed:', error)
}
```

## V2 API

```typescript
const store = useWorldBridgeStore()

await store.createClient({
app_id: 'app_staging_xxxxx',
action: 'my-action',
verification_level: VerificationLevel.Orb,
signal: 'user-id-123',
})

console.log('Scan this:', store.connectorURI)

await store.pollForUpdates()

if (store.result) {
console.log('Proof received:', store.result)
}
```

## API Reference

```typescript
const client = await store.createClient(config)
```

**Properties:**
- `connectorURI: string` - QR code URL for World App
- `requestId: string` - Unique request ID

**Methods:**
- `pollForUpdates(options?: WaitOptions): Promise<ISuccessResult>` - Poll for proof (auto-polls)
- `pollOnce(): Promise<Status>` - Poll once for status (manual polling)

**WaitOptions:**
```typescript
interface WaitOptions {
pollInterval?: number // ms between polls (default: 1000)
timeout?: number // total timeout ms (default: 300000 = 5min)
signal?: AbortSignal // for cancellation
}
```

### Store

```typescript
const store = useWorldBridgeStore()
```

**V3 Methods:**
- `createClient(config: IDKitConfig): Promise<WorldBridgeClient>` - Create new client

**V2 State (backward compat):**
- `verificationState: VerificationState` - Current verification state
- `connectorURI: string | null` - QR code URL for World App
- `result: ISuccessResult | null` - Proof data when verified
- `errorCode: AppErrorCodes | null` - Error code if failed

**V2 Methods (deprecated):**
- `pollForUpdates(): Promise<void>` - Check for proof (call repeatedly) ⚠️ Use `client.pollForUpdates()` with auto-polling instead
- `reset(): void` - Clear state and start over

### Types

```typescript
interface IDKitConfig {
app_id: `app_${string}`
action: string
signal?: string
verification_level?: VerificationLevel
bridge_url?: string
partner?: boolean
}

interface ISuccessResult {
proof: string
merkle_root: string
nullifier_hash: string
verification_level: VerificationLevel
}

enum VerificationLevel {
Orb = 'orb',
Face = 'face',
Device = 'device',
Document = 'document',
SecureDocument = 'secure_document',
}
```

### Utilities

```typescript
// Signal hashing (keccak256)
hashToField(input: string): HashFunctionOutput

// ABI encoding
solidityEncode(types: string[], values: unknown[]): AbiEncodedValue
```

## Examples

See [examples/browser](./examples/browser) for a complete working example.

## Building from Source

```bash
# Build WASM module
npm run build:wasm

# Build TypeScript
npm run build:ts

# Or both
npm run build
```

## License

MIT
68 changes: 68 additions & 0 deletions js/packages/core/examples/browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# IDKit Browser Example

A simple browser example demonstrating World ID verification using IDKit 3.0.

## Usage

#### Local Development

1. Build the core package:
```bash
cd ../../
pnpm build
```

2. Serve the example:
```bash
cd examples/browser
python3 -m http.server 8000
# or
npx serve
```

3. Open http://localhost:8000 in your browser

#### Production

Replace the import in `index.html`:

```javascript
// From:
import { initIDKit, Session, Credential } from '../../dist/index.js';

// To:
import { initIDKit, Session, Credential } from '@worldcoin/idkit-core';
```

## Configuration

Update these values in `index.html`:

```javascript
const APP_ID = 'app_staging_123'; // Your app ID from the Developer Portal
const ACTION = 'demo-action'; // Your action identifier from the Developer Portal
```

## API Usage

```javascript
// 1. Initialize WASM
await initIDKit();

// 2. Create session
const session = await Session.create({
app_id: 'app_xxx',
action: 'my-action',
requests: [{
type: Credential.Orb,
signal: 'my-signal',
}],
});

// 3. Get QR code URL
const url = session.connectUrl();

// 4. Wait for proof
const proof = await session.waitForProof();
console.log(proof);
```
Loading