@worldcoin/idkit-core 4.0.2-dev.6541a3e → 4.0.2-dev.a1a85c4
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/idkit_wasm_bg.wasm +0 -0
- package/dist/index.cjs +51 -31
- package/dist/index.js +51 -31
- package/package.json +1 -1
package/dist/idkit_wasm_bg.wasm
CHANGED
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -394,14 +394,14 @@ function hashSignal(signal) {
|
|
|
394
394
|
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
wasm.
|
|
397
|
+
function __wasm_bindgen_func_elem_962(arg0, arg1, arg2) {
|
|
398
|
+
wasm.__wasm_bindgen_func_elem_962(arg0, arg1, addHeapObject(arg2));
|
|
399
399
|
}
|
|
400
|
-
function
|
|
401
|
-
wasm.
|
|
400
|
+
function __wasm_bindgen_func_elem_599(arg0, arg1) {
|
|
401
|
+
wasm.__wasm_bindgen_func_elem_599(arg0, arg1);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
wasm.
|
|
403
|
+
function __wasm_bindgen_func_elem_1347(arg0, arg1, arg2, arg3) {
|
|
404
|
+
wasm.__wasm_bindgen_func_elem_1347(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
405
405
|
}
|
|
406
406
|
var __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
407
407
|
var __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -1564,7 +1564,7 @@ function __wbg_get_imports() {
|
|
|
1564
1564
|
const a = state0.a;
|
|
1565
1565
|
state0.a = 0;
|
|
1566
1566
|
try {
|
|
1567
|
-
return
|
|
1567
|
+
return __wasm_bindgen_func_elem_1347(a, state0.b, arg02, arg12);
|
|
1568
1568
|
} finally {
|
|
1569
1569
|
state0.a = a;
|
|
1570
1570
|
}
|
|
@@ -1778,7 +1778,7 @@ function __wbg_get_imports() {
|
|
|
1778
1778
|
return addHeapObject(ret);
|
|
1779
1779
|
};
|
|
1780
1780
|
imports.wbg.__wbindgen_cast_2d12912bac8cf5ca = function(arg0, arg1) {
|
|
1781
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1781
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_961, __wasm_bindgen_func_elem_962);
|
|
1782
1782
|
return addHeapObject(ret);
|
|
1783
1783
|
};
|
|
1784
1784
|
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
@@ -1790,7 +1790,7 @@ function __wbg_get_imports() {
|
|
|
1790
1790
|
return addHeapObject(ret);
|
|
1791
1791
|
};
|
|
1792
1792
|
imports.wbg.__wbindgen_cast_b8b1061c2d0ea705 = function(arg0, arg1) {
|
|
1793
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1793
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_598, __wasm_bindgen_func_elem_599);
|
|
1794
1794
|
return addHeapObject(ret);
|
|
1795
1795
|
};
|
|
1796
1796
|
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
@@ -1884,19 +1884,19 @@ function isInWorldApp() {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
var _requestCounter = 0;
|
|
1886
1886
|
var _activeNativeRequest = null;
|
|
1887
|
-
function createNativeRequest(wasmPayload, config) {
|
|
1887
|
+
function createNativeRequest(wasmPayload, config, signalHashes = {}) {
|
|
1888
1888
|
if (_activeNativeRequest?.isPending()) {
|
|
1889
1889
|
console.warn(
|
|
1890
1890
|
"IDKit native request already in flight. Reusing active request."
|
|
1891
1891
|
);
|
|
1892
1892
|
return _activeNativeRequest;
|
|
1893
1893
|
}
|
|
1894
|
-
const request2 = new NativeIDKitRequest(wasmPayload, config);
|
|
1894
|
+
const request2 = new NativeIDKitRequest(wasmPayload, config, signalHashes);
|
|
1895
1895
|
_activeNativeRequest = request2;
|
|
1896
1896
|
return request2;
|
|
1897
1897
|
}
|
|
1898
1898
|
var NativeIDKitRequest = class {
|
|
1899
|
-
constructor(wasmPayload, config) {
|
|
1899
|
+
constructor(wasmPayload, config, signalHashes = {}) {
|
|
1900
1900
|
this.connectorURI = "";
|
|
1901
1901
|
this.resolved = false;
|
|
1902
1902
|
this.cancelled = false;
|
|
@@ -1920,7 +1920,11 @@ var NativeIDKitRequest = class {
|
|
|
1920
1920
|
return;
|
|
1921
1921
|
}
|
|
1922
1922
|
this.resolved = true;
|
|
1923
|
-
const result = nativeResultToIDKitResult(
|
|
1923
|
+
const result = nativeResultToIDKitResult(
|
|
1924
|
+
responsePayload,
|
|
1925
|
+
config,
|
|
1926
|
+
signalHashes
|
|
1927
|
+
);
|
|
1924
1928
|
this.resolvedResult = result;
|
|
1925
1929
|
this.cleanup();
|
|
1926
1930
|
resolve(result);
|
|
@@ -2057,26 +2061,32 @@ var NativeVerifyError = class extends Error {
|
|
|
2057
2061
|
this.code = code;
|
|
2058
2062
|
}
|
|
2059
2063
|
};
|
|
2060
|
-
function nativeResultToIDKitResult(payload, config) {
|
|
2064
|
+
function nativeResultToIDKitResult(payload, config, signalHashes) {
|
|
2061
2065
|
const rpNonce = config.rp_context?.nonce ?? "";
|
|
2062
|
-
if ("responses" in payload
|
|
2066
|
+
if ("responses" in payload) {
|
|
2067
|
+
const v4 = payload;
|
|
2063
2068
|
return {
|
|
2064
|
-
protocol_version:
|
|
2065
|
-
nonce:
|
|
2066
|
-
action:
|
|
2067
|
-
action_description:
|
|
2068
|
-
session_id:
|
|
2069
|
-
responses:
|
|
2070
|
-
|
|
2069
|
+
protocol_version: v4.protocol_version ?? "4.0",
|
|
2070
|
+
nonce: v4.nonce ?? rpNonce,
|
|
2071
|
+
action: v4.action ?? config.action ?? "",
|
|
2072
|
+
action_description: v4.action_description,
|
|
2073
|
+
session_id: v4.session_id,
|
|
2074
|
+
responses: v4.responses.map((item) => ({
|
|
2075
|
+
...item,
|
|
2076
|
+
signal_hash: signalHashes[item.identifier]
|
|
2077
|
+
})),
|
|
2078
|
+
environment: v4.environment ?? config.environment ?? "production"
|
|
2071
2079
|
};
|
|
2072
2080
|
}
|
|
2073
2081
|
if ("verifications" in payload) {
|
|
2082
|
+
const multi = payload;
|
|
2074
2083
|
return {
|
|
2075
2084
|
protocol_version: "4.0",
|
|
2076
2085
|
nonce: rpNonce,
|
|
2077
2086
|
action: config.action ?? "",
|
|
2078
|
-
responses:
|
|
2087
|
+
responses: multi.verifications.map((v) => ({
|
|
2079
2088
|
identifier: v.verification_level,
|
|
2089
|
+
signal_hash: v.signal_hash ?? signalHashes[v.verification_level],
|
|
2080
2090
|
proof: [v.proof],
|
|
2081
2091
|
nullifier: v.nullifier_hash,
|
|
2082
2092
|
merkle_root: v.merkle_root,
|
|
@@ -2086,16 +2096,18 @@ function nativeResultToIDKitResult(payload, config) {
|
|
|
2086
2096
|
environment: "production"
|
|
2087
2097
|
};
|
|
2088
2098
|
}
|
|
2099
|
+
const single = payload;
|
|
2089
2100
|
return {
|
|
2090
2101
|
protocol_version: "3.0",
|
|
2091
2102
|
nonce: rpNonce,
|
|
2092
2103
|
action: config.action ?? "",
|
|
2093
2104
|
responses: [
|
|
2094
2105
|
{
|
|
2095
|
-
identifier:
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2106
|
+
identifier: single.verification_level,
|
|
2107
|
+
signal_hash: single.signal_hash ?? signalHashes[single.verification_level],
|
|
2108
|
+
proof: single.proof,
|
|
2109
|
+
merkle_root: single.merkle_root,
|
|
2110
|
+
nullifier: single.nullifier_hash
|
|
2099
2111
|
}
|
|
2100
2112
|
],
|
|
2101
2113
|
environment: "production"
|
|
@@ -2215,8 +2227,12 @@ var IDKitBuilder2 = class {
|
|
|
2215
2227
|
await initIDKit();
|
|
2216
2228
|
const wasmBuilder = createWasmBuilderFromConfig(this.config);
|
|
2217
2229
|
if (isInWorldApp()) {
|
|
2218
|
-
const
|
|
2219
|
-
return createNativeRequest(
|
|
2230
|
+
const wasmResult = wasmBuilder.nativePayload(constraints);
|
|
2231
|
+
return createNativeRequest(
|
|
2232
|
+
wasmResult.payload,
|
|
2233
|
+
this.config,
|
|
2234
|
+
wasmResult.signal_hashes ?? {}
|
|
2235
|
+
);
|
|
2220
2236
|
}
|
|
2221
2237
|
const wasmRequest = await wasmBuilder.constraints(
|
|
2222
2238
|
constraints
|
|
@@ -2242,8 +2258,12 @@ var IDKitBuilder2 = class {
|
|
|
2242
2258
|
await initIDKit();
|
|
2243
2259
|
const wasmBuilder = createWasmBuilderFromConfig(this.config);
|
|
2244
2260
|
if (isInWorldApp()) {
|
|
2245
|
-
const
|
|
2246
|
-
return createNativeRequest(
|
|
2261
|
+
const wasmResult = wasmBuilder.nativePayloadFromPreset(preset);
|
|
2262
|
+
return createNativeRequest(
|
|
2263
|
+
wasmResult.payload,
|
|
2264
|
+
this.config,
|
|
2265
|
+
wasmResult.signal_hashes ?? {}
|
|
2266
|
+
);
|
|
2247
2267
|
}
|
|
2248
2268
|
const wasmRequest = await wasmBuilder.preset(
|
|
2249
2269
|
preset
|
package/dist/index.js
CHANGED
|
@@ -391,14 +391,14 @@ function hashSignal(signal) {
|
|
|
391
391
|
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
wasm.
|
|
394
|
+
function __wasm_bindgen_func_elem_962(arg0, arg1, arg2) {
|
|
395
|
+
wasm.__wasm_bindgen_func_elem_962(arg0, arg1, addHeapObject(arg2));
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
wasm.
|
|
397
|
+
function __wasm_bindgen_func_elem_599(arg0, arg1) {
|
|
398
|
+
wasm.__wasm_bindgen_func_elem_599(arg0, arg1);
|
|
399
399
|
}
|
|
400
|
-
function
|
|
401
|
-
wasm.
|
|
400
|
+
function __wasm_bindgen_func_elem_1347(arg0, arg1, arg2, arg3) {
|
|
401
|
+
wasm.__wasm_bindgen_func_elem_1347(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
402
402
|
}
|
|
403
403
|
var __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
404
404
|
var __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -1561,7 +1561,7 @@ function __wbg_get_imports() {
|
|
|
1561
1561
|
const a = state0.a;
|
|
1562
1562
|
state0.a = 0;
|
|
1563
1563
|
try {
|
|
1564
|
-
return
|
|
1564
|
+
return __wasm_bindgen_func_elem_1347(a, state0.b, arg02, arg12);
|
|
1565
1565
|
} finally {
|
|
1566
1566
|
state0.a = a;
|
|
1567
1567
|
}
|
|
@@ -1775,7 +1775,7 @@ function __wbg_get_imports() {
|
|
|
1775
1775
|
return addHeapObject(ret);
|
|
1776
1776
|
};
|
|
1777
1777
|
imports.wbg.__wbindgen_cast_2d12912bac8cf5ca = function(arg0, arg1) {
|
|
1778
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1778
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_961, __wasm_bindgen_func_elem_962);
|
|
1779
1779
|
return addHeapObject(ret);
|
|
1780
1780
|
};
|
|
1781
1781
|
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
@@ -1787,7 +1787,7 @@ function __wbg_get_imports() {
|
|
|
1787
1787
|
return addHeapObject(ret);
|
|
1788
1788
|
};
|
|
1789
1789
|
imports.wbg.__wbindgen_cast_b8b1061c2d0ea705 = function(arg0, arg1) {
|
|
1790
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1790
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_598, __wasm_bindgen_func_elem_599);
|
|
1791
1791
|
return addHeapObject(ret);
|
|
1792
1792
|
};
|
|
1793
1793
|
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
@@ -1881,19 +1881,19 @@ function isInWorldApp() {
|
|
|
1881
1881
|
}
|
|
1882
1882
|
var _requestCounter = 0;
|
|
1883
1883
|
var _activeNativeRequest = null;
|
|
1884
|
-
function createNativeRequest(wasmPayload, config) {
|
|
1884
|
+
function createNativeRequest(wasmPayload, config, signalHashes = {}) {
|
|
1885
1885
|
if (_activeNativeRequest?.isPending()) {
|
|
1886
1886
|
console.warn(
|
|
1887
1887
|
"IDKit native request already in flight. Reusing active request."
|
|
1888
1888
|
);
|
|
1889
1889
|
return _activeNativeRequest;
|
|
1890
1890
|
}
|
|
1891
|
-
const request2 = new NativeIDKitRequest(wasmPayload, config);
|
|
1891
|
+
const request2 = new NativeIDKitRequest(wasmPayload, config, signalHashes);
|
|
1892
1892
|
_activeNativeRequest = request2;
|
|
1893
1893
|
return request2;
|
|
1894
1894
|
}
|
|
1895
1895
|
var NativeIDKitRequest = class {
|
|
1896
|
-
constructor(wasmPayload, config) {
|
|
1896
|
+
constructor(wasmPayload, config, signalHashes = {}) {
|
|
1897
1897
|
this.connectorURI = "";
|
|
1898
1898
|
this.resolved = false;
|
|
1899
1899
|
this.cancelled = false;
|
|
@@ -1917,7 +1917,11 @@ var NativeIDKitRequest = class {
|
|
|
1917
1917
|
return;
|
|
1918
1918
|
}
|
|
1919
1919
|
this.resolved = true;
|
|
1920
|
-
const result = nativeResultToIDKitResult(
|
|
1920
|
+
const result = nativeResultToIDKitResult(
|
|
1921
|
+
responsePayload,
|
|
1922
|
+
config,
|
|
1923
|
+
signalHashes
|
|
1924
|
+
);
|
|
1921
1925
|
this.resolvedResult = result;
|
|
1922
1926
|
this.cleanup();
|
|
1923
1927
|
resolve(result);
|
|
@@ -2054,26 +2058,32 @@ var NativeVerifyError = class extends Error {
|
|
|
2054
2058
|
this.code = code;
|
|
2055
2059
|
}
|
|
2056
2060
|
};
|
|
2057
|
-
function nativeResultToIDKitResult(payload, config) {
|
|
2061
|
+
function nativeResultToIDKitResult(payload, config, signalHashes) {
|
|
2058
2062
|
const rpNonce = config.rp_context?.nonce ?? "";
|
|
2059
|
-
if ("responses" in payload
|
|
2063
|
+
if ("responses" in payload) {
|
|
2064
|
+
const v4 = payload;
|
|
2060
2065
|
return {
|
|
2061
|
-
protocol_version:
|
|
2062
|
-
nonce:
|
|
2063
|
-
action:
|
|
2064
|
-
action_description:
|
|
2065
|
-
session_id:
|
|
2066
|
-
responses:
|
|
2067
|
-
|
|
2066
|
+
protocol_version: v4.protocol_version ?? "4.0",
|
|
2067
|
+
nonce: v4.nonce ?? rpNonce,
|
|
2068
|
+
action: v4.action ?? config.action ?? "",
|
|
2069
|
+
action_description: v4.action_description,
|
|
2070
|
+
session_id: v4.session_id,
|
|
2071
|
+
responses: v4.responses.map((item) => ({
|
|
2072
|
+
...item,
|
|
2073
|
+
signal_hash: signalHashes[item.identifier]
|
|
2074
|
+
})),
|
|
2075
|
+
environment: v4.environment ?? config.environment ?? "production"
|
|
2068
2076
|
};
|
|
2069
2077
|
}
|
|
2070
2078
|
if ("verifications" in payload) {
|
|
2079
|
+
const multi = payload;
|
|
2071
2080
|
return {
|
|
2072
2081
|
protocol_version: "4.0",
|
|
2073
2082
|
nonce: rpNonce,
|
|
2074
2083
|
action: config.action ?? "",
|
|
2075
|
-
responses:
|
|
2084
|
+
responses: multi.verifications.map((v) => ({
|
|
2076
2085
|
identifier: v.verification_level,
|
|
2086
|
+
signal_hash: v.signal_hash ?? signalHashes[v.verification_level],
|
|
2077
2087
|
proof: [v.proof],
|
|
2078
2088
|
nullifier: v.nullifier_hash,
|
|
2079
2089
|
merkle_root: v.merkle_root,
|
|
@@ -2083,16 +2093,18 @@ function nativeResultToIDKitResult(payload, config) {
|
|
|
2083
2093
|
environment: "production"
|
|
2084
2094
|
};
|
|
2085
2095
|
}
|
|
2096
|
+
const single = payload;
|
|
2086
2097
|
return {
|
|
2087
2098
|
protocol_version: "3.0",
|
|
2088
2099
|
nonce: rpNonce,
|
|
2089
2100
|
action: config.action ?? "",
|
|
2090
2101
|
responses: [
|
|
2091
2102
|
{
|
|
2092
|
-
identifier:
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2103
|
+
identifier: single.verification_level,
|
|
2104
|
+
signal_hash: single.signal_hash ?? signalHashes[single.verification_level],
|
|
2105
|
+
proof: single.proof,
|
|
2106
|
+
merkle_root: single.merkle_root,
|
|
2107
|
+
nullifier: single.nullifier_hash
|
|
2096
2108
|
}
|
|
2097
2109
|
],
|
|
2098
2110
|
environment: "production"
|
|
@@ -2212,8 +2224,12 @@ var IDKitBuilder2 = class {
|
|
|
2212
2224
|
await initIDKit();
|
|
2213
2225
|
const wasmBuilder = createWasmBuilderFromConfig(this.config);
|
|
2214
2226
|
if (isInWorldApp()) {
|
|
2215
|
-
const
|
|
2216
|
-
return createNativeRequest(
|
|
2227
|
+
const wasmResult = wasmBuilder.nativePayload(constraints);
|
|
2228
|
+
return createNativeRequest(
|
|
2229
|
+
wasmResult.payload,
|
|
2230
|
+
this.config,
|
|
2231
|
+
wasmResult.signal_hashes ?? {}
|
|
2232
|
+
);
|
|
2217
2233
|
}
|
|
2218
2234
|
const wasmRequest = await wasmBuilder.constraints(
|
|
2219
2235
|
constraints
|
|
@@ -2239,8 +2255,12 @@ var IDKitBuilder2 = class {
|
|
|
2239
2255
|
await initIDKit();
|
|
2240
2256
|
const wasmBuilder = createWasmBuilderFromConfig(this.config);
|
|
2241
2257
|
if (isInWorldApp()) {
|
|
2242
|
-
const
|
|
2243
|
-
return createNativeRequest(
|
|
2258
|
+
const wasmResult = wasmBuilder.nativePayloadFromPreset(preset);
|
|
2259
|
+
return createNativeRequest(
|
|
2260
|
+
wasmResult.payload,
|
|
2261
|
+
this.config,
|
|
2262
|
+
wasmResult.signal_hashes ?? {}
|
|
2263
|
+
);
|
|
2244
2264
|
}
|
|
2245
2265
|
const wasmRequest = await wasmBuilder.preset(
|
|
2246
2266
|
preset
|