Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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…
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
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
129 changes: 129 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: CodeQL Security Analysis

on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday

permissions:
security-events: write
contents: read
actions: read

jobs:
analyze-rust:
name: Analyze Rust
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: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: rust
queries: security-extended

- name: Build Rust code
run: cargo build --release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:rust"

analyze-swift:
name: Analyze Swift
runs-on: macos-15
steps:
- uses: actions/checkout@v4

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: swift
queries: security-extended

- name: Generate Swift bindings
run: bash scripts/package-swift.sh

- name: Build Swift package
working-directory: swift
run: swift build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:swift"

analyze-javascript:
name: Analyze JavaScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check if WASM build script exists
id: check_script
run: |
if [ -f "scripts/build-wasm.sh" ]; then
echo "script_exists=true" >> "$GITHUB_OUTPUT"
else
echo "script_exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Setup Node.js
if: steps.check_script.outputs.script_exists == 'true'
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Setup Rust toolchain
if: steps.check_script.outputs.script_exists == 'true'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install wasm-pack
if: steps.check_script.outputs.script_exists == 'true'
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Initialize CodeQL
if: steps.check_script.outputs.script_exists == 'true'
uses: github/codeql-action/init@v3
with:
languages: javascript-typescript
queries: security-extended

- name: Build WASM bindings
if: steps.check_script.outputs.script_exists == 'true'
run: bash scripts/build-wasm.sh

- name: Install dependencies
if: steps.check_script.outputs.script_exists == 'true'
run: |
cd js/packages/core
npm install

- name: Build TypeScript
if: steps.check_script.outputs.script_exists == 'true'
run: |
cd js/packages/core
npm run build

- name: Perform CodeQL Analysis
if: steps.check_script.outputs.script_exists == 'true'
uses: github/codeql-action/analyze@v3
with:
category: "/language:javascript-typescript"
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