@worldcoin/idkit-core 4.0.9 → 4.0.10-dev.b24e0c1

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/README.md CHANGED
@@ -56,7 +56,7 @@ const request = await IDKit.request({
56
56
  const qrUrl = request.connectorURI;
57
57
  ```
58
58
 
59
- **Available presets:** `orbLegacy`, `documentLegacy`, `secureDocumentLegacy`, `selfieCheckLegacy`
59
+ **Available presets:** `orbLegacy`, `documentLegacy`, `secureDocumentLegacy`, `deviceLegacy`, `selfieCheckLegacy`
60
60
 
61
61
  Selfie check preset example:
62
62
 
Binary file
package/dist/index.cjs CHANGED
@@ -249,40 +249,6 @@ function _assertClass(instance, klass) {
249
249
  throw new Error(`expected instance of ${klass.name}`);
250
250
  }
251
251
  }
252
- function createSession(app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
253
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
254
- const len0 = WASM_VECTOR_LEN;
255
- _assertClass(rp_context, RpContextWasm);
256
- var ptr1 = rp_context.__destroy_into_raw();
257
- var ptr2 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
258
- var len2 = WASM_VECTOR_LEN;
259
- var ptr3 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
260
- var len3 = WASM_VECTOR_LEN;
261
- var ptr4 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
262
- var len4 = WASM_VECTOR_LEN;
263
- var ptr5 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
264
- var len5 = WASM_VECTOR_LEN;
265
- const ret = wasm.createSession(ptr0, len0, ptr1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
266
- return IDKitBuilder.__wrap(ret);
267
- }
268
- function request(app_id, action, rp_context, action_description, bridge_url, allow_legacy_proofs, override_connect_base_url, environment) {
269
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
270
- const len0 = WASM_VECTOR_LEN;
271
- const ptr1 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
272
- const len1 = WASM_VECTOR_LEN;
273
- _assertClass(rp_context, RpContextWasm);
274
- var ptr2 = rp_context.__destroy_into_raw();
275
- var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
276
- var len3 = WASM_VECTOR_LEN;
277
- var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
278
- var len4 = WASM_VECTOR_LEN;
279
- var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
280
- var len5 = WASM_VECTOR_LEN;
281
- var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
282
- var len6 = WASM_VECTOR_LEN;
283
- const ret = wasm.idkitbuilder_new(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, allow_legacy_proofs, ptr5, len5, ptr6, len6);
284
- return IDKitBuilder.__wrap(ret);
285
- }
286
252
  function base64Decode(data) {
287
253
  try {
288
254
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -321,6 +287,22 @@ function proveSession(session_id, app_id, rp_context, action_description, bridge
321
287
  const ret = wasm.idkitbuilder_forProveSession(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
322
288
  return IDKitBuilder.__wrap(ret);
323
289
  }
290
+ function createSession(app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
291
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
292
+ const len0 = WASM_VECTOR_LEN;
293
+ _assertClass(rp_context, RpContextWasm);
294
+ var ptr1 = rp_context.__destroy_into_raw();
295
+ var ptr2 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
296
+ var len2 = WASM_VECTOR_LEN;
297
+ var ptr3 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
298
+ var len3 = WASM_VECTOR_LEN;
299
+ var ptr4 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
300
+ var len4 = WASM_VECTOR_LEN;
301
+ var ptr5 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
302
+ var len5 = WASM_VECTOR_LEN;
303
+ const ret = wasm.createSession(ptr0, len0, ptr1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
304
+ return IDKitBuilder.__wrap(ret);
305
+ }
324
306
  function passArray8ToWasm0(arg, malloc) {
325
307
  const ptr = malloc(arg.length * 1, 1) >>> 0;
326
308
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -345,27 +327,23 @@ function base64Encode(data) {
345
327
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
346
328
  }
347
329
  }
348
- function init_wasm() {
349
- wasm.init_wasm();
350
- }
351
- function signRequest(action, signing_key_hex, ttl_seconds) {
352
- try {
353
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
354
- const ptr0 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
355
- const len0 = WASM_VECTOR_LEN;
356
- const ptr1 = passStringToWasm0(signing_key_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
357
- const len1 = WASM_VECTOR_LEN;
358
- wasm.signRequest(retptr, ptr0, len0, ptr1, len1, !isLikeNone(ttl_seconds), isLikeNone(ttl_seconds) ? BigInt(0) : ttl_seconds);
359
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
360
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
361
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
362
- if (r2) {
363
- throw takeObject(r1);
364
- }
365
- return RpSignature.__wrap(r0);
366
- } finally {
367
- wasm.__wbindgen_add_to_stack_pointer(16);
368
- }
330
+ function request(app_id, action, rp_context, action_description, bridge_url, allow_legacy_proofs, override_connect_base_url, environment) {
331
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
332
+ const len0 = WASM_VECTOR_LEN;
333
+ const ptr1 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
334
+ const len1 = WASM_VECTOR_LEN;
335
+ _assertClass(rp_context, RpContextWasm);
336
+ var ptr2 = rp_context.__destroy_into_raw();
337
+ var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
338
+ var len3 = WASM_VECTOR_LEN;
339
+ var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
340
+ var len4 = WASM_VECTOR_LEN;
341
+ var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
342
+ var len5 = WASM_VECTOR_LEN;
343
+ var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
344
+ var len6 = WASM_VECTOR_LEN;
345
+ const ret = wasm.idkitbuilder_new(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, allow_legacy_proofs, ptr5, len5, ptr6, len6);
346
+ return IDKitBuilder.__wrap(ret);
369
347
  }
370
348
  function hashSignal(signal) {
371
349
  let deferred2_0;
@@ -392,14 +370,36 @@ function hashSignal(signal) {
392
370
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
393
371
  }
394
372
  }
395
- function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
396
- wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
373
+ function init_wasm() {
374
+ wasm.init_wasm();
397
375
  }
398
- function __wasm_bindgen_func_elem_605(arg0, arg1) {
399
- wasm.__wasm_bindgen_func_elem_605(arg0, arg1);
376
+ function signRequest(action, signing_key_hex, ttl_seconds) {
377
+ try {
378
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
379
+ const ptr0 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
380
+ const len0 = WASM_VECTOR_LEN;
381
+ const ptr1 = passStringToWasm0(signing_key_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
382
+ const len1 = WASM_VECTOR_LEN;
383
+ wasm.signRequest(retptr, ptr0, len0, ptr1, len1, !isLikeNone(ttl_seconds), isLikeNone(ttl_seconds) ? BigInt(0) : ttl_seconds);
384
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
385
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
386
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
387
+ if (r2) {
388
+ throw takeObject(r1);
389
+ }
390
+ return RpSignature.__wrap(r0);
391
+ } finally {
392
+ wasm.__wbindgen_add_to_stack_pointer(16);
393
+ }
400
394
  }
401
- function __wasm_bindgen_func_elem_1353(arg0, arg1, arg2, arg3) {
402
- wasm.__wasm_bindgen_func_elem_1353(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
395
+ function __wasm_bindgen_func_elem_619(arg0, arg1) {
396
+ wasm.__wasm_bindgen_func_elem_619(arg0, arg1);
397
+ }
398
+ function __wasm_bindgen_func_elem_982(arg0, arg1, arg2) {
399
+ wasm.__wasm_bindgen_func_elem_982(arg0, arg1, addHeapObject(arg2));
400
+ }
401
+ function __wasm_bindgen_func_elem_1367(arg0, arg1, arg2, arg3) {
402
+ wasm.__wasm_bindgen_func_elem_1367(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
403
403
  }
404
404
  var __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
405
405
  var __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -887,6 +887,35 @@ var IDKitBuilder = class _IDKitBuilder {
887
887
  wasm.__wbindgen_add_to_stack_pointer(16);
888
888
  }
889
889
  }
890
+ /**
891
+ * Builds a v1 (legacy) native payload from a preset (synchronous, no bridge connection).
892
+ *
893
+ * Used by the native transport when the World App only supports verify v1.
894
+ * Only legacy presets produce valid v1 payloads (constraints always have
895
+ * `Deprecated` verification level and will fail).
896
+ *
897
+ * # Errors
898
+ *
899
+ * Returns an error if the preset is invalid or v1 payload construction fails.
900
+ * @param {any} preset_json
901
+ * @returns {any}
902
+ */
903
+ nativePayloadV1FromPreset(preset_json) {
904
+ try {
905
+ const ptr = this.__destroy_into_raw();
906
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
907
+ wasm.idkitbuilder_nativePayloadV1FromPreset(retptr, ptr, addHeapObject(preset_json));
908
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
909
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
910
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
911
+ if (r2) {
912
+ throw takeObject(r1);
913
+ }
914
+ return takeObject(r0);
915
+ } finally {
916
+ wasm.__wbindgen_add_to_stack_pointer(16);
917
+ }
918
+ }
890
919
  /**
891
920
  * Creates a new builder for uniqueness requests
892
921
  * @param {string} app_id
@@ -1562,7 +1591,7 @@ function __wbg_get_imports() {
1562
1591
  const a = state0.a;
1563
1592
  state0.a = 0;
1564
1593
  try {
1565
- return __wasm_bindgen_func_elem_1353(a, state0.b, arg02, arg12);
1594
+ return __wasm_bindgen_func_elem_1367(a, state0.b, arg02, arg12);
1566
1595
  } finally {
1567
1596
  state0.a = a;
1568
1597
  }
@@ -1771,14 +1800,18 @@ function __wbg_get_imports() {
1771
1800
  const ret = getObject(arg0).versions;
1772
1801
  return addHeapObject(ret);
1773
1802
  };
1774
- imports.wbg.__wbindgen_cast_02740531cfdb05fe = function(arg0, arg1) {
1775
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_604, __wasm_bindgen_func_elem_605);
1803
+ imports.wbg.__wbindgen_cast_0c688d3d5dd51bcb = function(arg0, arg1) {
1804
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_981, __wasm_bindgen_func_elem_982);
1776
1805
  return addHeapObject(ret);
1777
1806
  };
1778
1807
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1779
1808
  const ret = getStringFromWasm0(arg0, arg1);
1780
1809
  return addHeapObject(ret);
1781
1810
  };
1811
+ imports.wbg.__wbindgen_cast_26df652e200d9104 = function(arg0, arg1) {
1812
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_618, __wasm_bindgen_func_elem_619);
1813
+ return addHeapObject(ret);
1814
+ };
1782
1815
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1783
1816
  const ret = BigInt.asUintN(64, arg0);
1784
1817
  return addHeapObject(ret);
@@ -1795,10 +1828,6 @@ function __wbg_get_imports() {
1795
1828
  const ret = arg0;
1796
1829
  return addHeapObject(ret);
1797
1830
  };
1798
- imports.wbg.__wbindgen_cast_f23235b6472d5cf3 = function(arg0, arg1) {
1799
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_967, __wasm_bindgen_func_elem_968);
1800
- return addHeapObject(ret);
1801
- };
1802
1831
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1803
1832
  const ret = getObject(arg0);
1804
1833
  return addHeapObject(ret);
@@ -1880,21 +1909,32 @@ var MINIAPP_VERIFY_ACTION = "miniapp-verify-action";
1880
1909
  function isInWorldApp() {
1881
1910
  return typeof window !== "undefined" && Boolean(window.WorldApp);
1882
1911
  }
1912
+ function getWorldAppVerifyVersion() {
1913
+ const cmds = window.WorldApp?.supported_commands;
1914
+ if (!Array.isArray(cmds)) return 1;
1915
+ const verify = cmds.find((c) => c.name === "verify");
1916
+ return verify?.supported_versions?.includes(2) ? 2 : 1;
1917
+ }
1883
1918
  var _requestCounter = 0;
1884
1919
  var _activeNativeRequest = null;
1885
- function createNativeRequest(wasmPayload, config, signalHashes = {}) {
1920
+ function createNativeRequest(wasmPayload, config, signalHashes = {}, version) {
1886
1921
  if (_activeNativeRequest?.isPending()) {
1887
1922
  console.warn(
1888
1923
  "IDKit native request already in flight. Reusing active request."
1889
1924
  );
1890
1925
  return _activeNativeRequest;
1891
1926
  }
1892
- const request2 = new NativeIDKitRequest(wasmPayload, config, signalHashes);
1927
+ const request2 = new NativeIDKitRequest(
1928
+ wasmPayload,
1929
+ config,
1930
+ signalHashes,
1931
+ version
1932
+ );
1893
1933
  _activeNativeRequest = request2;
1894
1934
  return request2;
1895
1935
  }
1896
1936
  var NativeIDKitRequest = class {
1897
- constructor(wasmPayload, config, signalHashes = {}) {
1937
+ constructor(wasmPayload, config, signalHashes = {}, version) {
1898
1938
  this.connectorURI = "";
1899
1939
  this.resolved = false;
1900
1940
  this.cancelled = false;
@@ -1948,7 +1988,7 @@ var NativeIDKitRequest = class {
1948
1988
  }
1949
1989
  const sendPayload = {
1950
1990
  command: "verify",
1951
- version: 2,
1991
+ version,
1952
1992
  payload: wasmPayload
1953
1993
  };
1954
1994
  const w = window;
@@ -2180,6 +2220,9 @@ function secureDocumentLegacy(opts = {}) {
2180
2220
  function documentLegacy(opts = {}) {
2181
2221
  return { type: "DocumentLegacy", signal: opts.signal };
2182
2222
  }
2223
+ function deviceLegacy(opts = {}) {
2224
+ return { type: "DeviceLegacy", signal: opts.signal };
2225
+ }
2183
2226
  function selfieCheckLegacy(opts = {}) {
2184
2227
  return { type: "SelfieCheckLegacy", signal: opts.signal };
2185
2228
  }
@@ -2244,15 +2287,23 @@ var IDKitBuilder2 = class {
2244
2287
  */
2245
2288
  async constraints(constraints) {
2246
2289
  await initIDKit();
2247
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2248
2290
  if (isInWorldApp()) {
2249
- const wasmResult = wasmBuilder.nativePayload(constraints);
2291
+ const verifyVersion = getWorldAppVerifyVersion();
2292
+ if (verifyVersion < 2) {
2293
+ throw new Error(
2294
+ "verify v2 is not supported by this World App version. Use a legacy preset (e.g. orbLegacy()) or update the World App."
2295
+ );
2296
+ }
2297
+ const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2298
+ const wasmResult = wasmBuilder2.nativePayload(constraints);
2250
2299
  return createNativeRequest(
2251
2300
  wasmResult.payload,
2252
2301
  this.config,
2253
- wasmResult.signal_hashes ?? {}
2302
+ wasmResult.signal_hashes ?? {},
2303
+ 2
2254
2304
  );
2255
2305
  }
2306
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2256
2307
  const wasmRequest = await wasmBuilder.constraints(
2257
2308
  constraints
2258
2309
  );
@@ -2264,7 +2315,7 @@ var IDKitBuilder2 = class {
2264
2315
  * Presets provide a simplified way to create requests with predefined
2265
2316
  * credential configurations.
2266
2317
  *
2267
- * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
2318
+ * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
2268
2319
  * @returns A new IDKitRequest instance
2269
2320
  *
2270
2321
  * @example
@@ -2275,15 +2326,37 @@ var IDKitBuilder2 = class {
2275
2326
  */
2276
2327
  async preset(preset) {
2277
2328
  await initIDKit();
2278
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2279
2329
  if (isInWorldApp()) {
2280
- const wasmResult = wasmBuilder.nativePayloadFromPreset(preset);
2281
- return createNativeRequest(
2282
- wasmResult.payload,
2283
- this.config,
2284
- wasmResult.signal_hashes ?? {}
2285
- );
2330
+ const verifyVersion = getWorldAppVerifyVersion();
2331
+ if (verifyVersion === 2) {
2332
+ const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2333
+ const wasmResult = wasmBuilder2.nativePayloadFromPreset(preset);
2334
+ return createNativeRequest(
2335
+ wasmResult.payload,
2336
+ this.config,
2337
+ wasmResult.signal_hashes ?? {},
2338
+ 2
2339
+ );
2340
+ }
2341
+ try {
2342
+ const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2343
+ const wasmResult = wasmBuilder2.nativePayloadV1FromPreset(preset);
2344
+ return createNativeRequest(
2345
+ wasmResult.payload,
2346
+ this.config,
2347
+ wasmResult.signal_hashes ?? {},
2348
+ 1
2349
+ );
2350
+ } catch (err) {
2351
+ if (err instanceof Error && String(err.message).includes("v1 payload")) {
2352
+ throw new Error(
2353
+ "verify v2 is not supported by this World App version. Use a legacy preset (e.g. orbLegacy()) or update the World App."
2354
+ );
2355
+ }
2356
+ throw err;
2357
+ }
2286
2358
  }
2359
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2287
2360
  const wasmRequest = await wasmBuilder.preset(
2288
2361
  preset
2289
2362
  );
@@ -2341,6 +2414,8 @@ var IDKit = {
2341
2414
  secureDocumentLegacy,
2342
2415
  /** Create a DocumentLegacy preset for World ID 3.0 legacy support */
2343
2416
  documentLegacy,
2417
+ /** Create a DeviceLegacy preset for World ID 3.0 legacy support */
2418
+ deviceLegacy,
2344
2419
  /** Create a SelfieCheckLegacy preset for face verification */
2345
2420
  selfieCheckLegacy
2346
2421
  };
@@ -2382,6 +2457,7 @@ Object.defineProperty(exports, "signRequest", {
2382
2457
  });
2383
2458
  exports.IDKit = IDKit;
2384
2459
  exports.IDKitErrorCodes = IDKitErrorCodes;
2460
+ exports.deviceLegacy = deviceLegacy;
2385
2461
  exports.documentLegacy = documentLegacy;
2386
2462
  exports.hashSignal = hashSignal2;
2387
2463
  exports.isNode = isNode;
package/dist/index.d.cts CHANGED
@@ -83,35 +83,6 @@ type IDKitSessionConfig = {
83
83
  environment?: "production" | "staging";
84
84
  };
85
85
 
86
- interface OrbLegacyPreset {
87
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
88
- type: "OrbLegacy";
89
- signal?: string;
90
- }
91
-
92
- interface SecureDocumentLegacyPreset {
93
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
94
- type: "SecureDocumentLegacy";
95
- signal?: string;
96
- }
97
-
98
- interface DocumentLegacyPreset {
99
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
100
- type: "DocumentLegacy";
101
- signal?: string;
102
- }
103
-
104
- interface SelfieCheckLegacyPreset {
105
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
106
- /** Preview: Selfie Check is currently in preview. Contact us if you need it enabled. */
107
- type: "SelfieCheckLegacy";
108
- signal?: string;
109
- }
110
-
111
- type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset;
112
-
113
-
114
-
115
86
  /** V4 response item for World ID v4 uniqueness proofs */
116
87
  interface ResponseItemV4 {
117
88
  /** Credential identifier (e.g., "orb", "face", "document") */
@@ -254,6 +225,41 @@ type ConstraintNode =
254
225
  | { all: ConstraintNode[] }
255
226
  | { enumerate: ConstraintNode[] };
256
227
 
228
+
229
+
230
+ interface OrbLegacyPreset {
231
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
232
+ type: "OrbLegacy";
233
+ signal?: string;
234
+ }
235
+
236
+ interface SecureDocumentLegacyPreset {
237
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
238
+ type: "SecureDocumentLegacy";
239
+ signal?: string;
240
+ }
241
+
242
+ interface DocumentLegacyPreset {
243
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
244
+ type: "DocumentLegacy";
245
+ signal?: string;
246
+ }
247
+
248
+ interface SelfieCheckLegacyPreset {
249
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
250
+ /** Preview: Selfie Check is currently in preview. Contact us if you need it enabled. */
251
+ type: "SelfieCheckLegacy";
252
+ signal?: string;
253
+ }
254
+
255
+ interface DeviceLegacyPreset {
256
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
257
+ type: "DeviceLegacy";
258
+ signal?: string;
259
+ }
260
+
261
+ type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset | DeviceLegacyPreset;
262
+
257
263
  /**
258
264
  * Result types - re-exported from WASM bindings
259
265
  *
@@ -391,6 +397,23 @@ declare function secureDocumentLegacy(opts?: {
391
397
  declare function documentLegacy(opts?: {
392
398
  signal?: string;
393
399
  }): DocumentLegacyPreset;
400
+ /**
401
+ * Creates a DeviceLegacy preset for World ID 3.0 legacy support
402
+ *
403
+ * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
404
+ *
405
+ * @param opts - Optional configuration with signal
406
+ * @returns A DeviceLegacy preset
407
+ *
408
+ * @example
409
+ * ```typescript
410
+ * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
411
+ * .preset(deviceLegacy({ signal: 'user-123' }))
412
+ * ```
413
+ */
414
+ declare function deviceLegacy(opts?: {
415
+ signal?: string;
416
+ }): DeviceLegacyPreset;
394
417
  /**
395
418
  * Creates a SelfieCheckLegacy preset for face verification
396
419
  *
@@ -440,7 +463,7 @@ declare class IDKitBuilder {
440
463
  * Presets provide a simplified way to create requests with predefined
441
464
  * credential configurations.
442
465
  *
443
- * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
466
+ * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
444
467
  * @returns A new IDKitRequest instance
445
468
  *
446
469
  * @example
@@ -520,6 +543,8 @@ declare const IDKit: {
520
543
  secureDocumentLegacy: typeof secureDocumentLegacy;
521
544
  /** Create a DocumentLegacy preset for World ID 3.0 legacy support */
522
545
  documentLegacy: typeof documentLegacy;
546
+ /** Create a DeviceLegacy preset for World ID 3.0 legacy support */
547
+ deviceLegacy: typeof deviceLegacy;
523
548
  /** Create a SelfieCheckLegacy preset for face verification */
524
549
  selfieCheckLegacy: typeof selfieCheckLegacy;
525
550
  };
@@ -546,4 +571,4 @@ declare const isWeb: () => boolean;
546
571
  */
547
572
  declare const isNode: () => boolean;
548
573
 
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 };
574
+ 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, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
package/dist/index.d.ts CHANGED
@@ -83,35 +83,6 @@ type IDKitSessionConfig = {
83
83
  environment?: "production" | "staging";
84
84
  };
85
85
 
86
- interface OrbLegacyPreset {
87
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
88
- type: "OrbLegacy";
89
- signal?: string;
90
- }
91
-
92
- interface SecureDocumentLegacyPreset {
93
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
94
- type: "SecureDocumentLegacy";
95
- signal?: string;
96
- }
97
-
98
- interface DocumentLegacyPreset {
99
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
100
- type: "DocumentLegacy";
101
- signal?: string;
102
- }
103
-
104
- interface SelfieCheckLegacyPreset {
105
- /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
106
- /** Preview: Selfie Check is currently in preview. Contact us if you need it enabled. */
107
- type: "SelfieCheckLegacy";
108
- signal?: string;
109
- }
110
-
111
- type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset;
112
-
113
-
114
-
115
86
  /** V4 response item for World ID v4 uniqueness proofs */
116
87
  interface ResponseItemV4 {
117
88
  /** Credential identifier (e.g., "orb", "face", "document") */
@@ -254,6 +225,41 @@ type ConstraintNode =
254
225
  | { all: ConstraintNode[] }
255
226
  | { enumerate: ConstraintNode[] };
256
227
 
228
+
229
+
230
+ interface OrbLegacyPreset {
231
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
232
+ type: "OrbLegacy";
233
+ signal?: string;
234
+ }
235
+
236
+ interface SecureDocumentLegacyPreset {
237
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
238
+ type: "SecureDocumentLegacy";
239
+ signal?: string;
240
+ }
241
+
242
+ interface DocumentLegacyPreset {
243
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
244
+ type: "DocumentLegacy";
245
+ signal?: string;
246
+ }
247
+
248
+ interface SelfieCheckLegacyPreset {
249
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
250
+ /** Preview: Selfie Check is currently in preview. Contact us if you need it enabled. */
251
+ type: "SelfieCheckLegacy";
252
+ signal?: string;
253
+ }
254
+
255
+ interface DeviceLegacyPreset {
256
+ /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
257
+ type: "DeviceLegacy";
258
+ signal?: string;
259
+ }
260
+
261
+ type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset | DeviceLegacyPreset;
262
+
257
263
  /**
258
264
  * Result types - re-exported from WASM bindings
259
265
  *
@@ -391,6 +397,23 @@ declare function secureDocumentLegacy(opts?: {
391
397
  declare function documentLegacy(opts?: {
392
398
  signal?: string;
393
399
  }): DocumentLegacyPreset;
400
+ /**
401
+ * Creates a DeviceLegacy preset for World ID 3.0 legacy support
402
+ *
403
+ * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
404
+ *
405
+ * @param opts - Optional configuration with signal
406
+ * @returns A DeviceLegacy preset
407
+ *
408
+ * @example
409
+ * ```typescript
410
+ * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
411
+ * .preset(deviceLegacy({ signal: 'user-123' }))
412
+ * ```
413
+ */
414
+ declare function deviceLegacy(opts?: {
415
+ signal?: string;
416
+ }): DeviceLegacyPreset;
394
417
  /**
395
418
  * Creates a SelfieCheckLegacy preset for face verification
396
419
  *
@@ -440,7 +463,7 @@ declare class IDKitBuilder {
440
463
  * Presets provide a simplified way to create requests with predefined
441
464
  * credential configurations.
442
465
  *
443
- * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
466
+ * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
444
467
  * @returns A new IDKitRequest instance
445
468
  *
446
469
  * @example
@@ -520,6 +543,8 @@ declare const IDKit: {
520
543
  secureDocumentLegacy: typeof secureDocumentLegacy;
521
544
  /** Create a DocumentLegacy preset for World ID 3.0 legacy support */
522
545
  documentLegacy: typeof documentLegacy;
546
+ /** Create a DeviceLegacy preset for World ID 3.0 legacy support */
547
+ deviceLegacy: typeof deviceLegacy;
523
548
  /** Create a SelfieCheckLegacy preset for face verification */
524
549
  selfieCheckLegacy: typeof selfieCheckLegacy;
525
550
  };
@@ -546,4 +571,4 @@ declare const isWeb: () => boolean;
546
571
  */
547
572
  declare const isNode: () => boolean;
548
573
 
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 };
574
+ 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, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
package/dist/index.js CHANGED
@@ -246,40 +246,6 @@ function _assertClass(instance, klass) {
246
246
  throw new Error(`expected instance of ${klass.name}`);
247
247
  }
248
248
  }
249
- function createSession(app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
250
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
251
- const len0 = WASM_VECTOR_LEN;
252
- _assertClass(rp_context, RpContextWasm);
253
- var ptr1 = rp_context.__destroy_into_raw();
254
- var ptr2 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
255
- var len2 = WASM_VECTOR_LEN;
256
- var ptr3 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
257
- var len3 = WASM_VECTOR_LEN;
258
- var ptr4 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
259
- var len4 = WASM_VECTOR_LEN;
260
- var ptr5 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
261
- var len5 = WASM_VECTOR_LEN;
262
- const ret = wasm.createSession(ptr0, len0, ptr1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
263
- return IDKitBuilder.__wrap(ret);
264
- }
265
- function request(app_id, action, rp_context, action_description, bridge_url, allow_legacy_proofs, override_connect_base_url, environment) {
266
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
267
- const len0 = WASM_VECTOR_LEN;
268
- const ptr1 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
269
- const len1 = WASM_VECTOR_LEN;
270
- _assertClass(rp_context, RpContextWasm);
271
- var ptr2 = rp_context.__destroy_into_raw();
272
- var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
273
- var len3 = WASM_VECTOR_LEN;
274
- var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
275
- var len4 = WASM_VECTOR_LEN;
276
- var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
277
- var len5 = WASM_VECTOR_LEN;
278
- var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
279
- var len6 = WASM_VECTOR_LEN;
280
- const ret = wasm.idkitbuilder_new(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, allow_legacy_proofs, ptr5, len5, ptr6, len6);
281
- return IDKitBuilder.__wrap(ret);
282
- }
283
249
  function base64Decode(data) {
284
250
  try {
285
251
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -318,6 +284,22 @@ function proveSession(session_id, app_id, rp_context, action_description, bridge
318
284
  const ret = wasm.idkitbuilder_forProveSession(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
319
285
  return IDKitBuilder.__wrap(ret);
320
286
  }
287
+ function createSession(app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
288
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
289
+ const len0 = WASM_VECTOR_LEN;
290
+ _assertClass(rp_context, RpContextWasm);
291
+ var ptr1 = rp_context.__destroy_into_raw();
292
+ var ptr2 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
293
+ var len2 = WASM_VECTOR_LEN;
294
+ var ptr3 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
295
+ var len3 = WASM_VECTOR_LEN;
296
+ var ptr4 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
297
+ var len4 = WASM_VECTOR_LEN;
298
+ var ptr5 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
299
+ var len5 = WASM_VECTOR_LEN;
300
+ const ret = wasm.createSession(ptr0, len0, ptr1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
301
+ return IDKitBuilder.__wrap(ret);
302
+ }
321
303
  function passArray8ToWasm0(arg, malloc) {
322
304
  const ptr = malloc(arg.length * 1, 1) >>> 0;
323
305
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -342,27 +324,23 @@ function base64Encode(data) {
342
324
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
343
325
  }
344
326
  }
345
- function init_wasm() {
346
- wasm.init_wasm();
347
- }
348
- function signRequest(action, signing_key_hex, ttl_seconds) {
349
- try {
350
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
351
- const ptr0 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
352
- const len0 = WASM_VECTOR_LEN;
353
- const ptr1 = passStringToWasm0(signing_key_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
354
- const len1 = WASM_VECTOR_LEN;
355
- wasm.signRequest(retptr, ptr0, len0, ptr1, len1, !isLikeNone(ttl_seconds), isLikeNone(ttl_seconds) ? BigInt(0) : ttl_seconds);
356
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
357
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
358
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
359
- if (r2) {
360
- throw takeObject(r1);
361
- }
362
- return RpSignature.__wrap(r0);
363
- } finally {
364
- wasm.__wbindgen_add_to_stack_pointer(16);
365
- }
327
+ function request(app_id, action, rp_context, action_description, bridge_url, allow_legacy_proofs, override_connect_base_url, environment) {
328
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
329
+ const len0 = WASM_VECTOR_LEN;
330
+ const ptr1 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
331
+ const len1 = WASM_VECTOR_LEN;
332
+ _assertClass(rp_context, RpContextWasm);
333
+ var ptr2 = rp_context.__destroy_into_raw();
334
+ var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
335
+ var len3 = WASM_VECTOR_LEN;
336
+ var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
337
+ var len4 = WASM_VECTOR_LEN;
338
+ var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
339
+ var len5 = WASM_VECTOR_LEN;
340
+ var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
341
+ var len6 = WASM_VECTOR_LEN;
342
+ const ret = wasm.idkitbuilder_new(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, allow_legacy_proofs, ptr5, len5, ptr6, len6);
343
+ return IDKitBuilder.__wrap(ret);
366
344
  }
367
345
  function hashSignal(signal) {
368
346
  let deferred2_0;
@@ -389,14 +367,36 @@ function hashSignal(signal) {
389
367
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
390
368
  }
391
369
  }
392
- function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
393
- wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
370
+ function init_wasm() {
371
+ wasm.init_wasm();
394
372
  }
395
- function __wasm_bindgen_func_elem_605(arg0, arg1) {
396
- wasm.__wasm_bindgen_func_elem_605(arg0, arg1);
373
+ function signRequest(action, signing_key_hex, ttl_seconds) {
374
+ try {
375
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
376
+ const ptr0 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
377
+ const len0 = WASM_VECTOR_LEN;
378
+ const ptr1 = passStringToWasm0(signing_key_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
379
+ const len1 = WASM_VECTOR_LEN;
380
+ wasm.signRequest(retptr, ptr0, len0, ptr1, len1, !isLikeNone(ttl_seconds), isLikeNone(ttl_seconds) ? BigInt(0) : ttl_seconds);
381
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
382
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
383
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
384
+ if (r2) {
385
+ throw takeObject(r1);
386
+ }
387
+ return RpSignature.__wrap(r0);
388
+ } finally {
389
+ wasm.__wbindgen_add_to_stack_pointer(16);
390
+ }
397
391
  }
398
- function __wasm_bindgen_func_elem_1353(arg0, arg1, arg2, arg3) {
399
- wasm.__wasm_bindgen_func_elem_1353(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
392
+ function __wasm_bindgen_func_elem_619(arg0, arg1) {
393
+ wasm.__wasm_bindgen_func_elem_619(arg0, arg1);
394
+ }
395
+ function __wasm_bindgen_func_elem_982(arg0, arg1, arg2) {
396
+ wasm.__wasm_bindgen_func_elem_982(arg0, arg1, addHeapObject(arg2));
397
+ }
398
+ function __wasm_bindgen_func_elem_1367(arg0, arg1, arg2, arg3) {
399
+ wasm.__wasm_bindgen_func_elem_1367(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
400
400
  }
401
401
  var __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
402
402
  var __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -884,6 +884,35 @@ var IDKitBuilder = class _IDKitBuilder {
884
884
  wasm.__wbindgen_add_to_stack_pointer(16);
885
885
  }
886
886
  }
887
+ /**
888
+ * Builds a v1 (legacy) native payload from a preset (synchronous, no bridge connection).
889
+ *
890
+ * Used by the native transport when the World App only supports verify v1.
891
+ * Only legacy presets produce valid v1 payloads (constraints always have
892
+ * `Deprecated` verification level and will fail).
893
+ *
894
+ * # Errors
895
+ *
896
+ * Returns an error if the preset is invalid or v1 payload construction fails.
897
+ * @param {any} preset_json
898
+ * @returns {any}
899
+ */
900
+ nativePayloadV1FromPreset(preset_json) {
901
+ try {
902
+ const ptr = this.__destroy_into_raw();
903
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
904
+ wasm.idkitbuilder_nativePayloadV1FromPreset(retptr, ptr, addHeapObject(preset_json));
905
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
906
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
907
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
908
+ if (r2) {
909
+ throw takeObject(r1);
910
+ }
911
+ return takeObject(r0);
912
+ } finally {
913
+ wasm.__wbindgen_add_to_stack_pointer(16);
914
+ }
915
+ }
887
916
  /**
888
917
  * Creates a new builder for uniqueness requests
889
918
  * @param {string} app_id
@@ -1559,7 +1588,7 @@ function __wbg_get_imports() {
1559
1588
  const a = state0.a;
1560
1589
  state0.a = 0;
1561
1590
  try {
1562
- return __wasm_bindgen_func_elem_1353(a, state0.b, arg02, arg12);
1591
+ return __wasm_bindgen_func_elem_1367(a, state0.b, arg02, arg12);
1563
1592
  } finally {
1564
1593
  state0.a = a;
1565
1594
  }
@@ -1768,14 +1797,18 @@ function __wbg_get_imports() {
1768
1797
  const ret = getObject(arg0).versions;
1769
1798
  return addHeapObject(ret);
1770
1799
  };
1771
- imports.wbg.__wbindgen_cast_02740531cfdb05fe = function(arg0, arg1) {
1772
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_604, __wasm_bindgen_func_elem_605);
1800
+ imports.wbg.__wbindgen_cast_0c688d3d5dd51bcb = function(arg0, arg1) {
1801
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_981, __wasm_bindgen_func_elem_982);
1773
1802
  return addHeapObject(ret);
1774
1803
  };
1775
1804
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1776
1805
  const ret = getStringFromWasm0(arg0, arg1);
1777
1806
  return addHeapObject(ret);
1778
1807
  };
1808
+ imports.wbg.__wbindgen_cast_26df652e200d9104 = function(arg0, arg1) {
1809
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_618, __wasm_bindgen_func_elem_619);
1810
+ return addHeapObject(ret);
1811
+ };
1779
1812
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1780
1813
  const ret = BigInt.asUintN(64, arg0);
1781
1814
  return addHeapObject(ret);
@@ -1792,10 +1825,6 @@ function __wbg_get_imports() {
1792
1825
  const ret = arg0;
1793
1826
  return addHeapObject(ret);
1794
1827
  };
1795
- imports.wbg.__wbindgen_cast_f23235b6472d5cf3 = function(arg0, arg1) {
1796
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_967, __wasm_bindgen_func_elem_968);
1797
- return addHeapObject(ret);
1798
- };
1799
1828
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1800
1829
  const ret = getObject(arg0);
1801
1830
  return addHeapObject(ret);
@@ -1877,21 +1906,32 @@ var MINIAPP_VERIFY_ACTION = "miniapp-verify-action";
1877
1906
  function isInWorldApp() {
1878
1907
  return typeof window !== "undefined" && Boolean(window.WorldApp);
1879
1908
  }
1909
+ function getWorldAppVerifyVersion() {
1910
+ const cmds = window.WorldApp?.supported_commands;
1911
+ if (!Array.isArray(cmds)) return 1;
1912
+ const verify = cmds.find((c) => c.name === "verify");
1913
+ return verify?.supported_versions?.includes(2) ? 2 : 1;
1914
+ }
1880
1915
  var _requestCounter = 0;
1881
1916
  var _activeNativeRequest = null;
1882
- function createNativeRequest(wasmPayload, config, signalHashes = {}) {
1917
+ function createNativeRequest(wasmPayload, config, signalHashes = {}, version) {
1883
1918
  if (_activeNativeRequest?.isPending()) {
1884
1919
  console.warn(
1885
1920
  "IDKit native request already in flight. Reusing active request."
1886
1921
  );
1887
1922
  return _activeNativeRequest;
1888
1923
  }
1889
- const request2 = new NativeIDKitRequest(wasmPayload, config, signalHashes);
1924
+ const request2 = new NativeIDKitRequest(
1925
+ wasmPayload,
1926
+ config,
1927
+ signalHashes,
1928
+ version
1929
+ );
1890
1930
  _activeNativeRequest = request2;
1891
1931
  return request2;
1892
1932
  }
1893
1933
  var NativeIDKitRequest = class {
1894
- constructor(wasmPayload, config, signalHashes = {}) {
1934
+ constructor(wasmPayload, config, signalHashes = {}, version) {
1895
1935
  this.connectorURI = "";
1896
1936
  this.resolved = false;
1897
1937
  this.cancelled = false;
@@ -1945,7 +1985,7 @@ var NativeIDKitRequest = class {
1945
1985
  }
1946
1986
  const sendPayload = {
1947
1987
  command: "verify",
1948
- version: 2,
1988
+ version,
1949
1989
  payload: wasmPayload
1950
1990
  };
1951
1991
  const w = window;
@@ -2177,6 +2217,9 @@ function secureDocumentLegacy(opts = {}) {
2177
2217
  function documentLegacy(opts = {}) {
2178
2218
  return { type: "DocumentLegacy", signal: opts.signal };
2179
2219
  }
2220
+ function deviceLegacy(opts = {}) {
2221
+ return { type: "DeviceLegacy", signal: opts.signal };
2222
+ }
2180
2223
  function selfieCheckLegacy(opts = {}) {
2181
2224
  return { type: "SelfieCheckLegacy", signal: opts.signal };
2182
2225
  }
@@ -2241,15 +2284,23 @@ var IDKitBuilder2 = class {
2241
2284
  */
2242
2285
  async constraints(constraints) {
2243
2286
  await initIDKit();
2244
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2245
2287
  if (isInWorldApp()) {
2246
- const wasmResult = wasmBuilder.nativePayload(constraints);
2288
+ const verifyVersion = getWorldAppVerifyVersion();
2289
+ if (verifyVersion < 2) {
2290
+ throw new Error(
2291
+ "verify v2 is not supported by this World App version. Use a legacy preset (e.g. orbLegacy()) or update the World App."
2292
+ );
2293
+ }
2294
+ const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2295
+ const wasmResult = wasmBuilder2.nativePayload(constraints);
2247
2296
  return createNativeRequest(
2248
2297
  wasmResult.payload,
2249
2298
  this.config,
2250
- wasmResult.signal_hashes ?? {}
2299
+ wasmResult.signal_hashes ?? {},
2300
+ 2
2251
2301
  );
2252
2302
  }
2303
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2253
2304
  const wasmRequest = await wasmBuilder.constraints(
2254
2305
  constraints
2255
2306
  );
@@ -2261,7 +2312,7 @@ var IDKitBuilder2 = class {
2261
2312
  * Presets provide a simplified way to create requests with predefined
2262
2313
  * credential configurations.
2263
2314
  *
2264
- * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
2315
+ * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
2265
2316
  * @returns A new IDKitRequest instance
2266
2317
  *
2267
2318
  * @example
@@ -2272,15 +2323,37 @@ var IDKitBuilder2 = class {
2272
2323
  */
2273
2324
  async preset(preset) {
2274
2325
  await initIDKit();
2275
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2276
2326
  if (isInWorldApp()) {
2277
- const wasmResult = wasmBuilder.nativePayloadFromPreset(preset);
2278
- return createNativeRequest(
2279
- wasmResult.payload,
2280
- this.config,
2281
- wasmResult.signal_hashes ?? {}
2282
- );
2327
+ const verifyVersion = getWorldAppVerifyVersion();
2328
+ if (verifyVersion === 2) {
2329
+ const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2330
+ const wasmResult = wasmBuilder2.nativePayloadFromPreset(preset);
2331
+ return createNativeRequest(
2332
+ wasmResult.payload,
2333
+ this.config,
2334
+ wasmResult.signal_hashes ?? {},
2335
+ 2
2336
+ );
2337
+ }
2338
+ try {
2339
+ const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2340
+ const wasmResult = wasmBuilder2.nativePayloadV1FromPreset(preset);
2341
+ return createNativeRequest(
2342
+ wasmResult.payload,
2343
+ this.config,
2344
+ wasmResult.signal_hashes ?? {},
2345
+ 1
2346
+ );
2347
+ } catch (err) {
2348
+ if (err instanceof Error && String(err.message).includes("v1 payload")) {
2349
+ throw new Error(
2350
+ "verify v2 is not supported by this World App version. Use a legacy preset (e.g. orbLegacy()) or update the World App."
2351
+ );
2352
+ }
2353
+ throw err;
2354
+ }
2283
2355
  }
2356
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2284
2357
  const wasmRequest = await wasmBuilder.preset(
2285
2358
  preset
2286
2359
  );
@@ -2338,6 +2411,8 @@ var IDKit = {
2338
2411
  secureDocumentLegacy,
2339
2412
  /** Create a DocumentLegacy preset for World ID 3.0 legacy support */
2340
2413
  documentLegacy,
2414
+ /** Create a DeviceLegacy preset for World ID 3.0 legacy support */
2415
+ deviceLegacy,
2341
2416
  /** Create a SelfieCheckLegacy preset for face verification */
2342
2417
  selfieCheckLegacy
2343
2418
  };
@@ -2373,4 +2448,4 @@ function isValidHex(s) {
2373
2448
  return /^[0-9a-fA-F]+$/.test(s);
2374
2449
  }
2375
2450
 
2376
- export { IDKit, IDKitErrorCodes, documentLegacy, hashSignal2 as hashSignal, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
2451
+ export { IDKit, IDKitErrorCodes, deviceLegacy, documentLegacy, hashSignal2 as hashSignal, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/idkit-core",
3
- "version": "4.0.9",
3
+ "version": "4.0.10-dev.b24e0c1",
4
4
  "description": "Core IDKit SDK for World ID - Pure TypeScript, no dependencies",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",