@worldcoin/idkit-core 4.0.10 → 4.0.13-dev.cd5a8f0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -85,7 +85,7 @@ type IDKitSessionConfig = {
85
85
 
86
86
  /** V4 response item for World ID v4 uniqueness proofs */
87
87
  interface ResponseItemV4 {
88
- /** Credential identifier (e.g., "orb", "face", "document") */
88
+ /** Credential identifier (e.g., "proof_of_human", "face", "passport", "mnc") */
89
89
  identifier: string;
90
90
  /** Signal hash (optional, included if signal was provided in request) */
91
91
  signal_hash?: string;
@@ -93,7 +93,7 @@ interface ResponseItemV4 {
93
93
  proof: string[];
94
94
  /** RP-scoped nullifier (hex) */
95
95
  nullifier: string;
96
- /** Credential issuer schema ID (1=orb, 2=face, 3=secure_document, 4=document, 5=device) */
96
+ /** Credential issuer schema ID (1=proof_of_human, 11=face, 9303=passport, 9310=mnc) */
97
97
  issuer_schema_id: number;
98
98
  /** Minimum expiration timestamp (unix seconds) */
99
99
  expires_at_min: number;
@@ -101,7 +101,7 @@ interface ResponseItemV4 {
101
101
 
102
102
  /** V3 response item for World ID v3 (legacy format) */
103
103
  interface ResponseItemV3 {
104
- /** Credential identifier (e.g., "orb", "face") */
104
+ /** Credential identifier (e.g., "proof_of_human", "face") */
105
105
  identifier: string;
106
106
  /** Signal hash (optional, included if signal was provided in request) */
107
107
  signal_hash?: string;
@@ -115,7 +115,7 @@ interface ResponseItemV3 {
115
115
 
116
116
  /** Session response item for World ID v4 session proofs */
117
117
  interface ResponseItemSession {
118
- /** Credential identifier (e.g., "orb", "face", "document") */
118
+ /** Credential identifier (e.g., "proof_of_human", "face", "passport", "mnc") */
119
119
  identifier: string;
120
120
  /** Signal hash (optional, included if signal was provided in request) */
121
121
  signal_hash?: string;
@@ -123,7 +123,7 @@ interface ResponseItemSession {
123
123
  proof: string[];
124
124
  /** Session nullifier: 1st element is the session nullifier, 2nd is the generated action (hex strings) */
125
125
  session_nullifier: string[];
126
- /** Credential issuer schema ID (1=orb, 2=face, 3=secure_document, 4=document, 5=device) */
126
+ /** Credential issuer schema ID (1=proof_of_human, 11=face, 9303=passport, 9310=mnc) */
127
127
  issuer_schema_id: number;
128
128
  /** Minimum expiration timestamp (unix seconds) */
129
129
  expires_at_min: number;
@@ -187,43 +187,25 @@ type IDKitResult = IDKitResultV3 | IDKitResultV4 | IDKitResultSession;
187
187
 
188
188
  /** Error codes from World App (mirrors Rust AppError) */
189
189
  type IDKitErrorCode =
190
- | "user_rejected"
191
- | "verification_rejected"
192
- | "credential_unavailable"
193
- | "malformed_request"
194
- | "invalid_network"
195
- | "inclusion_proof_pending"
196
- | "inclusion_proof_failed"
197
- | "unexpected_response"
198
- | "connection_failed"
199
- | "max_verifications_reached"
200
- | "failed_by_host_app"
201
- | "generic_error";
190
+ | "user_rejected"
191
+ | "verification_rejected"
192
+ | "credential_unavailable"
193
+ | "malformed_request"
194
+ | "invalid_network"
195
+ | "inclusion_proof_pending"
196
+ | "inclusion_proof_failed"
197
+ | "unexpected_response"
198
+ | "connection_failed"
199
+ | "max_verifications_reached"
200
+ | "failed_by_host_app"
201
+ | "generic_error";
202
202
 
203
203
  /** Status returned from pollForStatus() */
204
204
  type Status$1 =
205
- | { type: "waiting_for_connection" }
206
- | { type: "awaiting_confirmation" }
207
- | { type: "confirmed"; result: IDKitResult }
208
- | { type: "failed"; error: IDKitErrorCode };
209
-
210
-
211
-
212
- type CredentialType = "orb" | "face" | "secure_document" | "document" | "device";
213
-
214
- interface CredentialRequestType {
215
- type: CredentialType;
216
- /** Signal can be a string or raw bytes (Uint8Array) */
217
- signal?: string | Uint8Array;
218
- genesis_issued_at_min?: number;
219
- expires_at_min?: number;
220
- }
221
-
222
- type ConstraintNode =
223
- | CredentialRequestType
224
- | { any: ConstraintNode[] }
225
- | { all: ConstraintNode[] }
226
- | { enumerate: ConstraintNode[] };
205
+ | { type: "waiting_for_connection" }
206
+ | { type: "awaiting_confirmation" }
207
+ | { type: "confirmed"; result: IDKitResult }
208
+ | { type: "failed"; error: IDKitErrorCode };
227
209
 
228
210
 
229
211
 
@@ -252,7 +234,31 @@ interface SelfieCheckLegacyPreset {
252
234
  signal?: string;
253
235
  }
254
236
 
255
- type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset;
237
+ interface DeviceLegacyPreset {
238
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
239
+ type: "DeviceLegacy";
240
+ signal?: string;
241
+ }
242
+
243
+ type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset | DeviceLegacyPreset;
244
+
245
+
246
+
247
+ type CredentialType = "proof_of_human" | "face" | "passport" | "mnc";
248
+
249
+ interface CredentialRequestType {
250
+ type: CredentialType;
251
+ /** Signal can be a string or raw bytes (Uint8Array) */
252
+ signal?: string | Uint8Array;
253
+ genesis_issued_at_min?: number;
254
+ expires_at_min?: number;
255
+ }
256
+
257
+ type ConstraintNode =
258
+ | CredentialRequestType
259
+ | { any: ConstraintNode[] }
260
+ | { all: ConstraintNode[] }
261
+ | { enumerate: ConstraintNode[] };
256
262
 
257
263
  /**
258
264
  * Result types - re-exported from WASM bindings
@@ -282,6 +288,10 @@ declare enum IDKitErrorCodes {
282
288
  Cancelled = "cancelled"
283
289
  }
284
290
 
291
+ /**
292
+ * Check if running inside World App
293
+ */
294
+ declare function isInWorldApp(): boolean;
285
295
  interface BuilderConfig {
286
296
  type: "request" | "session" | "proveSession";
287
297
  app_id: string;
@@ -391,6 +401,23 @@ declare function secureDocumentLegacy(opts?: {
391
401
  declare function documentLegacy(opts?: {
392
402
  signal?: string;
393
403
  }): DocumentLegacyPreset;
404
+ /**
405
+ * Creates a DeviceLegacy preset for World ID 3.0 legacy support
406
+ *
407
+ * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
408
+ *
409
+ * @param opts - Optional configuration with signal
410
+ * @returns A DeviceLegacy preset
411
+ *
412
+ * @example
413
+ * ```typescript
414
+ * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
415
+ * .preset(deviceLegacy({ signal: 'user-123' }))
416
+ * ```
417
+ */
418
+ declare function deviceLegacy(opts?: {
419
+ signal?: string;
420
+ }): DeviceLegacyPreset;
394
421
  /**
395
422
  * Creates a SelfieCheckLegacy preset for face verification
396
423
  *
@@ -430,7 +457,7 @@ declare class IDKitBuilder {
430
457
  * @example
431
458
  * ```typescript
432
459
  * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
433
- * .constraints(any(CredentialRequest('orb'), CredentialRequest('face')));
460
+ * .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
434
461
  * ```
435
462
  */
436
463
  constraints(constraints: ConstraintNode): Promise<IDKitRequest>;
@@ -440,7 +467,7 @@ declare class IDKitBuilder {
440
467
  * Presets provide a simplified way to create requests with predefined
441
468
  * credential configurations.
442
469
  *
443
- * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
470
+ * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
444
471
  * @returns A new IDKitRequest instance
445
472
  *
446
473
  * @example
@@ -479,7 +506,7 @@ declare class IDKitBuilder {
479
506
  * action: 'my-action',
480
507
  * rp_context: { ... },
481
508
  * allow_legacy_proofs: false,
482
- * }).constraints(enumerate(CredentialRequest('orb'), CredentialRequest('face')));
509
+ * }).constraints(enumerate(CredentialRequest('proof_of_human'), CredentialRequest('face')));
483
510
  *
484
511
  * // In World App: connectorURI is empty, result comes via postMessage
485
512
  * // On web: connectorURI is the QR URL to display
@@ -520,6 +547,8 @@ declare const IDKit: {
520
547
  secureDocumentLegacy: typeof secureDocumentLegacy;
521
548
  /** Create a DocumentLegacy preset for World ID 3.0 legacy support */
522
549
  documentLegacy: typeof documentLegacy;
550
+ /** Create a DeviceLegacy preset for World ID 3.0 legacy support */
551
+ deviceLegacy: typeof deviceLegacy;
523
552
  /** Create a SelfieCheckLegacy preset for face verification */
524
553
  selfieCheckLegacy: typeof selfieCheckLegacy;
525
554
  };
@@ -546,4 +575,4 @@ declare const isWeb: () => boolean;
546
575
  */
547
576
  declare const isNode: () => boolean;
548
577
 
549
- export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, documentLegacy, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
578
+ export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DeviceLegacyPreset, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, deviceLegacy, documentLegacy, isInWorldApp, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
package/dist/index.d.ts CHANGED
@@ -85,7 +85,7 @@ type IDKitSessionConfig = {
85
85
 
86
86
  /** V4 response item for World ID v4 uniqueness proofs */
87
87
  interface ResponseItemV4 {
88
- /** Credential identifier (e.g., "orb", "face", "document") */
88
+ /** Credential identifier (e.g., "proof_of_human", "face", "passport", "mnc") */
89
89
  identifier: string;
90
90
  /** Signal hash (optional, included if signal was provided in request) */
91
91
  signal_hash?: string;
@@ -93,7 +93,7 @@ interface ResponseItemV4 {
93
93
  proof: string[];
94
94
  /** RP-scoped nullifier (hex) */
95
95
  nullifier: string;
96
- /** Credential issuer schema ID (1=orb, 2=face, 3=secure_document, 4=document, 5=device) */
96
+ /** Credential issuer schema ID (1=proof_of_human, 11=face, 9303=passport, 9310=mnc) */
97
97
  issuer_schema_id: number;
98
98
  /** Minimum expiration timestamp (unix seconds) */
99
99
  expires_at_min: number;
@@ -101,7 +101,7 @@ interface ResponseItemV4 {
101
101
 
102
102
  /** V3 response item for World ID v3 (legacy format) */
103
103
  interface ResponseItemV3 {
104
- /** Credential identifier (e.g., "orb", "face") */
104
+ /** Credential identifier (e.g., "proof_of_human", "face") */
105
105
  identifier: string;
106
106
  /** Signal hash (optional, included if signal was provided in request) */
107
107
  signal_hash?: string;
@@ -115,7 +115,7 @@ interface ResponseItemV3 {
115
115
 
116
116
  /** Session response item for World ID v4 session proofs */
117
117
  interface ResponseItemSession {
118
- /** Credential identifier (e.g., "orb", "face", "document") */
118
+ /** Credential identifier (e.g., "proof_of_human", "face", "passport", "mnc") */
119
119
  identifier: string;
120
120
  /** Signal hash (optional, included if signal was provided in request) */
121
121
  signal_hash?: string;
@@ -123,7 +123,7 @@ interface ResponseItemSession {
123
123
  proof: string[];
124
124
  /** Session nullifier: 1st element is the session nullifier, 2nd is the generated action (hex strings) */
125
125
  session_nullifier: string[];
126
- /** Credential issuer schema ID (1=orb, 2=face, 3=secure_document, 4=document, 5=device) */
126
+ /** Credential issuer schema ID (1=proof_of_human, 11=face, 9303=passport, 9310=mnc) */
127
127
  issuer_schema_id: number;
128
128
  /** Minimum expiration timestamp (unix seconds) */
129
129
  expires_at_min: number;
@@ -187,43 +187,25 @@ type IDKitResult = IDKitResultV3 | IDKitResultV4 | IDKitResultSession;
187
187
 
188
188
  /** Error codes from World App (mirrors Rust AppError) */
189
189
  type IDKitErrorCode =
190
- | "user_rejected"
191
- | "verification_rejected"
192
- | "credential_unavailable"
193
- | "malformed_request"
194
- | "invalid_network"
195
- | "inclusion_proof_pending"
196
- | "inclusion_proof_failed"
197
- | "unexpected_response"
198
- | "connection_failed"
199
- | "max_verifications_reached"
200
- | "failed_by_host_app"
201
- | "generic_error";
190
+ | "user_rejected"
191
+ | "verification_rejected"
192
+ | "credential_unavailable"
193
+ | "malformed_request"
194
+ | "invalid_network"
195
+ | "inclusion_proof_pending"
196
+ | "inclusion_proof_failed"
197
+ | "unexpected_response"
198
+ | "connection_failed"
199
+ | "max_verifications_reached"
200
+ | "failed_by_host_app"
201
+ | "generic_error";
202
202
 
203
203
  /** Status returned from pollForStatus() */
204
204
  type Status$1 =
205
- | { type: "waiting_for_connection" }
206
- | { type: "awaiting_confirmation" }
207
- | { type: "confirmed"; result: IDKitResult }
208
- | { type: "failed"; error: IDKitErrorCode };
209
-
210
-
211
-
212
- type CredentialType = "orb" | "face" | "secure_document" | "document" | "device";
213
-
214
- interface CredentialRequestType {
215
- type: CredentialType;
216
- /** Signal can be a string or raw bytes (Uint8Array) */
217
- signal?: string | Uint8Array;
218
- genesis_issued_at_min?: number;
219
- expires_at_min?: number;
220
- }
221
-
222
- type ConstraintNode =
223
- | CredentialRequestType
224
- | { any: ConstraintNode[] }
225
- | { all: ConstraintNode[] }
226
- | { enumerate: ConstraintNode[] };
205
+ | { type: "waiting_for_connection" }
206
+ | { type: "awaiting_confirmation" }
207
+ | { type: "confirmed"; result: IDKitResult }
208
+ | { type: "failed"; error: IDKitErrorCode };
227
209
 
228
210
 
229
211
 
@@ -252,7 +234,31 @@ interface SelfieCheckLegacyPreset {
252
234
  signal?: string;
253
235
  }
254
236
 
255
- type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset;
237
+ interface DeviceLegacyPreset {
238
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
239
+ type: "DeviceLegacy";
240
+ signal?: string;
241
+ }
242
+
243
+ type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset | DeviceLegacyPreset;
244
+
245
+
246
+
247
+ type CredentialType = "proof_of_human" | "face" | "passport" | "mnc";
248
+
249
+ interface CredentialRequestType {
250
+ type: CredentialType;
251
+ /** Signal can be a string or raw bytes (Uint8Array) */
252
+ signal?: string | Uint8Array;
253
+ genesis_issued_at_min?: number;
254
+ expires_at_min?: number;
255
+ }
256
+
257
+ type ConstraintNode =
258
+ | CredentialRequestType
259
+ | { any: ConstraintNode[] }
260
+ | { all: ConstraintNode[] }
261
+ | { enumerate: ConstraintNode[] };
256
262
 
257
263
  /**
258
264
  * Result types - re-exported from WASM bindings
@@ -282,6 +288,10 @@ declare enum IDKitErrorCodes {
282
288
  Cancelled = "cancelled"
283
289
  }
284
290
 
291
+ /**
292
+ * Check if running inside World App
293
+ */
294
+ declare function isInWorldApp(): boolean;
285
295
  interface BuilderConfig {
286
296
  type: "request" | "session" | "proveSession";
287
297
  app_id: string;
@@ -391,6 +401,23 @@ declare function secureDocumentLegacy(opts?: {
391
401
  declare function documentLegacy(opts?: {
392
402
  signal?: string;
393
403
  }): DocumentLegacyPreset;
404
+ /**
405
+ * Creates a DeviceLegacy preset for World ID 3.0 legacy support
406
+ *
407
+ * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
408
+ *
409
+ * @param opts - Optional configuration with signal
410
+ * @returns A DeviceLegacy preset
411
+ *
412
+ * @example
413
+ * ```typescript
414
+ * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
415
+ * .preset(deviceLegacy({ signal: 'user-123' }))
416
+ * ```
417
+ */
418
+ declare function deviceLegacy(opts?: {
419
+ signal?: string;
420
+ }): DeviceLegacyPreset;
394
421
  /**
395
422
  * Creates a SelfieCheckLegacy preset for face verification
396
423
  *
@@ -430,7 +457,7 @@ declare class IDKitBuilder {
430
457
  * @example
431
458
  * ```typescript
432
459
  * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
433
- * .constraints(any(CredentialRequest('orb'), CredentialRequest('face')));
460
+ * .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
434
461
  * ```
435
462
  */
436
463
  constraints(constraints: ConstraintNode): Promise<IDKitRequest>;
@@ -440,7 +467,7 @@ declare class IDKitBuilder {
440
467
  * Presets provide a simplified way to create requests with predefined
441
468
  * credential configurations.
442
469
  *
443
- * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
470
+ * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
444
471
  * @returns A new IDKitRequest instance
445
472
  *
446
473
  * @example
@@ -479,7 +506,7 @@ declare class IDKitBuilder {
479
506
  * action: 'my-action',
480
507
  * rp_context: { ... },
481
508
  * allow_legacy_proofs: false,
482
- * }).constraints(enumerate(CredentialRequest('orb'), CredentialRequest('face')));
509
+ * }).constraints(enumerate(CredentialRequest('proof_of_human'), CredentialRequest('face')));
483
510
  *
484
511
  * // In World App: connectorURI is empty, result comes via postMessage
485
512
  * // On web: connectorURI is the QR URL to display
@@ -520,6 +547,8 @@ declare const IDKit: {
520
547
  secureDocumentLegacy: typeof secureDocumentLegacy;
521
548
  /** Create a DocumentLegacy preset for World ID 3.0 legacy support */
522
549
  documentLegacy: typeof documentLegacy;
550
+ /** Create a DeviceLegacy preset for World ID 3.0 legacy support */
551
+ deviceLegacy: typeof deviceLegacy;
523
552
  /** Create a SelfieCheckLegacy preset for face verification */
524
553
  selfieCheckLegacy: typeof selfieCheckLegacy;
525
554
  };
@@ -546,4 +575,4 @@ declare const isWeb: () => boolean;
546
575
  */
547
576
  declare const isNode: () => boolean;
548
577
 
549
- export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, documentLegacy, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
578
+ export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DeviceLegacyPreset, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, deviceLegacy, documentLegacy, isInWorldApp, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };