Skip to content
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
32 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…
thereisnogabe Nov 6, 2025
5d96902
Potential fix for code scanning alert no. 2: Workflow does not contai…
thereisnogabe 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
thereisnogabe 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
thereisnogabe Nov 7, 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
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI

on:
push:
branches: ['main']
pull_request:

jobs:
rust-core:
name: Rust Core - Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Check formatting
run: cargo fmt --all -- --check

- name: Lint with Clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Build Rust core
run: cargo build --release --package idkit-core

- name: Run Rust tests
run: cargo test --package idkit-core

js-core:
Comment thread Fixed
name: JavaScript/WASM - Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-wasm-

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: js/packages/core/package-lock.json

- name: Install JavaScript dependencies
working-directory: js/packages/core
run: npm ci

- name: Build WASM + TypeScript
working-directory: js/packages/core
run: npm run build

- name: Type check
working-directory: js/packages/core
run: npm run type-check

- name: Run JavaScript tests
working-directory: js/packages/core
run: npm run test

- name: Test WASM crypto functions
run: node rust/wasm/test-crypto.mjs
Comment thread Fixed
20 changes: 20 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Validate PR conventions

on:
pull_request:
types:
- opened
- edited
- synchronize

jobs:
lint-pr:
name: Ensure PR follows conventional commits
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
validateSingleCommitMatchesPrTitle: true
Comment thread Fixed
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ serde_json = "1.0"

# Cryptography
aes-gcm = "0.10"
getrandom = "0.2"
getrandom = { version = "0.2", features = ["js"] }
tiny-keccak = { version = "2.0", features = ["keccak"] }

# Encoding
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ IDKit is the toolkit for identity online. With IDKit you can easily interact wit

## Packages

### Rust Core
- **`idkit-core`**: Core Rust types (Credential, Request, Proof)
- **`idkit-uniffi`**: UniFFI bindings scaffolding for future Swift/Kotlin support
- **`idkit-wasm`**: WebAssembly bindings scaffolding for future browser support
### Core
- **`rust/core`**: Core Rust library with shared types, credential handling, session management, and cryptography

### Language Bindings
- **`js/packages/core`**: ✅ JavaScript/TypeScript with WASM for browser & Node.js ([docs](./js/packages/core/README.md))
- **`kotlin/`**: Kotlin bindings via UniFFI for Android/JVM
- **`swift/`**: Swift bindings via UniFFI for iOS/macOS

## Documentation

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"
}
}
121 changes: 121 additions & 0 deletions js/packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# @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 verification request (auto-initializes WASM on first call)
await store.createClient({
app_id: 'app_staging_xxxxx',
action: 'my-action',
verification_level: VerificationLevel.Orb,
signal: 'user-id-123',
})

// 3. Get QR code URL for World App
console.log('Scan this:', store.connectorURI)

// 4. Poll for proof
await store.pollForUpdates()

// 5. Check result
const { result, errorCode, verificationState } = store
if (result) {
console.log('Proof received:', result)
}
```

## API Reference

### Store

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

**State:**
- `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

**Methods:**
- `createClient(config: IDKitConfig): Promise<void>` - Start verification request
- `pollForUpdates(): Promise<void>` - Check for proof (call repeatedly)
- `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
Loading