@worldcoin/idkit-core 4.0.9-dev.648eacc → 4.0.9

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.
Binary file
package/dist/index.cjs CHANGED
@@ -392,14 +392,14 @@ function hashSignal(signal) {
392
392
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
393
393
  }
394
394
  }
395
- function __wasm_bindgen_func_elem_972(arg0, arg1, arg2) {
396
- wasm.__wasm_bindgen_func_elem_972(arg0, arg1, addHeapObject(arg2));
395
+ function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
396
+ wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
397
397
  }
398
- function __wasm_bindgen_func_elem_609(arg0, arg1) {
399
- wasm.__wasm_bindgen_func_elem_609(arg0, arg1);
398
+ function __wasm_bindgen_func_elem_605(arg0, arg1) {
399
+ wasm.__wasm_bindgen_func_elem_605(arg0, arg1);
400
400
  }
401
- function __wasm_bindgen_func_elem_1357(arg0, arg1, arg2, arg3) {
402
- wasm.__wasm_bindgen_func_elem_1357(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
401
+ function __wasm_bindgen_func_elem_1353(arg0, arg1, arg2, arg3) {
402
+ wasm.__wasm_bindgen_func_elem_1353(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,35 +887,6 @@ 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
- }
919
890
  /**
920
891
  * Creates a new builder for uniqueness requests
921
892
  * @param {string} app_id
@@ -1591,7 +1562,7 @@ function __wbg_get_imports() {
1591
1562
  const a = state0.a;
1592
1563
  state0.a = 0;
1593
1564
  try {
1594
- return __wasm_bindgen_func_elem_1357(a, state0.b, arg02, arg12);
1565
+ return __wasm_bindgen_func_elem_1353(a, state0.b, arg02, arg12);
1595
1566
  } finally {
1596
1567
  state0.a = a;
1597
1568
  }
@@ -1801,7 +1772,7 @@ function __wbg_get_imports() {
1801
1772
  return addHeapObject(ret);
1802
1773
  };
1803
1774
  imports.wbg.__wbindgen_cast_02740531cfdb05fe = function(arg0, arg1) {
1804
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_608, __wasm_bindgen_func_elem_609);
1775
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_604, __wasm_bindgen_func_elem_605);
1805
1776
  return addHeapObject(ret);
1806
1777
  };
1807
1778
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -1825,7 +1796,7 @@ function __wbg_get_imports() {
1825
1796
  return addHeapObject(ret);
1826
1797
  };
1827
1798
  imports.wbg.__wbindgen_cast_f23235b6472d5cf3 = function(arg0, arg1) {
1828
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_971, __wasm_bindgen_func_elem_972);
1799
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_967, __wasm_bindgen_func_elem_968);
1829
1800
  return addHeapObject(ret);
1830
1801
  };
1831
1802
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
@@ -1909,32 +1880,21 @@ var MINIAPP_VERIFY_ACTION = "miniapp-verify-action";
1909
1880
  function isInWorldApp() {
1910
1881
  return typeof window !== "undefined" && Boolean(window.WorldApp);
1911
1882
  }
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
- }
1918
1883
  var _requestCounter = 0;
1919
1884
  var _activeNativeRequest = null;
1920
- function createNativeRequest(wasmPayload, config, signalHashes = {}, version) {
1885
+ function createNativeRequest(wasmPayload, config, signalHashes = {}) {
1921
1886
  if (_activeNativeRequest?.isPending()) {
1922
1887
  console.warn(
1923
1888
  "IDKit native request already in flight. Reusing active request."
1924
1889
  );
1925
1890
  return _activeNativeRequest;
1926
1891
  }
1927
- const request2 = new NativeIDKitRequest(
1928
- wasmPayload,
1929
- config,
1930
- signalHashes,
1931
- version
1932
- );
1892
+ const request2 = new NativeIDKitRequest(wasmPayload, config, signalHashes);
1933
1893
  _activeNativeRequest = request2;
1934
1894
  return request2;
1935
1895
  }
1936
1896
  var NativeIDKitRequest = class {
1937
- constructor(wasmPayload, config, signalHashes = {}, version) {
1897
+ constructor(wasmPayload, config, signalHashes = {}) {
1938
1898
  this.connectorURI = "";
1939
1899
  this.resolved = false;
1940
1900
  this.cancelled = false;
@@ -1988,7 +1948,7 @@ var NativeIDKitRequest = class {
1988
1948
  }
1989
1949
  const sendPayload = {
1990
1950
  command: "verify",
1991
- version,
1951
+ version: 2,
1992
1952
  payload: wasmPayload
1993
1953
  };
1994
1954
  const w = window;
@@ -2284,23 +2244,15 @@ var IDKitBuilder2 = class {
2284
2244
  */
2285
2245
  async constraints(constraints) {
2286
2246
  await initIDKit();
2247
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2287
2248
  if (isInWorldApp()) {
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);
2249
+ const wasmResult = wasmBuilder.nativePayload(constraints);
2296
2250
  return createNativeRequest(
2297
2251
  wasmResult.payload,
2298
2252
  this.config,
2299
- wasmResult.signal_hashes ?? {},
2300
- 2
2253
+ wasmResult.signal_hashes ?? {}
2301
2254
  );
2302
2255
  }
2303
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2304
2256
  const wasmRequest = await wasmBuilder.constraints(
2305
2257
  constraints
2306
2258
  );
@@ -2323,37 +2275,15 @@ var IDKitBuilder2 = class {
2323
2275
  */
2324
2276
  async preset(preset) {
2325
2277
  await initIDKit();
2278
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2326
2279
  if (isInWorldApp()) {
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
- }
2280
+ const wasmResult = wasmBuilder.nativePayloadFromPreset(preset);
2281
+ return createNativeRequest(
2282
+ wasmResult.payload,
2283
+ this.config,
2284
+ wasmResult.signal_hashes ?? {}
2285
+ );
2355
2286
  }
2356
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2357
2287
  const wasmRequest = await wasmBuilder.preset(
2358
2288
  preset
2359
2289
  );
package/dist/index.js CHANGED
@@ -389,14 +389,14 @@ function hashSignal(signal) {
389
389
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
390
390
  }
391
391
  }
392
- function __wasm_bindgen_func_elem_972(arg0, arg1, arg2) {
393
- wasm.__wasm_bindgen_func_elem_972(arg0, arg1, addHeapObject(arg2));
392
+ function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
393
+ wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
394
394
  }
395
- function __wasm_bindgen_func_elem_609(arg0, arg1) {
396
- wasm.__wasm_bindgen_func_elem_609(arg0, arg1);
395
+ function __wasm_bindgen_func_elem_605(arg0, arg1) {
396
+ wasm.__wasm_bindgen_func_elem_605(arg0, arg1);
397
397
  }
398
- function __wasm_bindgen_func_elem_1357(arg0, arg1, arg2, arg3) {
399
- wasm.__wasm_bindgen_func_elem_1357(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
398
+ function __wasm_bindgen_func_elem_1353(arg0, arg1, arg2, arg3) {
399
+ wasm.__wasm_bindgen_func_elem_1353(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,35 +884,6 @@ 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
- }
916
887
  /**
917
888
  * Creates a new builder for uniqueness requests
918
889
  * @param {string} app_id
@@ -1588,7 +1559,7 @@ function __wbg_get_imports() {
1588
1559
  const a = state0.a;
1589
1560
  state0.a = 0;
1590
1561
  try {
1591
- return __wasm_bindgen_func_elem_1357(a, state0.b, arg02, arg12);
1562
+ return __wasm_bindgen_func_elem_1353(a, state0.b, arg02, arg12);
1592
1563
  } finally {
1593
1564
  state0.a = a;
1594
1565
  }
@@ -1798,7 +1769,7 @@ function __wbg_get_imports() {
1798
1769
  return addHeapObject(ret);
1799
1770
  };
1800
1771
  imports.wbg.__wbindgen_cast_02740531cfdb05fe = function(arg0, arg1) {
1801
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_608, __wasm_bindgen_func_elem_609);
1772
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_604, __wasm_bindgen_func_elem_605);
1802
1773
  return addHeapObject(ret);
1803
1774
  };
1804
1775
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -1822,7 +1793,7 @@ function __wbg_get_imports() {
1822
1793
  return addHeapObject(ret);
1823
1794
  };
1824
1795
  imports.wbg.__wbindgen_cast_f23235b6472d5cf3 = function(arg0, arg1) {
1825
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_971, __wasm_bindgen_func_elem_972);
1796
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_967, __wasm_bindgen_func_elem_968);
1826
1797
  return addHeapObject(ret);
1827
1798
  };
1828
1799
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
@@ -1906,32 +1877,21 @@ var MINIAPP_VERIFY_ACTION = "miniapp-verify-action";
1906
1877
  function isInWorldApp() {
1907
1878
  return typeof window !== "undefined" && Boolean(window.WorldApp);
1908
1879
  }
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
- }
1915
1880
  var _requestCounter = 0;
1916
1881
  var _activeNativeRequest = null;
1917
- function createNativeRequest(wasmPayload, config, signalHashes = {}, version) {
1882
+ function createNativeRequest(wasmPayload, config, signalHashes = {}) {
1918
1883
  if (_activeNativeRequest?.isPending()) {
1919
1884
  console.warn(
1920
1885
  "IDKit native request already in flight. Reusing active request."
1921
1886
  );
1922
1887
  return _activeNativeRequest;
1923
1888
  }
1924
- const request2 = new NativeIDKitRequest(
1925
- wasmPayload,
1926
- config,
1927
- signalHashes,
1928
- version
1929
- );
1889
+ const request2 = new NativeIDKitRequest(wasmPayload, config, signalHashes);
1930
1890
  _activeNativeRequest = request2;
1931
1891
  return request2;
1932
1892
  }
1933
1893
  var NativeIDKitRequest = class {
1934
- constructor(wasmPayload, config, signalHashes = {}, version) {
1894
+ constructor(wasmPayload, config, signalHashes = {}) {
1935
1895
  this.connectorURI = "";
1936
1896
  this.resolved = false;
1937
1897
  this.cancelled = false;
@@ -1985,7 +1945,7 @@ var NativeIDKitRequest = class {
1985
1945
  }
1986
1946
  const sendPayload = {
1987
1947
  command: "verify",
1988
- version,
1948
+ version: 2,
1989
1949
  payload: wasmPayload
1990
1950
  };
1991
1951
  const w = window;
@@ -2281,23 +2241,15 @@ var IDKitBuilder2 = class {
2281
2241
  */
2282
2242
  async constraints(constraints) {
2283
2243
  await initIDKit();
2244
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2284
2245
  if (isInWorldApp()) {
2285
- const verifyVersion = getWorldAppVerifyVersion();
2286
- if (verifyVersion < 2) {
2287
- throw new Error(
2288
- "verify v2 is not supported by this World App version. Use a legacy preset (e.g. orbLegacy()) or update the World App."
2289
- );
2290
- }
2291
- const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2292
- const wasmResult = wasmBuilder2.nativePayload(constraints);
2246
+ const wasmResult = wasmBuilder.nativePayload(constraints);
2293
2247
  return createNativeRequest(
2294
2248
  wasmResult.payload,
2295
2249
  this.config,
2296
- wasmResult.signal_hashes ?? {},
2297
- 2
2250
+ wasmResult.signal_hashes ?? {}
2298
2251
  );
2299
2252
  }
2300
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2301
2253
  const wasmRequest = await wasmBuilder.constraints(
2302
2254
  constraints
2303
2255
  );
@@ -2320,37 +2272,15 @@ var IDKitBuilder2 = class {
2320
2272
  */
2321
2273
  async preset(preset) {
2322
2274
  await initIDKit();
2275
+ const wasmBuilder = createWasmBuilderFromConfig(this.config);
2323
2276
  if (isInWorldApp()) {
2324
- const verifyVersion = getWorldAppVerifyVersion();
2325
- if (verifyVersion === 2) {
2326
- const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2327
- const wasmResult = wasmBuilder2.nativePayloadFromPreset(preset);
2328
- return createNativeRequest(
2329
- wasmResult.payload,
2330
- this.config,
2331
- wasmResult.signal_hashes ?? {},
2332
- 2
2333
- );
2334
- }
2335
- try {
2336
- const wasmBuilder2 = createWasmBuilderFromConfig(this.config);
2337
- const wasmResult = wasmBuilder2.nativePayloadV1FromPreset(preset);
2338
- return createNativeRequest(
2339
- wasmResult.payload,
2340
- this.config,
2341
- wasmResult.signal_hashes ?? {},
2342
- 1
2343
- );
2344
- } catch (err) {
2345
- if (err instanceof Error && String(err.message).includes("v1 payload")) {
2346
- throw new Error(
2347
- "verify v2 is not supported by this World App version. Use a legacy preset (e.g. orbLegacy()) or update the World App."
2348
- );
2349
- }
2350
- throw err;
2351
- }
2277
+ const wasmResult = wasmBuilder.nativePayloadFromPreset(preset);
2278
+ return createNativeRequest(
2279
+ wasmResult.payload,
2280
+ this.config,
2281
+ wasmResult.signal_hashes ?? {}
2282
+ );
2352
2283
  }
2353
- const wasmBuilder = createWasmBuilderFromConfig(this.config);
2354
2284
  const wasmRequest = await wasmBuilder.preset(
2355
2285
  preset
2356
2286
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/idkit-core",
3
- "version": "4.0.9-dev.648eacc",
3
+ "version": "4.0.9",
4
4
  "description": "Core IDKit SDK for World ID - Pure TypeScript, no dependencies",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",