ns-auth-sdk 1.14.0 → 1.14.2
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/{cjs-CSUAVztq.cjs → browser-index.cjs} +5476 -296
- package/dist/browser-index.cjs.map +1 -0
- package/dist/browser-index.d.cts +1998 -0
- package/dist/browser-index.d.cts.map +1 -0
- package/dist/browser-index.d.mts +1998 -0
- package/dist/browser-index.d.mts.map +1 -0
- package/dist/{cjs-sm5h7qxv.mjs → browser-index.mjs} +5169 -69
- package/dist/browser-index.mjs.map +1 -0
- package/dist/{group-coordination-BlFpBVpn.mjs → group-coordination-BV6PKlKp.mjs} +1 -1
- package/dist/{group-coordination-BlFpBVpn.mjs.map → group-coordination-BV6PKlKp.mjs.map} +1 -1
- package/dist/{group-coordination-ImuoJEoy.mjs → group-coordination-BytkmY9j.mjs} +1 -1
- package/dist/{group-coordination-LGIyipaX.cjs → group-coordination-DL39hJ3R.cjs} +1 -1
- package/dist/{group-coordination-LGIyipaX.cjs.map → group-coordination-DL39hJ3R.cjs.map} +1 -1
- package/dist/{group-coordination-Cf18OjZt.cjs → group-coordination-DLban6a7.cjs} +1 -1
- package/dist/index.cjs +8899 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.mjs +9072 -213
- package/dist/index.mjs.map +1 -1
- package/dist/{prf-handler-D3EqUNWe.cjs → prf-handler-BNd7gmXJ.cjs} +1 -1
- package/dist/{prf-handler-D3EqUNWe.cjs.map → prf-handler-BNd7gmXJ.cjs.map} +1 -1
- package/dist/prf-handler-CRMgzJG2.cjs +3 -0
- package/dist/{prf-handler-Dly_WZGn.mjs → prf-handler-DG99ZkS2.mjs} +1 -1
- package/dist/{prf-handler-Db8CsoIP.mjs → prf-handler-Dj2WTO9i.mjs} +1 -1
- package/dist/{prf-handler-Db8CsoIP.mjs.map → prf-handler-Dj2WTO9i.mjs.map} +1 -1
- package/dist/zkm.service-Bv88tVS5.mjs +3 -0
- package/dist/zkm.service-D2BZ_aqA.cjs +3 -0
- package/dist/{zkm.service-DfSPbuOl.cjs → zkm.service-DX06sSfB.cjs} +1 -1
- package/dist/{zkm.service-DfSPbuOl.cjs.map → zkm.service-DX06sSfB.cjs.map} +1 -1
- package/dist/{zkm.service-B24N_0FB.mjs → zkm.service-j0HlN7Oq.mjs} +1 -1
- package/dist/{zkm.service-B24N_0FB.mjs.map → zkm.service-j0HlN7Oq.mjs.map} +1 -1
- package/package.json +19 -6
- package/dist/_esm-C7FRLTj2.cjs +0 -9030
- package/dist/_esm-C7FRLTj2.cjs.map +0 -1
- package/dist/_esm-D_oMW5T5.mjs +0 -9028
- package/dist/_esm-D_oMW5T5.mjs.map +0 -1
- package/dist/base64-js-B8y7dH5k.mjs +0 -93
- package/dist/base64-js-B8y7dH5k.mjs.map +0 -1
- package/dist/base64-js-Tm-kCeud.cjs +0 -98
- package/dist/base64-js-Tm-kCeud.cjs.map +0 -1
- package/dist/ccip-157tdxqP.cjs +0 -7947
- package/dist/ccip-157tdxqP.cjs.map +0 -1
- package/dist/ccip-BEMMdVyd.cjs +0 -4
- package/dist/ccip-BSmCdJ3K.mjs +0 -3
- package/dist/ccip-okqXkslP.mjs +0 -6567
- package/dist/ccip-okqXkslP.mjs.map +0 -1
- package/dist/chains-CTeD2UcS.mjs +0 -33
- package/dist/chains-CTeD2UcS.mjs.map +0 -1
- package/dist/chains-Du-lv_5i.cjs +0 -33
- package/dist/chains-Du-lv_5i.cjs.map +0 -1
- package/dist/chunk-Bnu9O96Y.cjs +0 -60
- package/dist/chunk-CVYhg9ik.mjs +0 -45
- package/dist/cjs-CSUAVztq.cjs.map +0 -1
- package/dist/cjs-sm5h7qxv.mjs.map +0 -1
- package/dist/defineChain-7QG67hYU.cjs +0 -30
- package/dist/defineChain-7QG67hYU.cjs.map +0 -1
- package/dist/defineChain-DBem8ZQY.mjs +0 -24
- package/dist/defineChain-DBem8ZQY.mjs.map +0 -1
- package/dist/dist-BPmSxkxc.cjs +0 -10676
- package/dist/dist-BPmSxkxc.cjs.map +0 -1
- package/dist/dist-BSjH4t6s.cjs +0 -12932
- package/dist/dist-BSjH4t6s.cjs.map +0 -1
- package/dist/dist-C-KjTK4Q.cjs +0 -447
- package/dist/dist-C-KjTK4Q.cjs.map +0 -1
- package/dist/dist-C2h97xM-.mjs +0 -355
- package/dist/dist-C2h97xM-.mjs.map +0 -1
- package/dist/dist-CT7grDWb.mjs +0 -12920
- package/dist/dist-CT7grDWb.mjs.map +0 -1
- package/dist/dist-D7fRmK6G.mjs +0 -10632
- package/dist/dist-D7fRmK6G.mjs.map +0 -1
- package/dist/dist-DlmcyFmM.mjs +0 -16951
- package/dist/dist-DlmcyFmM.mjs.map +0 -1
- package/dist/dist-O0uZr5OF.cjs +0 -17122
- package/dist/dist-O0uZr5OF.cjs.map +0 -1
- package/dist/echo-BB-JgAYZ.cjs +0 -339
- package/dist/echo-BB-JgAYZ.cjs.map +0 -1
- package/dist/echo-Bwy4_Cvh.mjs +0 -316
- package/dist/echo-Bwy4_Cvh.mjs.map +0 -1
- package/dist/echo-D6X2IuNW.cjs +0 -9
- package/dist/echo-DvfG_heb.mjs +0 -8
- package/dist/esm-BcHKCX5i.mjs +0 -569
- package/dist/esm-BcHKCX5i.mjs.map +0 -1
- package/dist/esm-Bh_YwFIz.cjs +0 -599
- package/dist/esm-Bh_YwFIz.cjs.map +0 -1
- package/dist/esm-C0XO9TQm.cjs +0 -30449
- package/dist/esm-C0XO9TQm.cjs.map +0 -1
- package/dist/esm-vMUVj9k4.mjs +0 -30440
- package/dist/esm-vMUVj9k4.mjs.map +0 -1
- package/dist/keyset-CKMQXvsb.mjs +0 -172
- package/dist/keyset-CKMQXvsb.mjs.map +0 -1
- package/dist/keyset-Cxdgu110.cjs +0 -237
- package/dist/keyset-Cxdgu110.cjs.map +0 -1
- package/dist/keyset-DLxpGhdu.cjs +0 -6
- package/dist/keyset-IKjlhvqF.mjs +0 -4
- package/dist/node-3EUJ4ga9.cjs +0 -9
- package/dist/node-C2UpE11T.cjs +0 -444
- package/dist/node-C2UpE11T.cjs.map +0 -1
- package/dist/node-CHdpTQdN.mjs +0 -8679
- package/dist/node-CHdpTQdN.mjs.map +0 -1
- package/dist/node-DQt1CVGl.mjs +0 -6
- package/dist/node-Dy8ww1LG.cjs +0 -8680
- package/dist/node-Dy8ww1LG.cjs.map +0 -1
- package/dist/node-IX55IH6z.mjs +0 -397
- package/dist/node-IX55IH6z.mjs.map +0 -1
- package/dist/nostr-BTOpBN_5.cjs +0 -11
- package/dist/nostr-D4E52XRU.mjs +0 -224
- package/dist/nostr-D4E52XRU.mjs.map +0 -1
- package/dist/nostr-Hv2tsnuI.cjs +0 -272
- package/dist/nostr-Hv2tsnuI.cjs.map +0 -1
- package/dist/nostr-ZwJe_DlZ.mjs +0 -4
- package/dist/pako.esm-DTVnlCJh.cjs +0 -3856
- package/dist/pako.esm-DTVnlCJh.cjs.map +0 -1
- package/dist/pako.esm-ORhkEHM2.mjs +0 -3838
- package/dist/pako.esm-ORhkEHM2.mjs.map +0 -1
- package/dist/peer-B9g3OQ5D.cjs +0 -18
- package/dist/peer-CptDj7zu.mjs +0 -745
- package/dist/peer-CptDj7zu.mjs.map +0 -1
- package/dist/peer-CtqL0yiE.mjs +0 -9
- package/dist/peer-XrPL0O6z.cjs +0 -822
- package/dist/peer-XrPL0O6z.cjs.map +0 -1
- package/dist/ping-BXKREIdI.mjs +0 -7
- package/dist/ping-BtVhKocl.cjs +0 -379
- package/dist/ping-BtVhKocl.cjs.map +0 -1
- package/dist/ping-D5fpMhGC.cjs +0 -11
- package/dist/ping-DOD50kW_.mjs +0 -332
- package/dist/ping-DOD50kW_.mjs.map +0 -1
- package/dist/policy-8HcjulLD.cjs +0 -293
- package/dist/policy-8HcjulLD.cjs.map +0 -1
- package/dist/policy-BA6MEOBY.mjs +0 -5
- package/dist/policy-BFNdXvmM.cjs +0 -11
- package/dist/policy-D_nFHHjo.mjs +0 -228
- package/dist/policy-D_nFHHjo.mjs.map +0 -1
- package/dist/prf-handler-BNiyCQMt.cjs +0 -3
- package/dist/src-CVfTUJQl.mjs +0 -822
- package/dist/src-CVfTUJQl.mjs.map +0 -1
- package/dist/src-D5S86Xpf.cjs +0 -827
- package/dist/src-D5S86Xpf.cjs.map +0 -1
- package/dist/types-B-TLIS13.cjs +0 -212
- package/dist/types-B-TLIS13.cjs.map +0 -1
- package/dist/types-CTm_FHYD.mjs +0 -111
- package/dist/types-CTm_FHYD.mjs.map +0 -1
- package/dist/validation-1xwWVXqE.mjs +0 -3
- package/dist/validation-DnpurN79.cjs +0 -405
- package/dist/validation-DnpurN79.cjs.map +0 -1
- package/dist/validation-IsAUvsvy.mjs +0 -334
- package/dist/validation-IsAUvsvy.mjs.map +0 -1
- package/dist/validation-yCvZCqIs.cjs +0 -6
- package/dist/wrapper-C5NpyacC.cjs +0 -3552
- package/dist/wrapper-C5NpyacC.cjs.map +0 -1
- package/dist/wrapper-CHq_CV4J.mjs +0 -3552
- package/dist/wrapper-CHq_CV4J.mjs.map +0 -1
- package/dist/zkm.service-BrXyI4BS.mjs +0 -3
- package/dist/zkm.service-BvQ01wSH.cjs +0 -3
package/dist/node-C2UpE11T.cjs
DELETED
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
const require_dist = require('./dist-BPmSxkxc.cjs');
|
|
2
|
-
const require_types = require('./types-B-TLIS13.cjs');
|
|
3
|
-
const require_policy = require('./policy-8HcjulLD.cjs');
|
|
4
|
-
|
|
5
|
-
//#region node_modules/@frostr/igloo-core/dist/node.js
|
|
6
|
-
/**
|
|
7
|
-
* Creates a BifrostNode with proper validation and event handling
|
|
8
|
-
*/
|
|
9
|
-
function createBifrostNode(config, eventConfig = {}) {
|
|
10
|
-
try {
|
|
11
|
-
const validatedConfig = require_types.NodeConfigSchema.parse(config);
|
|
12
|
-
const decodedGroup = require_dist.PackageEncoder$1.group.decode(validatedConfig.group);
|
|
13
|
-
const decodedShare = require_dist.PackageEncoder$1.share.decode(validatedConfig.share);
|
|
14
|
-
const { peerConfigs, normalizedPolicies } = require_policy.prepareNodePolicies(validatedConfig.policies);
|
|
15
|
-
const nodeOptions = peerConfigs.length ? { policies: peerConfigs } : void 0;
|
|
16
|
-
const node = nodeOptions ? new require_dist.BifrostNode$1(decodedGroup, decodedShare, validatedConfig.relays, nodeOptions) : new require_dist.BifrostNode$1(decodedGroup, decodedShare, validatedConfig.relays);
|
|
17
|
-
setupNodeEvents(node, eventConfig);
|
|
18
|
-
if (normalizedPolicies.length) require_policy.registerNodePolicyMetadata(node, normalizedPolicies);
|
|
19
|
-
return node;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
throw new require_types.NodeError(`Failed to create BifrostNode: ${error.message}`, {
|
|
22
|
-
config,
|
|
23
|
-
error
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Sets up comprehensive event handlers for a BifrostNode
|
|
29
|
-
*/
|
|
30
|
-
function setupNodeEvents(node, config = {}) {
|
|
31
|
-
const { enableLogging = true, logLevel = "info", customLogger } = config;
|
|
32
|
-
const log = (level, message, data) => {
|
|
33
|
-
if (!enableLogging) return;
|
|
34
|
-
if (customLogger) customLogger(level, message, data);
|
|
35
|
-
else console.log(`[${level.toUpperCase()}] ${message}`, data || "");
|
|
36
|
-
};
|
|
37
|
-
node.on("*", (eventName, data) => {
|
|
38
|
-
log("debug", `Event emitted: ${eventName}`, data);
|
|
39
|
-
});
|
|
40
|
-
node.on("info", (data) => {
|
|
41
|
-
log("info", "Bifrost info", data);
|
|
42
|
-
});
|
|
43
|
-
node.on("debug", (data) => {
|
|
44
|
-
log("debug", "Bifrost debug", data);
|
|
45
|
-
});
|
|
46
|
-
node.on("ready", (node$1) => {
|
|
47
|
-
log("info", "Bifrost node is ready", { nodeId: node$1.constructor.name });
|
|
48
|
-
});
|
|
49
|
-
node.on("closed", (node$1) => {
|
|
50
|
-
log("info", "Bifrost node connection closed", { nodeId: node$1.constructor.name });
|
|
51
|
-
});
|
|
52
|
-
node.on("message", (msg) => {
|
|
53
|
-
log("debug", "Received message", msg);
|
|
54
|
-
});
|
|
55
|
-
node.on("bounced", (reason, msg) => {
|
|
56
|
-
log("warn", "Message bounced", {
|
|
57
|
-
reason,
|
|
58
|
-
message: msg
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
node.on("error", (error) => {
|
|
62
|
-
log("error", "Node error occurred", error);
|
|
63
|
-
});
|
|
64
|
-
node.on("/ecdh/sender/req", (msg) => {
|
|
65
|
-
log("debug", "ECDH request sent", msg);
|
|
66
|
-
});
|
|
67
|
-
node.on("/ecdh/sender/res", (...msgs) => {
|
|
68
|
-
log("debug", "ECDH responses received", msgs);
|
|
69
|
-
});
|
|
70
|
-
node.on("/ecdh/sender/rej", (reason, pkg) => {
|
|
71
|
-
log("warn", "ECDH request rejected", {
|
|
72
|
-
reason,
|
|
73
|
-
package: pkg
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
node.on("/ecdh/sender/ret", (reason, pkgs) => {
|
|
77
|
-
log("info", "ECDH shares aggregated", {
|
|
78
|
-
reason,
|
|
79
|
-
packages: pkgs
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
node.on("/ecdh/sender/err", (reason, msgs) => {
|
|
83
|
-
log("error", "ECDH share aggregation failed", {
|
|
84
|
-
reason,
|
|
85
|
-
messages: msgs
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
node.on("/ecdh/handler/req", (msg) => {
|
|
89
|
-
log("debug", "ECDH request received", msg);
|
|
90
|
-
});
|
|
91
|
-
node.on("/ecdh/handler/res", (msg) => {
|
|
92
|
-
log("debug", "ECDH response sent", msg);
|
|
93
|
-
});
|
|
94
|
-
node.on("/ecdh/handler/rej", (reason, msg) => {
|
|
95
|
-
log("warn", "ECDH rejection sent", {
|
|
96
|
-
reason,
|
|
97
|
-
message: msg
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
node.on("/sign/sender/req", (msg) => {
|
|
101
|
-
log("debug", "Signature request sent", msg);
|
|
102
|
-
});
|
|
103
|
-
node.on("/sign/sender/res", (...msgs) => {
|
|
104
|
-
log("debug", "Signature responses received", msgs);
|
|
105
|
-
});
|
|
106
|
-
node.on("/sign/sender/rej", (reason, pkg) => {
|
|
107
|
-
log("warn", "Signature request rejected", {
|
|
108
|
-
reason,
|
|
109
|
-
package: pkg
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
node.on("/sign/sender/ret", (reason, msgs) => {
|
|
113
|
-
log("info", "Signature shares aggregated", {
|
|
114
|
-
reason,
|
|
115
|
-
signatures: msgs
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
node.on("/sign/sender/err", (reason, msgs) => {
|
|
119
|
-
log("error", "Signature share aggregation failed", {
|
|
120
|
-
reason,
|
|
121
|
-
messages: msgs
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
node.on("/sign/handler/req", (msg) => {
|
|
125
|
-
log("debug", "Signature request received", msg);
|
|
126
|
-
});
|
|
127
|
-
node.on("/sign/handler/res", (msg) => {
|
|
128
|
-
log("debug", "Signature response sent", msg);
|
|
129
|
-
});
|
|
130
|
-
node.on("/sign/handler/rej", (reason, msg) => {
|
|
131
|
-
log("warn", "Signature rejection sent", {
|
|
132
|
-
reason,
|
|
133
|
-
message: msg
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
node.on("/ping/handler/req", (msg) => {
|
|
137
|
-
log("debug", "Ping request received", msg);
|
|
138
|
-
});
|
|
139
|
-
node.on("/ping/handler/res", (msg) => {
|
|
140
|
-
log("debug", "Ping response sent", msg);
|
|
141
|
-
});
|
|
142
|
-
node.on("/ping/handler/rej", (reason, msg) => {
|
|
143
|
-
log("warn", "Ping rejection sent", {
|
|
144
|
-
reason,
|
|
145
|
-
message: msg
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
node.on("/ping/handler/ret", (reason, data) => {
|
|
149
|
-
log("info", "Ping handler returned", {
|
|
150
|
-
reason,
|
|
151
|
-
data
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
node.on("/ping/sender/req", (msg) => {
|
|
155
|
-
log("debug", "Ping request sent", msg);
|
|
156
|
-
});
|
|
157
|
-
node.on("/ping/sender/res", (msg) => {
|
|
158
|
-
log("debug", "Ping response received", msg);
|
|
159
|
-
});
|
|
160
|
-
node.on("/ping/sender/rej", (reason, msg) => {
|
|
161
|
-
log("warn", "Ping request rejected", {
|
|
162
|
-
reason,
|
|
163
|
-
message: msg
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
node.on("/ping/sender/ret", (config$1) => {
|
|
167
|
-
log("info", "Ping sender returned peer config", config$1);
|
|
168
|
-
});
|
|
169
|
-
node.on("/ping/sender/err", (reason, msg) => {
|
|
170
|
-
log("error", "Ping sender error", {
|
|
171
|
-
reason,
|
|
172
|
-
message: msg
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
node.on("/echo/handler/req", (msg) => {
|
|
176
|
-
log("debug", "Echo request received", msg);
|
|
177
|
-
});
|
|
178
|
-
node.on("/echo/handler/res", (msg) => {
|
|
179
|
-
log("debug", "Echo response sent", msg);
|
|
180
|
-
});
|
|
181
|
-
node.on("/echo/handler/rej", (reason, msg) => {
|
|
182
|
-
log("warn", "Echo rejection sent", {
|
|
183
|
-
reason,
|
|
184
|
-
message: msg
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
node.on("/echo/sender/req", (msg) => {
|
|
188
|
-
log("debug", "Echo request sent", msg);
|
|
189
|
-
});
|
|
190
|
-
node.on("/echo/sender/res", (msg) => {
|
|
191
|
-
log("debug", "Echo response received", msg);
|
|
192
|
-
});
|
|
193
|
-
node.on("/echo/sender/rej", (reason, msg) => {
|
|
194
|
-
log("warn", "Echo request rejected", {
|
|
195
|
-
reason,
|
|
196
|
-
message: msg
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
node.on("/echo/sender/ret", (reason) => {
|
|
200
|
-
log("info", "Echo sender returned", { reason });
|
|
201
|
-
});
|
|
202
|
-
node.on("/echo/sender/err", (reason, msg) => {
|
|
203
|
-
log("error", "Echo sender error", {
|
|
204
|
-
reason,
|
|
205
|
-
message: msg
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Safely connects a BifrostNode with error handling
|
|
211
|
-
*/
|
|
212
|
-
async function connectNode(node) {
|
|
213
|
-
const client = node?.client;
|
|
214
|
-
if (client && typeof client.connect === "function") {
|
|
215
|
-
const originalConnect = client.connect;
|
|
216
|
-
const hadOwnConnect = Object.prototype.hasOwnProperty.call(client, "connect");
|
|
217
|
-
let connectPromise;
|
|
218
|
-
client.connect = (...args) => {
|
|
219
|
-
const result = originalConnect.apply(client, args);
|
|
220
|
-
if (result && typeof result.then === "function") {
|
|
221
|
-
connectPromise = Promise.resolve(result).catch((error) => {
|
|
222
|
-
throw error;
|
|
223
|
-
});
|
|
224
|
-
return connectPromise;
|
|
225
|
-
}
|
|
226
|
-
connectPromise = void 0;
|
|
227
|
-
return result;
|
|
228
|
-
};
|
|
229
|
-
try {
|
|
230
|
-
await node.connect();
|
|
231
|
-
if (connectPromise) await connectPromise;
|
|
232
|
-
return;
|
|
233
|
-
} catch (error) {
|
|
234
|
-
throw new require_types.NodeError(`Failed to connect BifrostNode: ${error?.message ?? error}`, { error });
|
|
235
|
-
} finally {
|
|
236
|
-
if (hadOwnConnect) client.connect = originalConnect;
|
|
237
|
-
else delete client.connect;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
try {
|
|
241
|
-
await node.connect();
|
|
242
|
-
} catch (error) {
|
|
243
|
-
throw new require_types.NodeError(`Failed to connect BifrostNode: ${error?.message ?? error}`, { error });
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Safely closes a BifrostNode with cleanup
|
|
248
|
-
*/
|
|
249
|
-
function closeNode(node) {
|
|
250
|
-
const nodeAsAny = node;
|
|
251
|
-
const client = nodeAsAny?.client;
|
|
252
|
-
const emitCloseError = (error) => {
|
|
253
|
-
if (error instanceof Error && error.message === "relay connection closed by us") return;
|
|
254
|
-
const normalized = error instanceof require_types.NodeError ? error : new require_types.NodeError(`Failed to close BifrostNode: ${error instanceof Error ? error.message : String(error)}`, { error });
|
|
255
|
-
if (typeof nodeAsAny?.emit === "function") nodeAsAny.emit("error", normalized);
|
|
256
|
-
console.warn("[closeNode] Error while closing BifrostNode:", normalized);
|
|
257
|
-
};
|
|
258
|
-
const attachErrorHandler = (maybePromise) => {
|
|
259
|
-
if (maybePromise && typeof maybePromise.catch === "function") maybePromise.catch(emitCloseError);
|
|
260
|
-
};
|
|
261
|
-
if (client && typeof client.close === "function") {
|
|
262
|
-
const originalClose = client.close;
|
|
263
|
-
const hadOwnClose = Object.prototype.hasOwnProperty.call(client, "close");
|
|
264
|
-
const restoreClientClose = () => {
|
|
265
|
-
if (hadOwnClose) client.close = originalClose;
|
|
266
|
-
else delete client.close;
|
|
267
|
-
};
|
|
268
|
-
client.close = (...args) => {
|
|
269
|
-
try {
|
|
270
|
-
const result = originalClose.apply(client, args);
|
|
271
|
-
if (result && typeof result.finally === "function") result.catch(emitCloseError).finally(restoreClientClose);
|
|
272
|
-
else restoreClientClose();
|
|
273
|
-
return result;
|
|
274
|
-
} catch (error) {
|
|
275
|
-
restoreClientClose();
|
|
276
|
-
throw error;
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
try {
|
|
280
|
-
attachErrorHandler(node.close());
|
|
281
|
-
} catch (error) {
|
|
282
|
-
restoreClientClose();
|
|
283
|
-
throw new require_types.NodeError(`Failed to close BifrostNode: ${error?.message ?? error}`, { error });
|
|
284
|
-
}
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
try {
|
|
288
|
-
attachErrorHandler(node.close());
|
|
289
|
-
} catch (error) {
|
|
290
|
-
throw new require_types.NodeError(`Failed to close BifrostNode: ${error?.message ?? error}`, { error });
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Creates a BifrostNode and connects it
|
|
295
|
-
*/
|
|
296
|
-
async function createAndConnectNode(config, eventConfig) {
|
|
297
|
-
const node = createBifrostNode(config, eventConfig);
|
|
298
|
-
await connectNode(node);
|
|
299
|
-
return node;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Enhanced node creation with state information
|
|
303
|
-
* Returns both the node and its current state for better control
|
|
304
|
-
*
|
|
305
|
-
* @param config - Enhanced configuration including timeout and auto-reconnect options
|
|
306
|
-
* @param eventConfig - Optional event configuration for logging and custom handlers
|
|
307
|
-
* @returns Promise resolving to both the connected node and its state information
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* ```typescript
|
|
311
|
-
* const { node, state } = await createConnectedNode({
|
|
312
|
-
* group: 'bfgroup1...',
|
|
313
|
-
* share: 'bfshare1...',
|
|
314
|
-
* relays: ['wss://relay.damus.io'],
|
|
315
|
-
* connectionTimeout: 5000,
|
|
316
|
-
* autoReconnect: true
|
|
317
|
-
* });
|
|
318
|
-
*
|
|
319
|
-
* console.log('Node ready:', state.isReady);
|
|
320
|
-
* console.log('Connected relays:', state.connectedRelays);
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
323
|
-
async function createConnectedNode(config, eventConfig) {
|
|
324
|
-
const node = createBifrostNode(config, eventConfig);
|
|
325
|
-
const state = {
|
|
326
|
-
isReady: false,
|
|
327
|
-
isConnected: false,
|
|
328
|
-
isConnecting: true,
|
|
329
|
-
connectedRelays: []
|
|
330
|
-
};
|
|
331
|
-
try {
|
|
332
|
-
await connectNode(node);
|
|
333
|
-
state.isReady = true;
|
|
334
|
-
state.isConnected = true;
|
|
335
|
-
state.isConnecting = false;
|
|
336
|
-
state.connectedRelays = [...config.relays];
|
|
337
|
-
return {
|
|
338
|
-
node,
|
|
339
|
-
state
|
|
340
|
-
};
|
|
341
|
-
} catch (error) {
|
|
342
|
-
state.isConnecting = false;
|
|
343
|
-
state.lastError = error instanceof Error ? error.message : "Unknown error";
|
|
344
|
-
throw error;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Check if a BifrostNode is ready synchronously
|
|
349
|
-
* This helper works around the race condition with ready events
|
|
350
|
-
*
|
|
351
|
-
* @param node - The BifrostNode to check
|
|
352
|
-
* @returns true if the node is ready and connected, false otherwise
|
|
353
|
-
*
|
|
354
|
-
* @example
|
|
355
|
-
* ```typescript
|
|
356
|
-
* const node = await createAndConnectNode(config);
|
|
357
|
-
*
|
|
358
|
-
* // Safe synchronous check - no race conditions
|
|
359
|
-
* if (isNodeReady(node)) {
|
|
360
|
-
* console.log('Node is ready for operations');
|
|
361
|
-
* }
|
|
362
|
-
* ```
|
|
363
|
-
*/
|
|
364
|
-
function isNodeReady(node) {
|
|
365
|
-
try {
|
|
366
|
-
return !!node.client && !!node.client.connected;
|
|
367
|
-
} catch {
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Comprehensive cleanup for BifrostNode
|
|
373
|
-
* Removes all event listeners and safely disconnects the node
|
|
374
|
-
*
|
|
375
|
-
* Note: Since we don't have access to the original listener functions,
|
|
376
|
-
* this function uses removeAllListeners to clear all event handlers.
|
|
377
|
-
* For more precise cleanup, store listener references when setting them up.
|
|
378
|
-
*/
|
|
379
|
-
function cleanupBifrostNode(node) {
|
|
380
|
-
if (!node) return;
|
|
381
|
-
try {
|
|
382
|
-
const nodeAsAny = node;
|
|
383
|
-
if (typeof nodeAsAny.removeAllListeners === "function") nodeAsAny.removeAllListeners();
|
|
384
|
-
else console.warn("removeAllListeners not available - manual cleanup may be incomplete");
|
|
385
|
-
try {
|
|
386
|
-
node.close();
|
|
387
|
-
} catch (closeError) {
|
|
388
|
-
console.warn("Warning: Error during node.close():", closeError);
|
|
389
|
-
}
|
|
390
|
-
} catch (error) {
|
|
391
|
-
console.warn("Warning: Error during node cleanup:", error);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
//#endregion
|
|
396
|
-
Object.defineProperty(exports, 'cleanupBifrostNode', {
|
|
397
|
-
enumerable: true,
|
|
398
|
-
get: function () {
|
|
399
|
-
return cleanupBifrostNode;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
Object.defineProperty(exports, 'closeNode', {
|
|
403
|
-
enumerable: true,
|
|
404
|
-
get: function () {
|
|
405
|
-
return closeNode;
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
Object.defineProperty(exports, 'connectNode', {
|
|
409
|
-
enumerable: true,
|
|
410
|
-
get: function () {
|
|
411
|
-
return connectNode;
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
Object.defineProperty(exports, 'createAndConnectNode', {
|
|
415
|
-
enumerable: true,
|
|
416
|
-
get: function () {
|
|
417
|
-
return createAndConnectNode;
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
Object.defineProperty(exports, 'createBifrostNode', {
|
|
421
|
-
enumerable: true,
|
|
422
|
-
get: function () {
|
|
423
|
-
return createBifrostNode;
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
Object.defineProperty(exports, 'createConnectedNode', {
|
|
427
|
-
enumerable: true,
|
|
428
|
-
get: function () {
|
|
429
|
-
return createConnectedNode;
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
Object.defineProperty(exports, 'isNodeReady', {
|
|
433
|
-
enumerable: true,
|
|
434
|
-
get: function () {
|
|
435
|
-
return isNodeReady;
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
Object.defineProperty(exports, 'setupNodeEvents', {
|
|
439
|
-
enumerable: true,
|
|
440
|
-
get: function () {
|
|
441
|
-
return setupNodeEvents;
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
//# sourceMappingURL=node-C2UpE11T.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-C2UpE11T.cjs","names":["NodeConfigSchema","PackageEncoder","prepareNodePolicies","BifrostNode","NodeError","node","config"],"sources":["../node_modules/@frostr/igloo-core/dist/node.js"],"sourcesContent":["import { BifrostNode, PackageEncoder } from '@frostr/bifrost';\nimport { NodeError, NodeConfigSchema } from './types.js';\nimport { prepareNodePolicies, registerNodePolicyMetadata } from './policy.js';\n/**\n * Creates a BifrostNode with proper validation and event handling\n */\nexport function createBifrostNode(config, eventConfig = {}) {\n try {\n const validatedConfig = NodeConfigSchema.parse(config);\n const decodedGroup = PackageEncoder.group.decode(validatedConfig.group);\n const decodedShare = PackageEncoder.share.decode(validatedConfig.share);\n const { peerConfigs, normalizedPolicies } = prepareNodePolicies(validatedConfig.policies);\n const nodeOptions = peerConfigs.length ? { policies: peerConfigs } : undefined;\n const node = nodeOptions\n ? new BifrostNode(decodedGroup, decodedShare, validatedConfig.relays, nodeOptions)\n : new BifrostNode(decodedGroup, decodedShare, validatedConfig.relays);\n // Set up event handlers with optional logging\n setupNodeEvents(node, eventConfig);\n if (normalizedPolicies.length) {\n registerNodePolicyMetadata(node, normalizedPolicies);\n }\n return node;\n }\n catch (error) {\n throw new NodeError(`Failed to create BifrostNode: ${error.message}`, { config, error });\n }\n}\n/**\n * Sets up comprehensive event handlers for a BifrostNode\n */\nexport function setupNodeEvents(node, config = {}) {\n const { enableLogging = true, logLevel = 'info', customLogger } = config;\n const log = (level, message, data) => {\n if (!enableLogging)\n return;\n if (customLogger) {\n customLogger(level, message, data);\n }\n else {\n console.log(`[${level.toUpperCase()}] ${message}`, data || '');\n }\n };\n // Wildcard event handler\n node.on('*', (eventName, data) => {\n log('debug', `Event emitted: ${eventName}`, data);\n });\n // Base logging events\n node.on('info', (data) => {\n log('info', 'Bifrost info', data);\n });\n node.on('debug', (data) => {\n log('debug', 'Bifrost debug', data);\n });\n // Base events\n node.on('ready', (node) => {\n log('info', 'Bifrost node is ready', { nodeId: node.constructor.name });\n });\n node.on('closed', (node) => {\n log('info', 'Bifrost node connection closed', { nodeId: node.constructor.name });\n });\n node.on('message', (msg) => {\n log('debug', 'Received message', msg);\n });\n node.on('bounced', (reason, msg) => {\n log('warn', 'Message bounced', { reason, message: msg });\n });\n node.on('error', (error) => {\n log('error', 'Node error occurred', error);\n });\n // ECDH events\n node.on('/ecdh/sender/req', (msg) => {\n log('debug', 'ECDH request sent', msg);\n });\n node.on('/ecdh/sender/res', (...msgs) => {\n log('debug', 'ECDH responses received', msgs);\n });\n node.on('/ecdh/sender/rej', (reason, pkg) => {\n log('warn', 'ECDH request rejected', { reason, package: pkg });\n });\n node.on('/ecdh/sender/ret', (reason, pkgs) => {\n log('info', 'ECDH shares aggregated', { reason, packages: pkgs });\n });\n node.on('/ecdh/sender/err', (reason, msgs) => {\n log('error', 'ECDH share aggregation failed', { reason, messages: msgs });\n });\n node.on('/ecdh/handler/req', (msg) => {\n log('debug', 'ECDH request received', msg);\n });\n node.on('/ecdh/handler/res', (msg) => {\n log('debug', 'ECDH response sent', msg);\n });\n node.on('/ecdh/handler/rej', (reason, msg) => {\n log('warn', 'ECDH rejection sent', { reason, message: msg });\n });\n // Signature events\n node.on('/sign/sender/req', (msg) => {\n log('debug', 'Signature request sent', msg);\n });\n node.on('/sign/sender/res', (...msgs) => {\n log('debug', 'Signature responses received', msgs);\n });\n node.on('/sign/sender/rej', (reason, pkg) => {\n log('warn', 'Signature request rejected', { reason, package: pkg });\n });\n node.on('/sign/sender/ret', (reason, msgs) => {\n log('info', 'Signature shares aggregated', { reason, signatures: msgs });\n });\n node.on('/sign/sender/err', (reason, msgs) => {\n log('error', 'Signature share aggregation failed', { reason, messages: msgs });\n });\n node.on('/sign/handler/req', (msg) => {\n log('debug', 'Signature request received', msg);\n });\n node.on('/sign/handler/res', (msg) => {\n log('debug', 'Signature response sent', msg);\n });\n node.on('/sign/handler/rej', (reason, msg) => {\n log('warn', 'Signature rejection sent', { reason, message: msg });\n });\n // Ping events\n node.on('/ping/handler/req', (msg) => {\n log('debug', 'Ping request received', msg);\n });\n node.on('/ping/handler/res', (msg) => {\n log('debug', 'Ping response sent', msg);\n });\n node.on('/ping/handler/rej', (reason, msg) => {\n log('warn', 'Ping rejection sent', { reason, message: msg });\n });\n node.on('/ping/handler/ret', (reason, data) => {\n log('info', 'Ping handler returned', { reason, data });\n });\n node.on('/ping/sender/req', (msg) => {\n log('debug', 'Ping request sent', msg);\n });\n node.on('/ping/sender/res', (msg) => {\n log('debug', 'Ping response received', msg);\n });\n node.on('/ping/sender/rej', (reason, msg) => {\n log('warn', 'Ping request rejected', { reason, message: msg });\n });\n node.on('/ping/sender/ret', (config) => {\n log('info', 'Ping sender returned peer config', config);\n });\n node.on('/ping/sender/err', (reason, msg) => {\n log('error', 'Ping sender error', { reason, message: msg });\n });\n // Echo events\n node.on('/echo/handler/req', (msg) => {\n log('debug', 'Echo request received', msg);\n });\n node.on('/echo/handler/res', (msg) => {\n log('debug', 'Echo response sent', msg);\n });\n node.on('/echo/handler/rej', (reason, msg) => {\n log('warn', 'Echo rejection sent', { reason, message: msg });\n });\n node.on('/echo/sender/req', (msg) => {\n log('debug', 'Echo request sent', msg);\n });\n node.on('/echo/sender/res', (msg) => {\n log('debug', 'Echo response received', msg);\n });\n node.on('/echo/sender/rej', (reason, msg) => {\n log('warn', 'Echo request rejected', { reason, message: msg });\n });\n node.on('/echo/sender/ret', (reason) => {\n log('info', 'Echo sender returned', { reason });\n });\n node.on('/echo/sender/err', (reason, msg) => {\n log('error', 'Echo sender error', { reason, message: msg });\n });\n}\n/**\n * Safely connects a BifrostNode with error handling\n */\nexport async function connectNode(node) {\n const nodeAsAny = node;\n const client = nodeAsAny?.client;\n if (client && typeof client.connect === 'function') {\n // Work around upstream bug where BifrostNode.connect drops the promise\n // returned by client.connect(), causing unhandled rejections when the\n // handshake fails. Capture that promise so we can await (and surface) it.\n const originalConnect = client.connect;\n const hadOwnConnect = Object.prototype.hasOwnProperty.call(client, 'connect');\n let connectPromise;\n client.connect = (...args) => {\n const result = originalConnect.apply(client, args);\n if (result && typeof result.then === 'function') {\n connectPromise = Promise.resolve(result).catch((error) => {\n throw error;\n });\n return connectPromise;\n }\n connectPromise = undefined;\n return result;\n };\n try {\n await node.connect();\n if (connectPromise) {\n await connectPromise;\n }\n return;\n }\n catch (error) {\n throw new NodeError(`Failed to connect BifrostNode: ${error?.message ?? error}`, { error });\n }\n finally {\n if (hadOwnConnect) {\n client.connect = originalConnect;\n }\n else {\n delete client.connect;\n }\n }\n }\n try {\n await node.connect();\n }\n catch (error) {\n throw new NodeError(`Failed to connect BifrostNode: ${error?.message ?? error}`, { error });\n }\n}\n/**\n * Safely closes a BifrostNode with cleanup\n */\nexport function closeNode(node) {\n const nodeAsAny = node;\n const client = nodeAsAny?.client;\n const emitCloseError = (error) => {\n if (error instanceof Error && error.message === 'relay connection closed by us') {\n // Expected during normal shutdown; swallow to avoid noisy logs.\n return;\n }\n const normalized = error instanceof NodeError\n ? error\n : new NodeError(`Failed to close BifrostNode: ${error instanceof Error ? error.message : String(error)}`, { error });\n if (typeof nodeAsAny?.emit === 'function') {\n nodeAsAny.emit('error', normalized);\n }\n console.warn('[closeNode] Error while closing BifrostNode:', normalized);\n };\n const attachErrorHandler = (maybePromise) => {\n if (maybePromise && typeof maybePromise.catch === 'function') {\n maybePromise.catch(emitCloseError);\n }\n };\n if (client && typeof client.close === 'function') {\n const originalClose = client.close;\n const hadOwnClose = Object.prototype.hasOwnProperty.call(client, 'close');\n const restoreClientClose = () => {\n if (hadOwnClose) {\n client.close = originalClose;\n }\n else {\n delete client.close;\n }\n };\n client.close = (...args) => {\n try {\n const result = originalClose.apply(client, args);\n if (result && typeof result.finally === 'function') {\n result\n .catch(emitCloseError)\n .finally(restoreClientClose);\n }\n else {\n restoreClientClose();\n }\n return result;\n }\n catch (error) {\n restoreClientClose();\n throw error;\n }\n };\n try {\n attachErrorHandler(node.close());\n }\n catch (error) {\n restoreClientClose();\n throw new NodeError(`Failed to close BifrostNode: ${error?.message ?? error}`, { error });\n }\n return;\n }\n try {\n attachErrorHandler(node.close());\n }\n catch (error) {\n throw new NodeError(`Failed to close BifrostNode: ${error?.message ?? error}`, { error });\n }\n}\n/**\n * Creates a BifrostNode and connects it\n */\nexport async function createAndConnectNode(config, eventConfig) {\n const node = createBifrostNode(config, eventConfig);\n await connectNode(node);\n return node;\n}\n/**\n * Enhanced node creation with state information\n * Returns both the node and its current state for better control\n *\n * @param config - Enhanced configuration including timeout and auto-reconnect options\n * @param eventConfig - Optional event configuration for logging and custom handlers\n * @returns Promise resolving to both the connected node and its state information\n *\n * @example\n * ```typescript\n * const { node, state } = await createConnectedNode({\n * group: 'bfgroup1...',\n * share: 'bfshare1...',\n * relays: ['wss://relay.damus.io'],\n * connectionTimeout: 5000,\n * autoReconnect: true\n * });\n *\n * console.log('Node ready:', state.isReady);\n * console.log('Connected relays:', state.connectedRelays);\n * ```\n */\nexport async function createConnectedNode(config, eventConfig) {\n const node = createBifrostNode(config, eventConfig);\n const state = {\n isReady: false,\n isConnected: false,\n isConnecting: true,\n connectedRelays: []\n };\n try {\n await connectNode(node);\n // Node is ready immediately after successful connection\n state.isReady = true;\n state.isConnected = true;\n state.isConnecting = false;\n state.connectedRelays = [...config.relays];\n return { node, state };\n }\n catch (error) {\n state.isConnecting = false;\n state.lastError = error instanceof Error ? error.message : 'Unknown error';\n throw error;\n }\n}\n/**\n * Check if a BifrostNode is ready synchronously\n * This helper works around the race condition with ready events\n *\n * @param node - The BifrostNode to check\n * @returns true if the node is ready and connected, false otherwise\n *\n * @example\n * ```typescript\n * const node = await createAndConnectNode(config);\n *\n * // Safe synchronous check - no race conditions\n * if (isNodeReady(node)) {\n * console.log('Node is ready for operations');\n * }\n * ```\n */\nexport function isNodeReady(node) {\n try {\n // Check if the node has a client and if it's connected\n return !!node.client && !!node.client.connected;\n }\n catch {\n return false;\n }\n}\n/**\n * Comprehensive cleanup for BifrostNode\n * Removes all event listeners and safely disconnects the node\n *\n * Note: Since we don't have access to the original listener functions,\n * this function uses removeAllListeners to clear all event handlers.\n * For more precise cleanup, store listener references when setting them up.\n */\nexport function cleanupBifrostNode(node) {\n if (!node)\n return;\n try {\n // Use removeAllListeners if available (common in EventEmitter implementations)\n const nodeAsAny = node;\n if (typeof nodeAsAny.removeAllListeners === 'function') {\n nodeAsAny.removeAllListeners();\n }\n else {\n // If removeAllListeners is not available, try to clear listeners individually\n // This is a fallback that may not work with all implementations\n console.warn('removeAllListeners not available - manual cleanup may be incomplete');\n }\n // Safely close the connection\n try {\n node.close();\n }\n catch (closeError) {\n console.warn('Warning: Error during node.close():', closeError);\n }\n }\n catch (error) {\n console.warn('Warning: Error during node cleanup:', error);\n }\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAMA,SAAgB,kBAAkB,QAAQ,cAAc,EAAE,EAAE;AACxD,KAAI;EACA,MAAM,kBAAkBA,+BAAiB,MAAM,OAAO;EACtD,MAAM,eAAeC,8BAAe,MAAM,OAAO,gBAAgB,MAAM;EACvE,MAAM,eAAeA,8BAAe,MAAM,OAAO,gBAAgB,MAAM;EACvE,MAAM,EAAE,aAAa,uBAAuBC,mCAAoB,gBAAgB,SAAS;EACzF,MAAM,cAAc,YAAY,SAAS,EAAE,UAAU,aAAa,GAAG;EACrE,MAAM,OAAO,cACP,IAAIC,2BAAY,cAAc,cAAc,gBAAgB,QAAQ,YAAY,GAChF,IAAIA,2BAAY,cAAc,cAAc,gBAAgB,OAAO;AAEzE,kBAAgB,MAAM,YAAY;AAClC,MAAI,mBAAmB,OACnB,2CAA2B,MAAM,mBAAmB;AAExD,SAAO;UAEJ,OAAO;AACV,QAAM,IAAIC,wBAAU,iCAAiC,MAAM,WAAW;GAAE;GAAQ;GAAO,CAAC;;;;;;AAMhG,SAAgB,gBAAgB,MAAM,SAAS,EAAE,EAAE;CAC/C,MAAM,EAAE,gBAAgB,MAAM,WAAW,QAAQ,iBAAiB;CAClE,MAAM,OAAO,OAAO,SAAS,SAAS;AAClC,MAAI,CAAC,cACD;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