@worldcoin/idkit-core 4.0.6 → 4.0.7

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,12 +392,12 @@ function hashSignal(signal) {
392
392
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
393
393
  }
394
394
  }
395
- function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
396
- wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
397
- }
398
395
  function __wasm_bindgen_func_elem_605(arg0, arg1) {
399
396
  wasm.__wasm_bindgen_func_elem_605(arg0, arg1);
400
397
  }
398
+ function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
399
+ wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
400
+ }
401
401
  function __wasm_bindgen_func_elem_1353(arg0, arg1, arg2, arg3) {
402
402
  wasm.__wasm_bindgen_func_elem_1353(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
403
403
  }
@@ -2060,55 +2060,73 @@ var NativeVerifyError = class extends Error {
2060
2060
  }
2061
2061
  };
2062
2062
  function nativeResultToIDKitResult(payload, config, signalHashes) {
2063
+ const p = payload;
2063
2064
  const rpNonce = config.rp_context?.nonce ?? "";
2064
- if ("responses" in payload) {
2065
- const v4 = payload;
2065
+ if ("responses" in p && Array.isArray(p.responses)) {
2066
+ const items = p.responses;
2067
+ if (p.session_id) {
2068
+ return {
2069
+ protocol_version: "4.0",
2070
+ nonce: p.nonce ?? rpNonce,
2071
+ action_description: p.action_description,
2072
+ session_id: p.session_id,
2073
+ responses: items.map((item) => ({
2074
+ identifier: item.identifier,
2075
+ signal_hash: signalHashes[item.identifier],
2076
+ proof: item.proof,
2077
+ session_nullifier: item.session_nullifier,
2078
+ issuer_schema_id: item.issuer_schema_id,
2079
+ expires_at_min: item.expires_at_min
2080
+ })),
2081
+ environment: config.environment ?? "production"
2082
+ };
2083
+ }
2066
2084
  return {
2067
- protocol_version: v4.protocol_version ?? "4.0",
2068
- nonce: v4.nonce ?? rpNonce,
2069
- action: v4.action ?? config.action ?? "",
2070
- action_description: v4.action_description,
2071
- session_id: v4.session_id,
2072
- responses: v4.responses.map((item) => ({
2073
- ...item,
2074
- signal_hash: signalHashes[item.identifier]
2085
+ protocol_version: "4.0",
2086
+ nonce: p.nonce ?? rpNonce,
2087
+ action: p.action ?? config.action ?? "",
2088
+ action_description: p.action_description,
2089
+ responses: items.map((item) => ({
2090
+ identifier: item.identifier,
2091
+ signal_hash: signalHashes[item.identifier],
2092
+ proof: item.proof,
2093
+ nullifier: item.nullifier,
2094
+ issuer_schema_id: item.issuer_schema_id,
2095
+ expires_at_min: item.expires_at_min
2075
2096
  })),
2076
- environment: v4.environment ?? config.environment ?? "production"
2097
+ environment: config.environment ?? "production"
2077
2098
  };
2078
2099
  }
2079
- if ("verifications" in payload) {
2080
- const multi = payload;
2100
+ if ("verifications" in p && Array.isArray(p.verifications)) {
2101
+ const verifications = p.verifications;
2081
2102
  return {
2082
- protocol_version: "4.0",
2103
+ protocol_version: "3.0",
2083
2104
  nonce: rpNonce,
2084
2105
  action: config.action ?? "",
2085
- responses: multi.verifications.map((v) => ({
2106
+ responses: verifications.map((v) => ({
2086
2107
  identifier: v.verification_level,
2087
2108
  signal_hash: v.signal_hash ?? signalHashes[v.verification_level],
2088
- proof: [v.proof],
2089
- nullifier: v.nullifier_hash,
2109
+ proof: v.proof,
2090
2110
  merkle_root: v.merkle_root,
2091
- issuer_schema_id: 0,
2092
- expires_at_min: 0
2111
+ nullifier: v.nullifier_hash
2093
2112
  })),
2094
- environment: "production"
2113
+ environment: config.environment ?? "production"
2095
2114
  };
2096
2115
  }
2097
- const single = payload;
2098
2116
  return {
2099
2117
  protocol_version: "3.0",
2100
2118
  nonce: rpNonce,
2101
2119
  action: config.action ?? "",
2102
2120
  responses: [
2103
2121
  {
2104
- identifier: single.verification_level,
2105
- signal_hash: single.signal_hash ?? signalHashes[single.verification_level],
2106
- proof: single.proof,
2107
- merkle_root: single.merkle_root,
2108
- nullifier: single.nullifier_hash
2122
+ identifier: p.verification_level,
2123
+ signal_hash: p.signal_hash ?? signalHashes[p.verification_level],
2124
+ proof: p.proof,
2125
+ merkle_root: p.merkle_root,
2126
+ nullifier: p.nullifier_hash
2109
2127
  }
2110
2128
  ],
2111
- environment: "production"
2129
+ environment: config.environment ?? "production"
2112
2130
  };
2113
2131
  }
2114
2132
 
package/dist/index.js CHANGED
@@ -389,12 +389,12 @@ function hashSignal(signal) {
389
389
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
390
390
  }
391
391
  }
392
- function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
393
- wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
394
- }
395
392
  function __wasm_bindgen_func_elem_605(arg0, arg1) {
396
393
  wasm.__wasm_bindgen_func_elem_605(arg0, arg1);
397
394
  }
395
+ function __wasm_bindgen_func_elem_968(arg0, arg1, arg2) {
396
+ wasm.__wasm_bindgen_func_elem_968(arg0, arg1, addHeapObject(arg2));
397
+ }
398
398
  function __wasm_bindgen_func_elem_1353(arg0, arg1, arg2, arg3) {
399
399
  wasm.__wasm_bindgen_func_elem_1353(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
400
400
  }
@@ -2057,55 +2057,73 @@ var NativeVerifyError = class extends Error {
2057
2057
  }
2058
2058
  };
2059
2059
  function nativeResultToIDKitResult(payload, config, signalHashes) {
2060
+ const p = payload;
2060
2061
  const rpNonce = config.rp_context?.nonce ?? "";
2061
- if ("responses" in payload) {
2062
- const v4 = payload;
2062
+ if ("responses" in p && Array.isArray(p.responses)) {
2063
+ const items = p.responses;
2064
+ if (p.session_id) {
2065
+ return {
2066
+ protocol_version: "4.0",
2067
+ nonce: p.nonce ?? rpNonce,
2068
+ action_description: p.action_description,
2069
+ session_id: p.session_id,
2070
+ responses: items.map((item) => ({
2071
+ identifier: item.identifier,
2072
+ signal_hash: signalHashes[item.identifier],
2073
+ proof: item.proof,
2074
+ session_nullifier: item.session_nullifier,
2075
+ issuer_schema_id: item.issuer_schema_id,
2076
+ expires_at_min: item.expires_at_min
2077
+ })),
2078
+ environment: config.environment ?? "production"
2079
+ };
2080
+ }
2063
2081
  return {
2064
- protocol_version: v4.protocol_version ?? "4.0",
2065
- nonce: v4.nonce ?? rpNonce,
2066
- action: v4.action ?? config.action ?? "",
2067
- action_description: v4.action_description,
2068
- session_id: v4.session_id,
2069
- responses: v4.responses.map((item) => ({
2070
- ...item,
2071
- signal_hash: signalHashes[item.identifier]
2082
+ protocol_version: "4.0",
2083
+ nonce: p.nonce ?? rpNonce,
2084
+ action: p.action ?? config.action ?? "",
2085
+ action_description: p.action_description,
2086
+ responses: items.map((item) => ({
2087
+ identifier: item.identifier,
2088
+ signal_hash: signalHashes[item.identifier],
2089
+ proof: item.proof,
2090
+ nullifier: item.nullifier,
2091
+ issuer_schema_id: item.issuer_schema_id,
2092
+ expires_at_min: item.expires_at_min
2072
2093
  })),
2073
- environment: v4.environment ?? config.environment ?? "production"
2094
+ environment: config.environment ?? "production"
2074
2095
  };
2075
2096
  }
2076
- if ("verifications" in payload) {
2077
- const multi = payload;
2097
+ if ("verifications" in p && Array.isArray(p.verifications)) {
2098
+ const verifications = p.verifications;
2078
2099
  return {
2079
- protocol_version: "4.0",
2100
+ protocol_version: "3.0",
2080
2101
  nonce: rpNonce,
2081
2102
  action: config.action ?? "",
2082
- responses: multi.verifications.map((v) => ({
2103
+ responses: verifications.map((v) => ({
2083
2104
  identifier: v.verification_level,
2084
2105
  signal_hash: v.signal_hash ?? signalHashes[v.verification_level],
2085
- proof: [v.proof],
2086
- nullifier: v.nullifier_hash,
2106
+ proof: v.proof,
2087
2107
  merkle_root: v.merkle_root,
2088
- issuer_schema_id: 0,
2089
- expires_at_min: 0
2108
+ nullifier: v.nullifier_hash
2090
2109
  })),
2091
- environment: "production"
2110
+ environment: config.environment ?? "production"
2092
2111
  };
2093
2112
  }
2094
- const single = payload;
2095
2113
  return {
2096
2114
  protocol_version: "3.0",
2097
2115
  nonce: rpNonce,
2098
2116
  action: config.action ?? "",
2099
2117
  responses: [
2100
2118
  {
2101
- identifier: single.verification_level,
2102
- signal_hash: single.signal_hash ?? signalHashes[single.verification_level],
2103
- proof: single.proof,
2104
- merkle_root: single.merkle_root,
2105
- nullifier: single.nullifier_hash
2119
+ identifier: p.verification_level,
2120
+ signal_hash: p.signal_hash ?? signalHashes[p.verification_level],
2121
+ proof: p.proof,
2122
+ merkle_root: p.merkle_root,
2123
+ nullifier: p.nullifier_hash
2106
2124
  }
2107
2125
  ],
2108
- environment: "production"
2126
+ environment: config.environment ?? "production"
2109
2127
  };
2110
2128
  }
2111
2129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/idkit-core",
3
- "version": "4.0.6",
3
+ "version": "4.0.7",
4
4
  "description": "Core IDKit SDK for World ID - Pure TypeScript, no dependencies",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",