@dxos/client-services 0.5.9-main.4ed8273 → 0.5.9-main.72c50cd
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/lib/browser/{chunk-YJ5SPRLY.mjs → chunk-G25WUL6O.mjs} +589 -731
- package/dist/lib/browser/chunk-G25WUL6O.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +9 -10
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-RQHBQWKH.cjs → chunk-FTGPY2GQ.cjs} +809 -947
- package/dist/lib/node/chunk-FTGPY2GQ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +42 -42
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +15 -16
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts +7 -14
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +1 -4
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +3 -5
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +6 -8
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/identity-service.test.ts +5 -35
- package/src/packlets/identity/identity-service.ts +8 -50
- package/src/packlets/identity/identity.ts +2 -25
- package/src/packlets/services/service-host.ts +40 -13
- package/src/packlets/spaces/data-space-manager.test.ts +1 -46
- package/src/packlets/spaces/data-space-manager.ts +25 -54
- package/src/packlets/spaces/data-space.ts +5 -10
- package/src/packlets/testing/test-builder.ts +6 -11
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-YJ5SPRLY.mjs.map +0 -7
- package/dist/lib/node/chunk-RQHBQWKH.cjs.map +0 -7
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
- package/src/packlets/identity/default-space-state-machine.ts +0 -44
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_FTGPY2GQ_exports = {};
|
|
30
|
+
__export(chunk_FTGPY2GQ_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -67,7 +67,7 @@ __export(chunk_RQHBQWKH_exports, {
|
|
|
67
67
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
68
68
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
69
69
|
});
|
|
70
|
-
module.exports = __toCommonJS(
|
|
70
|
+
module.exports = __toCommonJS(chunk_FTGPY2GQ_exports);
|
|
71
71
|
var import_async = require("@dxos/async");
|
|
72
72
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
73
73
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -107,206 +107,200 @@ var import_invariant2 = require("@dxos/invariant");
|
|
|
107
107
|
var import_keys3 = require("@dxos/keys");
|
|
108
108
|
var import_log2 = require("@dxos/log");
|
|
109
109
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
110
|
-
var import_timeframe = require("@dxos/timeframe");
|
|
111
110
|
var import_tracing3 = require("@dxos/tracing");
|
|
112
111
|
var import_util2 = require("@dxos/util");
|
|
113
|
-
var import_credentials5 = require("@dxos/credentials");
|
|
114
|
-
var import_keys4 = require("@dxos/keys");
|
|
115
|
-
var import_log3 = require("@dxos/log");
|
|
116
112
|
var import_platform = __toESM(require("platform"));
|
|
117
113
|
var import_async7 = require("@dxos/async");
|
|
118
114
|
var import_context3 = require("@dxos/context");
|
|
119
|
-
var
|
|
115
|
+
var import_credentials5 = require("@dxos/credentials");
|
|
120
116
|
var import_invariant3 = require("@dxos/invariant");
|
|
121
|
-
var
|
|
122
|
-
var
|
|
117
|
+
var import_keys4 = require("@dxos/keys");
|
|
118
|
+
var import_log3 = require("@dxos/log");
|
|
123
119
|
var import_protocols3 = require("@dxos/protocols");
|
|
124
120
|
var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
125
|
-
var
|
|
121
|
+
var import_credentials6 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
126
122
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
127
|
-
var
|
|
123
|
+
var import_timeframe = require("@dxos/timeframe");
|
|
128
124
|
var import_tracing4 = require("@dxos/tracing");
|
|
129
125
|
var import_util3 = require("@dxos/util");
|
|
130
126
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
131
|
-
var
|
|
132
|
-
var import_credentials8 = require("@dxos/credentials");
|
|
127
|
+
var import_credentials7 = require("@dxos/credentials");
|
|
133
128
|
var import_debug2 = require("@dxos/debug");
|
|
134
129
|
var import_invariant4 = require("@dxos/invariant");
|
|
135
|
-
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
136
130
|
var import_invariant5 = require("@dxos/invariant");
|
|
137
131
|
var import_protocols4 = require("@dxos/protocols");
|
|
138
|
-
var
|
|
132
|
+
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
139
133
|
var import_async8 = require("@dxos/async");
|
|
140
134
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
141
|
-
var
|
|
135
|
+
var import_context4 = require("@dxos/context");
|
|
142
136
|
var import_crypto = require("@dxos/crypto");
|
|
143
137
|
var import_invariant6 = require("@dxos/invariant");
|
|
144
|
-
var
|
|
145
|
-
var
|
|
138
|
+
var import_keys5 = require("@dxos/keys");
|
|
139
|
+
var import_log4 = require("@dxos/log");
|
|
146
140
|
var import_network_manager = require("@dxos/network-manager");
|
|
147
141
|
var import_protocols5 = require("@dxos/protocols");
|
|
148
|
-
var
|
|
142
|
+
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
149
143
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
150
144
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
151
145
|
var import_util4 = require("@dxos/util");
|
|
152
146
|
var import_async9 = require("@dxos/async");
|
|
153
|
-
var
|
|
147
|
+
var import_context5 = require("@dxos/context");
|
|
154
148
|
var import_invariant7 = require("@dxos/invariant");
|
|
155
|
-
var
|
|
149
|
+
var import_log5 = require("@dxos/log");
|
|
156
150
|
var import_protocols6 = require("@dxos/protocols");
|
|
157
151
|
var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
158
152
|
var import_teleport = require("@dxos/teleport");
|
|
159
|
-
var
|
|
160
|
-
var
|
|
153
|
+
var import_context6 = require("@dxos/context");
|
|
154
|
+
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
161
155
|
var import_async10 = require("@dxos/async");
|
|
162
|
-
var
|
|
156
|
+
var import_context7 = require("@dxos/context");
|
|
163
157
|
var import_crypto2 = require("@dxos/crypto");
|
|
164
158
|
var import_invariant8 = require("@dxos/invariant");
|
|
165
|
-
var
|
|
166
|
-
var
|
|
159
|
+
var import_keys6 = require("@dxos/keys");
|
|
160
|
+
var import_log6 = require("@dxos/log");
|
|
167
161
|
var import_protocols7 = require("@dxos/protocols");
|
|
168
|
-
var
|
|
162
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
169
163
|
var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
170
164
|
var import_teleport2 = require("@dxos/teleport");
|
|
171
165
|
var import_invariant9 = require("@dxos/invariant");
|
|
172
|
-
var
|
|
173
|
-
var
|
|
166
|
+
var import_keys7 = require("@dxos/keys");
|
|
167
|
+
var import_log7 = require("@dxos/log");
|
|
174
168
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
175
169
|
var import_util5 = require("@dxos/util");
|
|
176
170
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
177
|
-
var
|
|
178
|
-
var
|
|
171
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
172
|
+
var import_credentials8 = require("@dxos/credentials");
|
|
179
173
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
180
174
|
var import_invariant10 = require("@dxos/invariant");
|
|
181
|
-
var
|
|
175
|
+
var import_log8 = require("@dxos/log");
|
|
182
176
|
var import_protocols8 = require("@dxos/protocols");
|
|
183
|
-
var
|
|
184
|
-
var
|
|
177
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
178
|
+
var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
185
179
|
var import_async11 = require("@dxos/async");
|
|
186
180
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
187
|
-
var
|
|
188
|
-
var
|
|
181
|
+
var import_context8 = require("@dxos/context");
|
|
182
|
+
var import_credentials10 = require("@dxos/credentials");
|
|
189
183
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
190
184
|
var import_invariant11 = require("@dxos/invariant");
|
|
191
|
-
var
|
|
192
|
-
var
|
|
193
|
-
var
|
|
194
|
-
var
|
|
185
|
+
var import_keys8 = require("@dxos/keys");
|
|
186
|
+
var import_log9 = require("@dxos/log");
|
|
187
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
188
|
+
var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
195
189
|
var import_async12 = require("@dxos/async");
|
|
196
190
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
197
|
-
var
|
|
191
|
+
var import_context9 = require("@dxos/context");
|
|
198
192
|
var import_debug3 = require("@dxos/debug");
|
|
199
193
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
200
194
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
201
195
|
var import_invariant12 = require("@dxos/invariant");
|
|
202
|
-
var
|
|
203
|
-
var
|
|
196
|
+
var import_keys9 = require("@dxos/keys");
|
|
197
|
+
var import_log10 = require("@dxos/log");
|
|
204
198
|
var import_protocols9 = require("@dxos/protocols");
|
|
205
|
-
var
|
|
206
|
-
var
|
|
207
|
-
var
|
|
199
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
200
|
+
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
201
|
+
var import_timeframe2 = require("@dxos/timeframe");
|
|
208
202
|
var import_tracing5 = require("@dxos/tracing");
|
|
209
203
|
var import_util6 = require("@dxos/util");
|
|
210
204
|
var import_async13 = require("@dxos/async");
|
|
211
|
-
var
|
|
205
|
+
var import_credentials13 = require("@dxos/credentials");
|
|
212
206
|
var import_async14 = require("@dxos/async");
|
|
213
|
-
var
|
|
207
|
+
var import_context10 = require("@dxos/context");
|
|
214
208
|
var import_invariant13 = require("@dxos/invariant");
|
|
215
|
-
var
|
|
216
|
-
var
|
|
209
|
+
var import_keys10 = require("@dxos/keys");
|
|
210
|
+
var import_log11 = require("@dxos/log");
|
|
217
211
|
var import_protocols10 = require("@dxos/protocols");
|
|
218
212
|
var import_teleport3 = require("@dxos/teleport");
|
|
219
213
|
var import_util7 = require("@dxos/util");
|
|
220
214
|
var import_async15 = require("@dxos/async");
|
|
221
|
-
var
|
|
222
|
-
var
|
|
223
|
-
var import_credentials15 = require("@dxos/credentials");
|
|
215
|
+
var import_context11 = require("@dxos/context");
|
|
216
|
+
var import_credentials14 = require("@dxos/credentials");
|
|
224
217
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
225
|
-
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
226
|
-
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
227
218
|
var import_invariant14 = require("@dxos/invariant");
|
|
228
|
-
var
|
|
229
|
-
var
|
|
219
|
+
var import_keys11 = require("@dxos/keys");
|
|
220
|
+
var import_log12 = require("@dxos/log");
|
|
230
221
|
var import_protocols11 = require("@dxos/protocols");
|
|
231
|
-
var
|
|
232
|
-
var
|
|
222
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
223
|
+
var import_credentials15 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
233
224
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
234
225
|
var import_tracing6 = require("@dxos/tracing");
|
|
235
226
|
var import_util8 = require("@dxos/util");
|
|
236
|
-
var
|
|
227
|
+
var import_credentials16 = require("@dxos/credentials");
|
|
237
228
|
var import_debug4 = require("@dxos/debug");
|
|
238
|
-
var
|
|
239
|
-
var
|
|
229
|
+
var import_credentials17 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
230
|
+
var import_timeframe3 = require("@dxos/timeframe");
|
|
240
231
|
var import_async16 = require("@dxos/async");
|
|
241
232
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
242
|
-
var
|
|
233
|
+
var import_credentials18 = require("@dxos/credentials");
|
|
243
234
|
var import_debug5 = require("@dxos/debug");
|
|
244
235
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
245
236
|
var import_invariant15 = require("@dxos/invariant");
|
|
246
|
-
var
|
|
237
|
+
var import_log13 = require("@dxos/log");
|
|
247
238
|
var import_protocols12 = require("@dxos/protocols");
|
|
248
|
-
var
|
|
239
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
249
240
|
var import_tracing7 = require("@dxos/tracing");
|
|
250
241
|
var import_async17 = require("@dxos/async");
|
|
251
|
-
var
|
|
252
|
-
var
|
|
242
|
+
var import_context12 = require("@dxos/context");
|
|
243
|
+
var import_credentials19 = require("@dxos/credentials");
|
|
253
244
|
var import_debug6 = require("@dxos/debug");
|
|
254
245
|
var import_echo_db = require("@dxos/echo-db");
|
|
255
246
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
256
247
|
var import_feed_store5 = require("@dxos/feed-store");
|
|
257
248
|
var import_invariant16 = require("@dxos/invariant");
|
|
258
249
|
var import_keyring = require("@dxos/keyring");
|
|
259
|
-
var
|
|
260
|
-
var
|
|
250
|
+
var import_keys12 = require("@dxos/keys");
|
|
251
|
+
var import_log14 = require("@dxos/log");
|
|
261
252
|
var import_protocols13 = require("@dxos/protocols");
|
|
262
|
-
var
|
|
253
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
263
254
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
264
255
|
var import_tracing8 = require("@dxos/tracing");
|
|
265
256
|
var import_util9 = require("@dxos/util");
|
|
266
257
|
var import_invariant17 = require("@dxos/invariant");
|
|
267
258
|
var import_lock_file = require("@dxos/lock-file");
|
|
268
|
-
var
|
|
259
|
+
var import_log15 = require("@dxos/log");
|
|
269
260
|
var import_protocols14 = require("@dxos/protocols");
|
|
270
261
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
271
262
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
272
|
-
var
|
|
263
|
+
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
273
264
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
274
265
|
var import_util10 = require("@dxos/util");
|
|
275
266
|
var import_node_path = __toESM(require("node:path"));
|
|
276
|
-
var
|
|
267
|
+
var import_keys13 = require("@dxos/keys");
|
|
277
268
|
var import_kv_store = require("@dxos/kv-store");
|
|
278
269
|
var import_async18 = require("@dxos/async");
|
|
279
|
-
var
|
|
280
|
-
var
|
|
270
|
+
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
271
|
+
var import_context13 = require("@dxos/context");
|
|
272
|
+
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
273
|
+
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
281
274
|
var import_invariant18 = require("@dxos/invariant");
|
|
282
|
-
var
|
|
283
|
-
var
|
|
275
|
+
var import_keys14 = require("@dxos/keys");
|
|
276
|
+
var import_log16 = require("@dxos/log");
|
|
284
277
|
var import_messaging = require("@dxos/messaging");
|
|
285
278
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
286
279
|
var import_protocols15 = require("@dxos/protocols");
|
|
287
|
-
var
|
|
280
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
288
281
|
var import_tracing9 = require("@dxos/tracing");
|
|
282
|
+
var import_util11 = require("@dxos/util");
|
|
289
283
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
290
284
|
var import_async19 = require("@dxos/async");
|
|
291
285
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
292
286
|
var import_invariant19 = require("@dxos/invariant");
|
|
293
|
-
var
|
|
287
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
294
288
|
var import_config3 = require("@dxos/config");
|
|
295
|
-
var
|
|
289
|
+
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
296
290
|
var import_tracing10 = require("@dxos/tracing");
|
|
297
|
-
var import_util11 = require("@dxos/util");
|
|
298
|
-
var import_keys16 = require("@dxos/keys");
|
|
299
291
|
var import_util12 = require("@dxos/util");
|
|
292
|
+
var import_keys15 = require("@dxos/keys");
|
|
293
|
+
var import_util13 = require("@dxos/util");
|
|
300
294
|
var import_async20 = require("@dxos/async");
|
|
301
295
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
302
|
-
var
|
|
303
|
-
var
|
|
304
|
-
var
|
|
305
|
-
var
|
|
296
|
+
var import_keys16 = require("@dxos/keys");
|
|
297
|
+
var import_log17 = require("@dxos/log");
|
|
298
|
+
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
299
|
+
var import_util14 = require("@dxos/util");
|
|
306
300
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
307
301
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
308
|
-
var
|
|
309
|
-
var
|
|
302
|
+
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
303
|
+
var import_util15 = require("@dxos/util");
|
|
310
304
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
311
305
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
312
306
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -617,7 +611,7 @@ var DevtoolsServiceImpl = class {
|
|
|
617
611
|
});
|
|
618
612
|
}
|
|
619
613
|
};
|
|
620
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
614
|
+
var DXOS_VERSION = "0.5.9-main.72c50cd";
|
|
621
615
|
var getPlatform = () => {
|
|
622
616
|
if (process.browser) {
|
|
623
617
|
if (typeof window !== "undefined") {
|
|
@@ -959,47 +953,6 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
959
953
|
return deviceSet.has(deviceKey);
|
|
960
954
|
}
|
|
961
955
|
};
|
|
962
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
963
|
-
var DefaultSpaceStateMachine = class {
|
|
964
|
-
constructor(_params) {
|
|
965
|
-
this._params = _params;
|
|
966
|
-
}
|
|
967
|
-
get spaceId() {
|
|
968
|
-
return this._spaceId;
|
|
969
|
-
}
|
|
970
|
-
async processCredential(credential) {
|
|
971
|
-
const assertion = (0, import_credentials5.getCredentialAssertion)(credential);
|
|
972
|
-
switch (assertion["@type"]) {
|
|
973
|
-
case "dxos.halo.credentials.DefaultSpace": {
|
|
974
|
-
if (!credential.subject.id.equals(this._params.identityKey)) {
|
|
975
|
-
import_log3.log.warn("Invalid default space credential", {
|
|
976
|
-
expectedIdentity: this._params.identityKey,
|
|
977
|
-
credential
|
|
978
|
-
}, {
|
|
979
|
-
F: __dxlog_file3,
|
|
980
|
-
L: 32,
|
|
981
|
-
S: this,
|
|
982
|
-
C: (f, a) => f(...a)
|
|
983
|
-
});
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
|
-
if (!import_keys4.SpaceId.isValid(assertion.spaceId)) {
|
|
987
|
-
import_log3.log.warn("Invalid default space id", {
|
|
988
|
-
id: assertion.spaceId
|
|
989
|
-
}, {
|
|
990
|
-
F: __dxlog_file3,
|
|
991
|
-
L: 36,
|
|
992
|
-
S: this,
|
|
993
|
-
C: (f, a) => f(...a)
|
|
994
|
-
});
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
this._spaceId = assertion.spaceId;
|
|
998
|
-
break;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
956
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
1004
957
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1005
958
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1010,7 +963,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1010
963
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1011
964
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1012
965
|
}
|
|
1013
|
-
var
|
|
966
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
1014
967
|
var Identity = class {
|
|
1015
968
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
1016
969
|
this.stateUpdate = new import_async6.Event();
|
|
@@ -1022,8 +975,8 @@ var Identity = class {
|
|
|
1022
975
|
import_log2.log.trace("dxos.halo.device", {
|
|
1023
976
|
deviceKey
|
|
1024
977
|
}, {
|
|
1025
|
-
F:
|
|
1026
|
-
L:
|
|
978
|
+
F: __dxlog_file3,
|
|
979
|
+
L: 67,
|
|
1027
980
|
S: this,
|
|
1028
981
|
C: (f, a) => f(...a)
|
|
1029
982
|
});
|
|
@@ -1036,10 +989,6 @@ var Identity = class {
|
|
|
1036
989
|
identityKey: this.identityKey,
|
|
1037
990
|
onUpdate: () => this.stateUpdate.emit()
|
|
1038
991
|
});
|
|
1039
|
-
this._defaultSpaceStateMachine = new DefaultSpaceStateMachine({
|
|
1040
|
-
identityKey: this.identityKey,
|
|
1041
|
-
onUpdate: () => this.stateUpdate.emit()
|
|
1042
|
-
});
|
|
1043
992
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
1044
993
|
trustedKeysProvider: () => new import_util2.ComplexSet(import_keys3.PublicKey.hash, this.authorizedDeviceKeys.keys()),
|
|
1045
994
|
update: this.stateUpdate,
|
|
@@ -1050,20 +999,14 @@ var Identity = class {
|
|
|
1050
999
|
get authorizedDeviceKeys() {
|
|
1051
1000
|
return this._deviceStateMachine.authorizedDeviceKeys;
|
|
1052
1001
|
}
|
|
1053
|
-
get defaultSpaceId() {
|
|
1054
|
-
return this._defaultSpaceStateMachine.spaceId;
|
|
1055
|
-
}
|
|
1056
1002
|
async open(ctx) {
|
|
1057
|
-
await this._presence?.open();
|
|
1058
1003
|
await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
|
|
1059
1004
|
await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
|
|
1060
|
-
await this.space.spaceState.addCredentialProcessor(this._defaultSpaceStateMachine);
|
|
1061
1005
|
await this.space.open(ctx);
|
|
1062
1006
|
}
|
|
1063
1007
|
async close(ctx) {
|
|
1064
|
-
await this._presence?.
|
|
1008
|
+
await this._presence?.destroy();
|
|
1065
1009
|
await this.authVerifier.close();
|
|
1066
|
-
await this.space.spaceState.removeCredentialProcessor(this._defaultSpaceStateMachine);
|
|
1067
1010
|
await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
|
|
1068
1011
|
await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
|
|
1069
1012
|
await this.space.close();
|
|
@@ -1101,8 +1044,8 @@ var Identity = class {
|
|
|
1101
1044
|
*/
|
|
1102
1045
|
getIdentityCredentialSigner() {
|
|
1103
1046
|
(0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
1104
|
-
F:
|
|
1105
|
-
L:
|
|
1047
|
+
F: __dxlog_file3,
|
|
1048
|
+
L: 145,
|
|
1106
1049
|
S: this,
|
|
1107
1050
|
A: [
|
|
1108
1051
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -1117,26 +1060,6 @@ var Identity = class {
|
|
|
1117
1060
|
getDeviceCredentialSigner() {
|
|
1118
1061
|
return (0, import_credentials3.createCredentialSignerWithKey)(this._signer, this.deviceKey);
|
|
1119
1062
|
}
|
|
1120
|
-
async updateDefaultSpace(spaceId) {
|
|
1121
|
-
const credential = await this.getDeviceCredentialSigner().createCredential({
|
|
1122
|
-
subject: this.identityKey,
|
|
1123
|
-
assertion: {
|
|
1124
|
-
"@type": "dxos.halo.credentials.DefaultSpace",
|
|
1125
|
-
spaceId
|
|
1126
|
-
}
|
|
1127
|
-
});
|
|
1128
|
-
const receipt = await this.controlPipeline.writer.write({
|
|
1129
|
-
credential: {
|
|
1130
|
-
credential
|
|
1131
|
-
}
|
|
1132
|
-
});
|
|
1133
|
-
await this.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
1134
|
-
[
|
|
1135
|
-
receipt.feedKey,
|
|
1136
|
-
receipt.seq
|
|
1137
|
-
]
|
|
1138
|
-
]));
|
|
1139
|
-
}
|
|
1140
1063
|
async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
|
|
1141
1064
|
(0, import_log2.log)("Admitting device:", {
|
|
1142
1065
|
identityKey: this.identityKey,
|
|
@@ -1145,8 +1068,8 @@ var Identity = class {
|
|
|
1145
1068
|
controlFeedKey,
|
|
1146
1069
|
dataFeedKey
|
|
1147
1070
|
}, {
|
|
1148
|
-
F:
|
|
1149
|
-
L:
|
|
1071
|
+
F: __dxlog_file3,
|
|
1072
|
+
L: 161,
|
|
1150
1073
|
S: this,
|
|
1151
1074
|
C: (f, a) => f(...a)
|
|
1152
1075
|
});
|
|
@@ -1206,7 +1129,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1206
1129
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1207
1130
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1208
1131
|
}
|
|
1209
|
-
var
|
|
1132
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1210
1133
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1211
1134
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1212
1135
|
var IdentityManager = class {
|
|
@@ -1226,20 +1149,20 @@ var IdentityManager = class {
|
|
|
1226
1149
|
return this._identity;
|
|
1227
1150
|
}
|
|
1228
1151
|
async open(ctx) {
|
|
1229
|
-
const traceId =
|
|
1230
|
-
|
|
1152
|
+
const traceId = import_keys4.PublicKey.random().toHex();
|
|
1153
|
+
import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
|
|
1231
1154
|
id: traceId
|
|
1232
1155
|
}), {
|
|
1233
|
-
F:
|
|
1156
|
+
F: __dxlog_file4,
|
|
1234
1157
|
L: 104,
|
|
1235
1158
|
S: this,
|
|
1236
1159
|
C: (f, a) => f(...a)
|
|
1237
1160
|
});
|
|
1238
1161
|
const identityRecord = this._metadataStore.getIdentityRecord();
|
|
1239
|
-
(0,
|
|
1162
|
+
(0, import_log3.log)("identity record", {
|
|
1240
1163
|
identityRecord
|
|
1241
1164
|
}, {
|
|
1242
|
-
F:
|
|
1165
|
+
F: __dxlog_file4,
|
|
1243
1166
|
L: 107,
|
|
1244
1167
|
S: this,
|
|
1245
1168
|
C: (f, a) => f(...a)
|
|
@@ -1248,21 +1171,21 @@ var IdentityManager = class {
|
|
|
1248
1171
|
this._identity = await this._constructIdentity(identityRecord);
|
|
1249
1172
|
await this._identity.open(ctx);
|
|
1250
1173
|
await this._identity.ready();
|
|
1251
|
-
|
|
1174
|
+
import_log3.log.trace("dxos.halo.identity", {
|
|
1252
1175
|
identityKey: identityRecord.identityKey,
|
|
1253
1176
|
displayName: this._identity.profileDocument?.displayName
|
|
1254
1177
|
}, {
|
|
1255
|
-
F:
|
|
1178
|
+
F: __dxlog_file4,
|
|
1256
1179
|
L: 112,
|
|
1257
1180
|
S: this,
|
|
1258
1181
|
C: (f, a) => f(...a)
|
|
1259
1182
|
});
|
|
1260
1183
|
this.stateUpdate.emit();
|
|
1261
1184
|
}
|
|
1262
|
-
|
|
1185
|
+
import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
|
|
1263
1186
|
id: traceId
|
|
1264
1187
|
}), {
|
|
1265
|
-
F:
|
|
1188
|
+
F: __dxlog_file4,
|
|
1266
1189
|
L: 119,
|
|
1267
1190
|
S: this,
|
|
1268
1191
|
C: (f, a) => f(...a)
|
|
@@ -1273,7 +1196,7 @@ var IdentityManager = class {
|
|
|
1273
1196
|
}
|
|
1274
1197
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1275
1198
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1276
|
-
F:
|
|
1199
|
+
F: __dxlog_file4,
|
|
1277
1200
|
L: 128,
|
|
1278
1201
|
S: this,
|
|
1279
1202
|
A: [
|
|
@@ -1281,8 +1204,8 @@ var IdentityManager = class {
|
|
|
1281
1204
|
"'Identity already exists.'"
|
|
1282
1205
|
]
|
|
1283
1206
|
});
|
|
1284
|
-
(0,
|
|
1285
|
-
F:
|
|
1207
|
+
(0, import_log3.log)("creating identity...", void 0, {
|
|
1208
|
+
F: __dxlog_file4,
|
|
1286
1209
|
L: 129,
|
|
1287
1210
|
S: this,
|
|
1288
1211
|
C: (f, a) => f(...a)
|
|
@@ -1301,9 +1224,9 @@ var IdentityManager = class {
|
|
|
1301
1224
|
const identity = await this._constructIdentity(identityRecord);
|
|
1302
1225
|
await identity.open(new import_context3.Context());
|
|
1303
1226
|
{
|
|
1304
|
-
const generator = new
|
|
1227
|
+
const generator = new import_credentials5.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1305
1228
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1306
|
-
F:
|
|
1229
|
+
F: __dxlog_file4,
|
|
1307
1230
|
L: 148,
|
|
1308
1231
|
S: this,
|
|
1309
1232
|
A: [
|
|
@@ -1312,7 +1235,7 @@ var IdentityManager = class {
|
|
|
1312
1235
|
]
|
|
1313
1236
|
});
|
|
1314
1237
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1315
|
-
F:
|
|
1238
|
+
F: __dxlog_file4,
|
|
1316
1239
|
L: 149,
|
|
1317
1240
|
S: this,
|
|
1318
1241
|
A: [
|
|
@@ -1324,7 +1247,7 @@ var IdentityManager = class {
|
|
|
1324
1247
|
// Space genesis.
|
|
1325
1248
|
...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
|
|
1326
1249
|
// Feed admission.
|
|
1327
|
-
await generator.createFeedAdmission(identityRecord.haloSpace.key, identityRecord.haloSpace.dataFeedKey,
|
|
1250
|
+
await generator.createFeedAdmission(identityRecord.haloSpace.key, identityRecord.haloSpace.dataFeedKey, import_credentials6.AdmittedFeed.Designation.DATA)
|
|
1328
1251
|
];
|
|
1329
1252
|
if (displayName) {
|
|
1330
1253
|
credentials.push(await generator.createProfileCredential({
|
|
@@ -1347,22 +1270,22 @@ var IdentityManager = class {
|
|
|
1347
1270
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1348
1271
|
this._identity = identity;
|
|
1349
1272
|
await this._identity.ready();
|
|
1350
|
-
|
|
1273
|
+
import_log3.log.trace("dxos.halo.identity", {
|
|
1351
1274
|
identityKey: identityRecord.identityKey,
|
|
1352
1275
|
displayName: this._identity.profileDocument?.displayName
|
|
1353
1276
|
}, {
|
|
1354
|
-
F:
|
|
1277
|
+
F: __dxlog_file4,
|
|
1355
1278
|
L: 191,
|
|
1356
1279
|
S: this,
|
|
1357
1280
|
C: (f, a) => f(...a)
|
|
1358
1281
|
});
|
|
1359
1282
|
this.stateUpdate.emit();
|
|
1360
|
-
(0,
|
|
1283
|
+
(0, import_log3.log)("created identity", {
|
|
1361
1284
|
identityKey: identity.identityKey,
|
|
1362
1285
|
deviceKey: identity.deviceKey,
|
|
1363
1286
|
profile: identity.profileDocument
|
|
1364
1287
|
}, {
|
|
1365
|
-
F:
|
|
1288
|
+
F: __dxlog_file4,
|
|
1366
1289
|
L: 197,
|
|
1367
1290
|
S: this,
|
|
1368
1291
|
C: (f, a) => f(...a)
|
|
@@ -1373,14 +1296,14 @@ var IdentityManager = class {
|
|
|
1373
1296
|
createDefaultDeviceProfile() {
|
|
1374
1297
|
let type;
|
|
1375
1298
|
if ((0, import_util3.isNode)()) {
|
|
1376
|
-
type =
|
|
1299
|
+
type = import_credentials6.DeviceType.AGENT;
|
|
1377
1300
|
} else {
|
|
1378
1301
|
if (import_platform.default.name?.startsWith("iOS") || import_platform.default.name?.startsWith("Android")) {
|
|
1379
|
-
type =
|
|
1302
|
+
type = import_credentials6.DeviceType.MOBILE;
|
|
1380
1303
|
} else if (globalThis.__args) {
|
|
1381
|
-
type =
|
|
1304
|
+
type = import_credentials6.DeviceType.NATIVE;
|
|
1382
1305
|
} else {
|
|
1383
|
-
type =
|
|
1306
|
+
type = import_credentials6.DeviceType.BROWSER;
|
|
1384
1307
|
}
|
|
1385
1308
|
}
|
|
1386
1309
|
return {
|
|
@@ -1396,16 +1319,16 @@ var IdentityManager = class {
|
|
|
1396
1319
|
* Accept an existing identity. Expects its device key to be authorized (now or later).
|
|
1397
1320
|
*/
|
|
1398
1321
|
async acceptIdentity(params) {
|
|
1399
|
-
(0,
|
|
1322
|
+
(0, import_log3.log)("accepting identity", {
|
|
1400
1323
|
params
|
|
1401
1324
|
}, {
|
|
1402
|
-
F:
|
|
1325
|
+
F: __dxlog_file4,
|
|
1403
1326
|
L: 235,
|
|
1404
1327
|
S: this,
|
|
1405
1328
|
C: (f, a) => f(...a)
|
|
1406
1329
|
});
|
|
1407
1330
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1408
|
-
F:
|
|
1331
|
+
F: __dxlog_file4,
|
|
1409
1332
|
L: 236,
|
|
1410
1333
|
S: this,
|
|
1411
1334
|
A: [
|
|
@@ -1429,11 +1352,11 @@ var IdentityManager = class {
|
|
|
1429
1352
|
this._identity = identity;
|
|
1430
1353
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1431
1354
|
await this._identity.ready();
|
|
1432
|
-
|
|
1355
|
+
import_log3.log.trace("dxos.halo.identity", {
|
|
1433
1356
|
identityKey: identityRecord.identityKey,
|
|
1434
1357
|
displayName: this._identity.profileDocument?.displayName
|
|
1435
1358
|
}, {
|
|
1436
|
-
F:
|
|
1359
|
+
F: __dxlog_file4,
|
|
1437
1360
|
L: 255,
|
|
1438
1361
|
S: this,
|
|
1439
1362
|
C: (f, a) => f(...a)
|
|
@@ -1443,11 +1366,11 @@ var IdentityManager = class {
|
|
|
1443
1366
|
...params.deviceProfile
|
|
1444
1367
|
});
|
|
1445
1368
|
this.stateUpdate.emit();
|
|
1446
|
-
(0,
|
|
1369
|
+
(0, import_log3.log)("accepted identity", {
|
|
1447
1370
|
identityKey: identity.identityKey,
|
|
1448
1371
|
deviceKey: identity.deviceKey
|
|
1449
1372
|
}, {
|
|
1450
|
-
F:
|
|
1373
|
+
F: __dxlog_file4,
|
|
1451
1374
|
L: 265,
|
|
1452
1375
|
S: this,
|
|
1453
1376
|
C: (f, a) => f(...a)
|
|
@@ -1459,7 +1382,7 @@ var IdentityManager = class {
|
|
|
1459
1382
|
*/
|
|
1460
1383
|
async updateProfile(profile) {
|
|
1461
1384
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1462
|
-
F:
|
|
1385
|
+
F: __dxlog_file4,
|
|
1463
1386
|
L: 273,
|
|
1464
1387
|
S: this,
|
|
1465
1388
|
A: [
|
|
@@ -1479,7 +1402,7 @@ var IdentityManager = class {
|
|
|
1479
1402
|
credential
|
|
1480
1403
|
}
|
|
1481
1404
|
});
|
|
1482
|
-
await this._identity.controlPipeline.state.waitUntilTimeframe(new
|
|
1405
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
1483
1406
|
[
|
|
1484
1407
|
receipt.feedKey,
|
|
1485
1408
|
receipt.seq
|
|
@@ -1490,7 +1413,7 @@ var IdentityManager = class {
|
|
|
1490
1413
|
}
|
|
1491
1414
|
async updateDeviceProfile(profile) {
|
|
1492
1415
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1493
|
-
F:
|
|
1416
|
+
F: __dxlog_file4,
|
|
1494
1417
|
L: 290,
|
|
1495
1418
|
S: this,
|
|
1496
1419
|
A: [
|
|
@@ -1510,7 +1433,7 @@ var IdentityManager = class {
|
|
|
1510
1433
|
credential
|
|
1511
1434
|
}
|
|
1512
1435
|
});
|
|
1513
|
-
await this._identity.controlPipeline.state.waitUntilTimeframe(new
|
|
1436
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
1514
1437
|
[
|
|
1515
1438
|
receipt.feedKey,
|
|
1516
1439
|
receipt.seq
|
|
@@ -1526,7 +1449,7 @@ var IdentityManager = class {
|
|
|
1526
1449
|
}
|
|
1527
1450
|
async _constructIdentity(identityRecord) {
|
|
1528
1451
|
(0, import_invariant3.invariant)(!this._identity, void 0, {
|
|
1529
|
-
F:
|
|
1452
|
+
F: __dxlog_file4,
|
|
1530
1453
|
L: 316,
|
|
1531
1454
|
S: this,
|
|
1532
1455
|
A: [
|
|
@@ -1534,10 +1457,10 @@ var IdentityManager = class {
|
|
|
1534
1457
|
""
|
|
1535
1458
|
]
|
|
1536
1459
|
});
|
|
1537
|
-
(0,
|
|
1460
|
+
(0, import_log3.log)("constructing identity", {
|
|
1538
1461
|
identityRecord
|
|
1539
1462
|
}, {
|
|
1540
|
-
F:
|
|
1463
|
+
F: __dxlog_file4,
|
|
1541
1464
|
L: 317,
|
|
1542
1465
|
S: this,
|
|
1543
1466
|
C: (f, a) => f(...a)
|
|
@@ -1552,7 +1475,7 @@ var IdentityManager = class {
|
|
|
1552
1475
|
gossip
|
|
1553
1476
|
});
|
|
1554
1477
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1555
|
-
F:
|
|
1478
|
+
F: __dxlog_file4,
|
|
1556
1479
|
L: 330,
|
|
1557
1480
|
S: this,
|
|
1558
1481
|
A: [
|
|
@@ -1564,7 +1487,7 @@ var IdentityManager = class {
|
|
|
1564
1487
|
writable: true
|
|
1565
1488
|
});
|
|
1566
1489
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1567
|
-
F:
|
|
1490
|
+
F: __dxlog_file4,
|
|
1568
1491
|
L: 334,
|
|
1569
1492
|
S: this,
|
|
1570
1493
|
A: [
|
|
@@ -1580,7 +1503,7 @@ var IdentityManager = class {
|
|
|
1580
1503
|
spaceRecord: identityRecord.haloSpace,
|
|
1581
1504
|
swarmIdentity: {
|
|
1582
1505
|
peerKey: identityRecord.deviceKey,
|
|
1583
|
-
credentialProvider: createAuthProvider((0,
|
|
1506
|
+
credentialProvider: createAuthProvider((0, import_credentials5.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
|
|
1584
1507
|
credentialAuthenticator: (0, import_util3.deferFunction)(() => identity.authVerifier.verifier)
|
|
1585
1508
|
},
|
|
1586
1509
|
gossip,
|
|
@@ -1595,10 +1518,10 @@ var IdentityManager = class {
|
|
|
1595
1518
|
identityKey: identityRecord.identityKey,
|
|
1596
1519
|
deviceKey: identityRecord.deviceKey
|
|
1597
1520
|
});
|
|
1598
|
-
(0,
|
|
1521
|
+
(0, import_log3.log)("done", {
|
|
1599
1522
|
identityKey: identityRecord.identityKey
|
|
1600
1523
|
}, {
|
|
1601
|
-
F:
|
|
1524
|
+
F: __dxlog_file4,
|
|
1602
1525
|
L: 360,
|
|
1603
1526
|
S: this,
|
|
1604
1527
|
C: (f, a) => f(...a)
|
|
@@ -1622,8 +1545,8 @@ var IdentityManager = class {
|
|
|
1622
1545
|
}));
|
|
1623
1546
|
},
|
|
1624
1547
|
onAuthFailure: () => {
|
|
1625
|
-
|
|
1626
|
-
F:
|
|
1548
|
+
import_log3.log.warn("auth failure", void 0, {
|
|
1549
|
+
F: __dxlog_file4,
|
|
1627
1550
|
L: 385,
|
|
1628
1551
|
S: this,
|
|
1629
1552
|
C: (f, a) => f(...a)
|
|
@@ -1645,45 +1568,21 @@ _ts_decorate3([
|
|
|
1645
1568
|
IdentityManager = _ts_decorate3([
|
|
1646
1569
|
import_tracing4.trace.resource()
|
|
1647
1570
|
], IdentityManager);
|
|
1648
|
-
var
|
|
1649
|
-
var IdentityServiceImpl = class
|
|
1650
|
-
constructor(_identityManager, _keyring,
|
|
1651
|
-
|
|
1571
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1572
|
+
var IdentityServiceImpl = class {
|
|
1573
|
+
constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
|
|
1574
|
+
this._createIdentity = _createIdentity;
|
|
1652
1575
|
this._identityManager = _identityManager;
|
|
1653
1576
|
this._keyring = _keyring;
|
|
1654
|
-
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
1655
|
-
this._createIdentity = _createIdentity;
|
|
1656
1577
|
this._onProfileUpdate = _onProfileUpdate;
|
|
1657
1578
|
}
|
|
1658
|
-
async _open() {
|
|
1659
|
-
const identity = this._identityManager.identity;
|
|
1660
|
-
if (identity && !identity.defaultSpaceId) {
|
|
1661
|
-
await this._fixIdentityWithoutDefaultSpace(identity);
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
1579
|
async createIdentity(request) {
|
|
1665
1580
|
await this._createIdentity({
|
|
1666
1581
|
displayName: request.profile?.displayName,
|
|
1667
1582
|
deviceProfile: request.deviceProfile
|
|
1668
1583
|
});
|
|
1669
|
-
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
1670
|
-
await this._createDefaultSpace(dataSpaceManager);
|
|
1671
1584
|
return this._getIdentity();
|
|
1672
1585
|
}
|
|
1673
|
-
async _createDefaultSpace(dataSpaceManager) {
|
|
1674
|
-
const space = await dataSpaceManager.createDefaultSpace();
|
|
1675
|
-
const identity = this._identityManager.identity;
|
|
1676
|
-
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1677
|
-
F: __dxlog_file6,
|
|
1678
|
-
L: 54,
|
|
1679
|
-
S: this,
|
|
1680
|
-
A: [
|
|
1681
|
-
"identity",
|
|
1682
|
-
""
|
|
1683
|
-
]
|
|
1684
|
-
});
|
|
1685
|
-
await identity.updateDefaultSpace(space.id);
|
|
1686
|
-
}
|
|
1687
1586
|
async recoverIdentity(request) {
|
|
1688
1587
|
return (0, import_debug2.todo)();
|
|
1689
1588
|
}
|
|
@@ -1708,8 +1607,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1708
1607
|
}
|
|
1709
1608
|
async updateProfile(profile) {
|
|
1710
1609
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1711
|
-
F:
|
|
1712
|
-
L:
|
|
1610
|
+
F: __dxlog_file5,
|
|
1611
|
+
L: 61,
|
|
1713
1612
|
S: this,
|
|
1714
1613
|
A: [
|
|
1715
1614
|
"this._identityManager.identity",
|
|
@@ -1722,15 +1621,15 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1722
1621
|
}
|
|
1723
1622
|
async signPresentation({ presentation, nonce }) {
|
|
1724
1623
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1725
|
-
F:
|
|
1726
|
-
L:
|
|
1624
|
+
F: __dxlog_file5,
|
|
1625
|
+
L: 68,
|
|
1727
1626
|
S: this,
|
|
1728
1627
|
A: [
|
|
1729
1628
|
"this._identityManager.identity",
|
|
1730
1629
|
"'Identity not initialized.'"
|
|
1731
1630
|
]
|
|
1732
1631
|
});
|
|
1733
|
-
return await (0,
|
|
1632
|
+
return await (0, import_credentials7.signPresentation)({
|
|
1734
1633
|
presentation,
|
|
1735
1634
|
signer: this._keyring,
|
|
1736
1635
|
signerKey: this._identityManager.identity.deviceKey,
|
|
@@ -1738,26 +1637,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1738
1637
|
nonce
|
|
1739
1638
|
});
|
|
1740
1639
|
}
|
|
1741
|
-
async _fixIdentityWithoutDefaultSpace(identity) {
|
|
1742
|
-
let hasDefaultSpace = false;
|
|
1743
|
-
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
1744
|
-
for (const space of dataSpaceManager.spaces.values()) {
|
|
1745
|
-
if (space.state === import_services4.SpaceState.CLOSED) {
|
|
1746
|
-
await space.open();
|
|
1747
|
-
await space.initializeDataPipeline();
|
|
1748
|
-
}
|
|
1749
|
-
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
1750
|
-
await identity.updateDefaultSpace(space.id);
|
|
1751
|
-
hasDefaultSpace = true;
|
|
1752
|
-
break;
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
if (!hasDefaultSpace) {
|
|
1756
|
-
await this._createDefaultSpace(dataSpaceManager);
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
1640
|
};
|
|
1760
|
-
var
|
|
1641
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1761
1642
|
var DeviceInvitationProtocol = class {
|
|
1762
1643
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1763
1644
|
this._keyring = _keyring;
|
|
@@ -1772,7 +1653,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1772
1653
|
}
|
|
1773
1654
|
getInvitationContext() {
|
|
1774
1655
|
return {
|
|
1775
|
-
kind:
|
|
1656
|
+
kind: import_services4.Invitation.Kind.DEVICE
|
|
1776
1657
|
};
|
|
1777
1658
|
}
|
|
1778
1659
|
async delegate() {
|
|
@@ -1783,7 +1664,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1783
1664
|
}
|
|
1784
1665
|
async admit(_, request) {
|
|
1785
1666
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1786
|
-
F:
|
|
1667
|
+
F: __dxlog_file6,
|
|
1787
1668
|
L: 50,
|
|
1788
1669
|
S: this,
|
|
1789
1670
|
A: [
|
|
@@ -1829,7 +1710,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1829
1710
|
}
|
|
1830
1711
|
async accept(response, request) {
|
|
1831
1712
|
(0, import_invariant5.invariant)(response.device, void 0, {
|
|
1832
|
-
F:
|
|
1713
|
+
F: __dxlog_file6,
|
|
1833
1714
|
L: 95,
|
|
1834
1715
|
S: this,
|
|
1835
1716
|
A: [
|
|
@@ -1839,7 +1720,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1839
1720
|
});
|
|
1840
1721
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1841
1722
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1842
|
-
F:
|
|
1723
|
+
F: __dxlog_file6,
|
|
1843
1724
|
L: 98,
|
|
1844
1725
|
S: this,
|
|
1845
1726
|
A: [
|
|
@@ -1864,21 +1745,21 @@ var DeviceInvitationProtocol = class {
|
|
|
1864
1745
|
}
|
|
1865
1746
|
};
|
|
1866
1747
|
var stateToString = (state) => {
|
|
1867
|
-
return Object.entries(
|
|
1748
|
+
return Object.entries(import_services6.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
1868
1749
|
};
|
|
1869
1750
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
1870
1751
|
let guard;
|
|
1871
|
-
return (0,
|
|
1752
|
+
return (0, import_context6.cancelWithContext)(ctx, (async () => {
|
|
1872
1753
|
guard = await mutex.acquire();
|
|
1873
1754
|
if (ctx.disposed) {
|
|
1874
1755
|
guard.release();
|
|
1875
1756
|
guard = void 0;
|
|
1876
|
-
throw new
|
|
1757
|
+
throw new import_context6.ContextDisposedError();
|
|
1877
1758
|
}
|
|
1878
1759
|
return guard;
|
|
1879
1760
|
})());
|
|
1880
1761
|
};
|
|
1881
|
-
var
|
|
1762
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1882
1763
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1883
1764
|
var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
1884
1765
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1892,7 +1773,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1892
1773
|
});
|
|
1893
1774
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1894
1775
|
this._callbacks = _callbacks;
|
|
1895
|
-
this._ctx = new
|
|
1776
|
+
this._ctx = new import_context5.Context();
|
|
1896
1777
|
this._remoteOptionsTrigger = new import_async9.Trigger();
|
|
1897
1778
|
this._invitationFlowLock = null;
|
|
1898
1779
|
}
|
|
@@ -1904,7 +1785,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1904
1785
|
InvitationHostService: {
|
|
1905
1786
|
options: async (options) => {
|
|
1906
1787
|
(0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1907
|
-
F:
|
|
1788
|
+
F: __dxlog_file7,
|
|
1908
1789
|
L: 63,
|
|
1909
1790
|
S: this,
|
|
1910
1791
|
A: [
|
|
@@ -1930,33 +1811,33 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1930
1811
|
async onOpen(context) {
|
|
1931
1812
|
await super.onOpen(context);
|
|
1932
1813
|
try {
|
|
1933
|
-
(0,
|
|
1934
|
-
F:
|
|
1814
|
+
(0, import_log5.log)("guest acquire lock", void 0, {
|
|
1815
|
+
F: __dxlog_file7,
|
|
1935
1816
|
L: 84,
|
|
1936
1817
|
S: this,
|
|
1937
1818
|
C: (f, a) => f(...a)
|
|
1938
1819
|
});
|
|
1939
1820
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1940
|
-
(0,
|
|
1941
|
-
F:
|
|
1821
|
+
(0, import_log5.log)("guest lock acquired", void 0, {
|
|
1822
|
+
F: __dxlog_file7,
|
|
1942
1823
|
L: 86,
|
|
1943
1824
|
S: this,
|
|
1944
1825
|
C: (f, a) => f(...a)
|
|
1945
1826
|
});
|
|
1946
|
-
await (0,
|
|
1827
|
+
await (0, import_context5.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
1947
1828
|
role: import_invitations3.Options.Role.GUEST
|
|
1948
1829
|
}));
|
|
1949
|
-
(0,
|
|
1950
|
-
F:
|
|
1830
|
+
(0, import_log5.log)("options sent", void 0, {
|
|
1831
|
+
F: __dxlog_file7,
|
|
1951
1832
|
L: 88,
|
|
1952
1833
|
S: this,
|
|
1953
1834
|
C: (f, a) => f(...a)
|
|
1954
1835
|
});
|
|
1955
|
-
await (0,
|
|
1836
|
+
await (0, import_context5.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
1956
1837
|
timeout: OPTIONS_TIMEOUT
|
|
1957
1838
|
}));
|
|
1958
|
-
(0,
|
|
1959
|
-
F:
|
|
1839
|
+
(0, import_log5.log)("options received", void 0, {
|
|
1840
|
+
F: __dxlog_file7,
|
|
1960
1841
|
L: 90,
|
|
1961
1842
|
S: this,
|
|
1962
1843
|
C: (f, a) => f(...a)
|
|
@@ -1989,8 +1870,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1989
1870
|
if (this._invitationFlowLock != null) {
|
|
1990
1871
|
this._invitationFlowLock.release();
|
|
1991
1872
|
this._invitationFlowLock = null;
|
|
1992
|
-
(0,
|
|
1993
|
-
F:
|
|
1873
|
+
(0, import_log5.log)("invitation flow lock released", void 0, {
|
|
1874
|
+
F: __dxlog_file7,
|
|
1994
1875
|
L: 123,
|
|
1995
1876
|
S: this,
|
|
1996
1877
|
C: (f, a) => f(...a)
|
|
@@ -1998,7 +1879,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1998
1879
|
}
|
|
1999
1880
|
}
|
|
2000
1881
|
};
|
|
2001
|
-
var
|
|
1882
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
2002
1883
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
2003
1884
|
var MAX_OTP_ATTEMPTS = 3;
|
|
2004
1885
|
var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
@@ -2013,7 +1894,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2013
1894
|
});
|
|
2014
1895
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2015
1896
|
this._callbacks = _callbacks;
|
|
2016
|
-
this._ctx = new
|
|
1897
|
+
this._ctx = new import_context7.Context();
|
|
2017
1898
|
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
2018
1899
|
this._challenge = void 0;
|
|
2019
1900
|
this.guestProfile = void 0;
|
|
@@ -2032,7 +1913,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2032
1913
|
InvitationHostService: {
|
|
2033
1914
|
options: async (options) => {
|
|
2034
1915
|
(0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
2035
|
-
F:
|
|
1916
|
+
F: __dxlog_file8,
|
|
2036
1917
|
L: 101,
|
|
2037
1918
|
S: this,
|
|
2038
1919
|
A: [
|
|
@@ -2045,23 +1926,23 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2045
1926
|
},
|
|
2046
1927
|
introduce: async (request) => {
|
|
2047
1928
|
const { profile, invitationId } = request;
|
|
2048
|
-
const traceId =
|
|
2049
|
-
|
|
1929
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1930
|
+
import_log6.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
|
|
2050
1931
|
id: traceId
|
|
2051
1932
|
}), {
|
|
2052
|
-
F:
|
|
1933
|
+
F: __dxlog_file8,
|
|
2053
1934
|
L: 110,
|
|
2054
1935
|
S: this,
|
|
2055
1936
|
C: (f, a) => f(...a)
|
|
2056
1937
|
});
|
|
2057
1938
|
const invitation = this._requireActiveInvitation();
|
|
2058
|
-
this._assertInvitationState(
|
|
1939
|
+
this._assertInvitationState(import_services7.Invitation.State.CONNECTED);
|
|
2059
1940
|
if (invitationId !== invitation?.invitationId) {
|
|
2060
|
-
|
|
1941
|
+
import_log6.log.warn("incorrect invitationId", {
|
|
2061
1942
|
expected: invitation.invitationId,
|
|
2062
1943
|
actual: invitationId
|
|
2063
1944
|
}, {
|
|
2064
|
-
F:
|
|
1945
|
+
F: __dxlog_file8,
|
|
2065
1946
|
L: 116,
|
|
2066
1947
|
S: this,
|
|
2067
1948
|
C: (f, a) => f(...a)
|
|
@@ -2069,24 +1950,24 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2069
1950
|
this._callbacks.onError(new Error("Incorrect invitationId."));
|
|
2070
1951
|
(0, import_async10.scheduleTask)(this._ctx, () => this.close());
|
|
2071
1952
|
return {
|
|
2072
|
-
authMethod:
|
|
1953
|
+
authMethod: import_services7.Invitation.AuthMethod.NONE
|
|
2073
1954
|
};
|
|
2074
1955
|
}
|
|
2075
|
-
(0,
|
|
1956
|
+
(0, import_log6.log)("guest introduced themselves", {
|
|
2076
1957
|
guestProfile: profile
|
|
2077
1958
|
}, {
|
|
2078
|
-
F:
|
|
1959
|
+
F: __dxlog_file8,
|
|
2079
1960
|
L: 125,
|
|
2080
1961
|
S: this,
|
|
2081
1962
|
C: (f, a) => f(...a)
|
|
2082
1963
|
});
|
|
2083
1964
|
this.guestProfile = profile;
|
|
2084
|
-
this._callbacks.onStateUpdate(
|
|
2085
|
-
this._challenge = invitation.authMethod ===
|
|
2086
|
-
|
|
1965
|
+
this._callbacks.onStateUpdate(import_services7.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
1966
|
+
this._challenge = invitation.authMethod === import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
1967
|
+
import_log6.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
|
|
2087
1968
|
id: traceId
|
|
2088
1969
|
}), {
|
|
2089
|
-
F:
|
|
1970
|
+
F: __dxlog_file8,
|
|
2090
1971
|
L: 132,
|
|
2091
1972
|
S: this,
|
|
2092
1973
|
C: (f, a) => f(...a)
|
|
@@ -2097,34 +1978,34 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2097
1978
|
};
|
|
2098
1979
|
},
|
|
2099
1980
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
2100
|
-
const traceId =
|
|
2101
|
-
|
|
1981
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1982
|
+
import_log6.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
|
|
2102
1983
|
id: traceId
|
|
2103
1984
|
}), {
|
|
2104
|
-
F:
|
|
1985
|
+
F: __dxlog_file8,
|
|
2105
1986
|
L: 141,
|
|
2106
1987
|
S: this,
|
|
2107
1988
|
C: (f, a) => f(...a)
|
|
2108
1989
|
});
|
|
2109
1990
|
const invitation = this._requireActiveInvitation();
|
|
2110
|
-
(0,
|
|
1991
|
+
(0, import_log6.log)("received authentication request", {
|
|
2111
1992
|
authCode: code
|
|
2112
1993
|
}, {
|
|
2113
|
-
F:
|
|
1994
|
+
F: __dxlog_file8,
|
|
2114
1995
|
L: 144,
|
|
2115
1996
|
S: this,
|
|
2116
1997
|
C: (f, a) => f(...a)
|
|
2117
1998
|
});
|
|
2118
1999
|
let status = import_invitations4.AuthenticationResponse.Status.OK;
|
|
2119
2000
|
this._assertInvitationState([
|
|
2120
|
-
|
|
2121
|
-
|
|
2001
|
+
import_services7.Invitation.State.AUTHENTICATING,
|
|
2002
|
+
import_services7.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2122
2003
|
]);
|
|
2123
|
-
this._callbacks.onStateUpdate(
|
|
2004
|
+
this._callbacks.onStateUpdate(import_services7.Invitation.State.AUTHENTICATING);
|
|
2124
2005
|
switch (invitation.authMethod) {
|
|
2125
|
-
case
|
|
2126
|
-
(0,
|
|
2127
|
-
F:
|
|
2006
|
+
case import_services7.Invitation.AuthMethod.NONE: {
|
|
2007
|
+
(0, import_log6.log)("authentication not required", void 0, {
|
|
2008
|
+
F: __dxlog_file8,
|
|
2128
2009
|
L: 152,
|
|
2129
2010
|
S: this,
|
|
2130
2011
|
C: (f, a) => f(...a)
|
|
@@ -2133,7 +2014,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2133
2014
|
status: import_invitations4.AuthenticationResponse.Status.OK
|
|
2134
2015
|
};
|
|
2135
2016
|
}
|
|
2136
|
-
case
|
|
2017
|
+
case import_services7.Invitation.AuthMethod.SHARED_SECRET: {
|
|
2137
2018
|
if (invitation.authCode) {
|
|
2138
2019
|
if (this.authenticationRetry++ > MAX_OTP_ATTEMPTS) {
|
|
2139
2020
|
status = import_invitations4.AuthenticationResponse.Status.INVALID_OPT_ATTEMPTS;
|
|
@@ -2145,7 +2026,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2145
2026
|
}
|
|
2146
2027
|
break;
|
|
2147
2028
|
}
|
|
2148
|
-
case
|
|
2029
|
+
case import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
|
|
2149
2030
|
if (!invitation.guestKeypair) {
|
|
2150
2031
|
status = import_invitations4.AuthenticationResponse.Status.INTERNAL_ERROR;
|
|
2151
2032
|
break;
|
|
@@ -2159,10 +2040,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2159
2040
|
break;
|
|
2160
2041
|
}
|
|
2161
2042
|
default: {
|
|
2162
|
-
|
|
2043
|
+
import_log6.log.error("invalid authentication method", {
|
|
2163
2044
|
authMethod: invitation.authMethod
|
|
2164
2045
|
}, {
|
|
2165
|
-
F:
|
|
2046
|
+
F: __dxlog_file8,
|
|
2166
2047
|
L: 190,
|
|
2167
2048
|
S: this,
|
|
2168
2049
|
C: (f, a) => f(...a)
|
|
@@ -2181,13 +2062,13 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2181
2062
|
status
|
|
2182
2063
|
};
|
|
2183
2064
|
}
|
|
2184
|
-
|
|
2065
|
+
import_log6.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.end({
|
|
2185
2066
|
id: traceId,
|
|
2186
2067
|
data: {
|
|
2187
2068
|
status
|
|
2188
2069
|
}
|
|
2189
2070
|
}), {
|
|
2190
|
-
F:
|
|
2071
|
+
F: __dxlog_file8,
|
|
2191
2072
|
L: 202,
|
|
2192
2073
|
S: this,
|
|
2193
2074
|
C: (f, a) => f(...a)
|
|
@@ -2197,11 +2078,11 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2197
2078
|
};
|
|
2198
2079
|
},
|
|
2199
2080
|
admit: async (request) => {
|
|
2200
|
-
const traceId =
|
|
2201
|
-
|
|
2081
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2082
|
+
import_log6.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
|
|
2202
2083
|
id: traceId
|
|
2203
2084
|
}), {
|
|
2204
|
-
F:
|
|
2085
|
+
F: __dxlog_file8,
|
|
2205
2086
|
L: 208,
|
|
2206
2087
|
S: this,
|
|
2207
2088
|
C: (f, a) => f(...a)
|
|
@@ -2209,16 +2090,16 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2209
2090
|
const invitation = this._requireActiveInvitation();
|
|
2210
2091
|
try {
|
|
2211
2092
|
if (isAuthenticationRequired(invitation)) {
|
|
2212
|
-
this._assertInvitationState(
|
|
2093
|
+
this._assertInvitationState(import_services7.Invitation.State.AUTHENTICATING);
|
|
2213
2094
|
if (!this.authenticationPassed) {
|
|
2214
2095
|
throw new Error("Not authenticated");
|
|
2215
2096
|
}
|
|
2216
2097
|
}
|
|
2217
2098
|
const response = await this._callbacks.admit(request);
|
|
2218
|
-
|
|
2099
|
+
import_log6.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
|
|
2219
2100
|
id: traceId
|
|
2220
2101
|
}), {
|
|
2221
|
-
F:
|
|
2102
|
+
F: __dxlog_file8,
|
|
2222
2103
|
L: 222,
|
|
2223
2104
|
S: this,
|
|
2224
2105
|
C: (f, a) => f(...a)
|
|
@@ -2235,35 +2116,35 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2235
2116
|
async onOpen(context) {
|
|
2236
2117
|
await super.onOpen(context);
|
|
2237
2118
|
try {
|
|
2238
|
-
(0,
|
|
2239
|
-
F:
|
|
2119
|
+
(0, import_log6.log)("host acquire lock", void 0, {
|
|
2120
|
+
F: __dxlog_file8,
|
|
2240
2121
|
L: 237,
|
|
2241
2122
|
S: this,
|
|
2242
2123
|
C: (f, a) => f(...a)
|
|
2243
2124
|
});
|
|
2244
2125
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2245
|
-
(0,
|
|
2246
|
-
F:
|
|
2126
|
+
(0, import_log6.log)("host lock acquired", void 0, {
|
|
2127
|
+
F: __dxlog_file8,
|
|
2247
2128
|
L: 239,
|
|
2248
2129
|
S: this,
|
|
2249
2130
|
C: (f, a) => f(...a)
|
|
2250
2131
|
});
|
|
2251
2132
|
const lastState = this._requireActiveInvitation().state;
|
|
2252
|
-
this._callbacks.onStateUpdate(
|
|
2133
|
+
this._callbacks.onStateUpdate(import_services7.Invitation.State.CONNECTING);
|
|
2253
2134
|
await this.rpc.InvitationHostService.options({
|
|
2254
2135
|
role: import_invitations4.Options.Role.HOST
|
|
2255
2136
|
});
|
|
2256
|
-
(0,
|
|
2257
|
-
F:
|
|
2137
|
+
(0, import_log6.log)("options sent", void 0, {
|
|
2138
|
+
F: __dxlog_file8,
|
|
2258
2139
|
L: 243,
|
|
2259
2140
|
S: this,
|
|
2260
2141
|
C: (f, a) => f(...a)
|
|
2261
2142
|
});
|
|
2262
|
-
await (0,
|
|
2143
|
+
await (0, import_context7.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2263
2144
|
timeout: OPTIONS_TIMEOUT2
|
|
2264
2145
|
}));
|
|
2265
|
-
(0,
|
|
2266
|
-
F:
|
|
2146
|
+
(0, import_log6.log)("options received", void 0, {
|
|
2147
|
+
F: __dxlog_file8,
|
|
2267
2148
|
L: 245,
|
|
2268
2149
|
S: this,
|
|
2269
2150
|
C: (f, a) => f(...a)
|
|
@@ -2276,7 +2157,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2276
2157
|
remotePeerId: context.remotePeerId
|
|
2277
2158
|
});
|
|
2278
2159
|
}
|
|
2279
|
-
this._callbacks.onStateUpdate(
|
|
2160
|
+
this._callbacks.onStateUpdate(import_services7.Invitation.State.CONNECTED);
|
|
2280
2161
|
this._callbacks.onOpen(this._ctx, context);
|
|
2281
2162
|
} catch (err) {
|
|
2282
2163
|
if (this._invitationFlowLock != null) {
|
|
@@ -2316,8 +2197,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2316
2197
|
if (this._invitationFlowLock != null) {
|
|
2317
2198
|
this._invitationFlowLock?.release();
|
|
2318
2199
|
this._invitationFlowLock = null;
|
|
2319
|
-
(0,
|
|
2320
|
-
F:
|
|
2200
|
+
(0, import_log6.log)("invitation flow lock released", void 0, {
|
|
2201
|
+
F: __dxlog_file8,
|
|
2321
2202
|
L: 300,
|
|
2322
2203
|
S: this,
|
|
2323
2204
|
C: (f, a) => f(...a)
|
|
@@ -2325,16 +2206,16 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2325
2206
|
}
|
|
2326
2207
|
}
|
|
2327
2208
|
};
|
|
2328
|
-
var isAuthenticationRequired = (invitation) => invitation.authMethod !==
|
|
2329
|
-
var
|
|
2209
|
+
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services7.Invitation.AuthMethod.NONE;
|
|
2210
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2330
2211
|
var InvitationTopology = class {
|
|
2331
2212
|
constructor(_role) {
|
|
2332
2213
|
this._role = _role;
|
|
2333
|
-
this._seenPeers = new import_util5.ComplexSet(
|
|
2214
|
+
this._seenPeers = new import_util5.ComplexSet(import_keys7.PublicKey.hash);
|
|
2334
2215
|
}
|
|
2335
2216
|
init(controller) {
|
|
2336
2217
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
2337
|
-
F:
|
|
2218
|
+
F: __dxlog_file9,
|
|
2338
2219
|
L: 42,
|
|
2339
2220
|
S: this,
|
|
2340
2221
|
A: [
|
|
@@ -2346,7 +2227,7 @@ var InvitationTopology = class {
|
|
|
2346
2227
|
}
|
|
2347
2228
|
update() {
|
|
2348
2229
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2349
|
-
F:
|
|
2230
|
+
F: __dxlog_file9,
|
|
2350
2231
|
L: 47,
|
|
2351
2232
|
S: this,
|
|
2352
2233
|
A: [
|
|
@@ -2363,13 +2244,13 @@ var InvitationTopology = class {
|
|
|
2363
2244
|
return;
|
|
2364
2245
|
}
|
|
2365
2246
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
2366
|
-
this._seenPeers = new import_util5.ComplexSet(
|
|
2247
|
+
this._seenPeers = new import_util5.ComplexSet(import_keys7.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
2367
2248
|
if (firstUnknownPeer != null) {
|
|
2368
|
-
(0,
|
|
2249
|
+
(0, import_log7.log)("invitation connect", {
|
|
2369
2250
|
ownPeerId,
|
|
2370
2251
|
remotePeerId: firstUnknownPeer
|
|
2371
2252
|
}, {
|
|
2372
|
-
F:
|
|
2253
|
+
F: __dxlog_file9,
|
|
2373
2254
|
L: 69,
|
|
2374
2255
|
S: this,
|
|
2375
2256
|
C: (f, a) => f(...a)
|
|
@@ -2380,7 +2261,7 @@ var InvitationTopology = class {
|
|
|
2380
2261
|
}
|
|
2381
2262
|
async onOffer(peer) {
|
|
2382
2263
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2383
|
-
F:
|
|
2264
|
+
F: __dxlog_file9,
|
|
2384
2265
|
L: 76,
|
|
2385
2266
|
S: this,
|
|
2386
2267
|
A: [
|
|
@@ -2397,7 +2278,7 @@ var InvitationTopology = class {
|
|
|
2397
2278
|
return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
|
|
2398
2279
|
}
|
|
2399
2280
|
};
|
|
2400
|
-
var
|
|
2281
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2401
2282
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2402
2283
|
var InvitationsHandler = class {
|
|
2403
2284
|
/**
|
|
@@ -2422,7 +2303,7 @@ var InvitationsHandler = class {
|
|
|
2422
2303
|
try {
|
|
2423
2304
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2424
2305
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2425
|
-
F:
|
|
2306
|
+
F: __dxlog_file10,
|
|
2426
2307
|
L: 90,
|
|
2427
2308
|
S: this,
|
|
2428
2309
|
A: [
|
|
@@ -2442,24 +2323,24 @@ var InvitationsHandler = class {
|
|
|
2442
2323
|
let admitted = false;
|
|
2443
2324
|
connectionCtx.onDispose(() => {
|
|
2444
2325
|
if (!admitted) {
|
|
2445
|
-
guardedState.error(extension, new
|
|
2326
|
+
guardedState.error(extension, new import_context4.ContextDisposedError());
|
|
2446
2327
|
}
|
|
2447
2328
|
});
|
|
2448
2329
|
(0, import_async8.scheduleTask)(connectionCtx, async () => {
|
|
2449
|
-
const traceId =
|
|
2330
|
+
const traceId = import_keys5.PublicKey.random().toHex();
|
|
2450
2331
|
try {
|
|
2451
|
-
|
|
2332
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
2452
2333
|
id: traceId
|
|
2453
2334
|
}), {
|
|
2454
|
-
F:
|
|
2335
|
+
F: __dxlog_file10,
|
|
2455
2336
|
L: 115,
|
|
2456
2337
|
S: this,
|
|
2457
2338
|
C: (f, a) => f(...a)
|
|
2458
2339
|
});
|
|
2459
|
-
(0,
|
|
2340
|
+
(0, import_log4.log)("connected", {
|
|
2460
2341
|
...protocol.toJSON()
|
|
2461
2342
|
}, {
|
|
2462
|
-
F:
|
|
2343
|
+
F: __dxlog_file10,
|
|
2463
2344
|
L: 116,
|
|
2464
2345
|
S: this,
|
|
2465
2346
|
C: (f, a) => f(...a)
|
|
@@ -2467,20 +2348,20 @@ var InvitationsHandler = class {
|
|
|
2467
2348
|
const deviceKey = await extension.completedTrigger.wait({
|
|
2468
2349
|
timeout: invitation.timeout
|
|
2469
2350
|
});
|
|
2470
|
-
(0,
|
|
2351
|
+
(0, import_log4.log)("admitted guest", {
|
|
2471
2352
|
guest: deviceKey,
|
|
2472
2353
|
...protocol.toJSON()
|
|
2473
2354
|
}, {
|
|
2474
|
-
F:
|
|
2355
|
+
F: __dxlog_file10,
|
|
2475
2356
|
L: 118,
|
|
2476
2357
|
S: this,
|
|
2477
2358
|
C: (f, a) => f(...a)
|
|
2478
2359
|
});
|
|
2479
|
-
guardedState.set(extension,
|
|
2480
|
-
|
|
2360
|
+
guardedState.set(extension, import_services5.Invitation.State.SUCCESS);
|
|
2361
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2481
2362
|
id: traceId
|
|
2482
2363
|
}), {
|
|
2483
|
-
F:
|
|
2364
|
+
F: __dxlog_file10,
|
|
2484
2365
|
L: 120,
|
|
2485
2366
|
S: this,
|
|
2486
2367
|
C: (f, a) => f(...a)
|
|
@@ -2491,11 +2372,11 @@ var InvitationsHandler = class {
|
|
|
2491
2372
|
}
|
|
2492
2373
|
} catch (err) {
|
|
2493
2374
|
if (err instanceof import_async8.TimeoutError) {
|
|
2494
|
-
if (guardedState.set(extension,
|
|
2495
|
-
(0,
|
|
2375
|
+
if (guardedState.set(extension, import_services5.Invitation.State.TIMEOUT)) {
|
|
2376
|
+
(0, import_log4.log)("timeout", {
|
|
2496
2377
|
...protocol.toJSON()
|
|
2497
2378
|
}, {
|
|
2498
|
-
F:
|
|
2379
|
+
F: __dxlog_file10,
|
|
2499
2380
|
L: 129,
|
|
2500
2381
|
S: this,
|
|
2501
2382
|
C: (f, a) => f(...a)
|
|
@@ -2503,19 +2384,19 @@ var InvitationsHandler = class {
|
|
|
2503
2384
|
}
|
|
2504
2385
|
} else {
|
|
2505
2386
|
if (guardedState.error(extension, err)) {
|
|
2506
|
-
|
|
2507
|
-
F:
|
|
2387
|
+
import_log4.log.error("failed", err, {
|
|
2388
|
+
F: __dxlog_file10,
|
|
2508
2389
|
L: 133,
|
|
2509
2390
|
S: this,
|
|
2510
2391
|
C: (f, a) => f(...a)
|
|
2511
2392
|
});
|
|
2512
2393
|
}
|
|
2513
2394
|
}
|
|
2514
|
-
|
|
2395
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.error({
|
|
2515
2396
|
id: traceId,
|
|
2516
2397
|
error: err
|
|
2517
2398
|
}), {
|
|
2518
|
-
F:
|
|
2399
|
+
F: __dxlog_file10,
|
|
2519
2400
|
L: 136,
|
|
2520
2401
|
S: this,
|
|
2521
2402
|
C: (f, a) => f(...a)
|
|
@@ -2526,10 +2407,10 @@ var InvitationsHandler = class {
|
|
|
2526
2407
|
},
|
|
2527
2408
|
onError: (err) => {
|
|
2528
2409
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2529
|
-
(0,
|
|
2410
|
+
(0, import_log4.log)("invalid role", {
|
|
2530
2411
|
...err.context
|
|
2531
2412
|
}, {
|
|
2532
|
-
F:
|
|
2413
|
+
F: __dxlog_file10,
|
|
2533
2414
|
L: 144,
|
|
2534
2415
|
S: this,
|
|
2535
2416
|
C: (f, a) => f(...a)
|
|
@@ -2537,11 +2418,11 @@ var InvitationsHandler = class {
|
|
|
2537
2418
|
return;
|
|
2538
2419
|
}
|
|
2539
2420
|
if (err instanceof import_async8.TimeoutError) {
|
|
2540
|
-
if (guardedState.set(extension,
|
|
2541
|
-
(0,
|
|
2421
|
+
if (guardedState.set(extension, import_services5.Invitation.State.TIMEOUT)) {
|
|
2422
|
+
(0, import_log4.log)("timeout", {
|
|
2542
2423
|
err
|
|
2543
2424
|
}, {
|
|
2544
|
-
F:
|
|
2425
|
+
F: __dxlog_file10,
|
|
2545
2426
|
L: 149,
|
|
2546
2427
|
S: this,
|
|
2547
2428
|
C: (f, a) => f(...a)
|
|
@@ -2549,8 +2430,8 @@ var InvitationsHandler = class {
|
|
|
2549
2430
|
}
|
|
2550
2431
|
} else {
|
|
2551
2432
|
if (guardedState.error(extension, err)) {
|
|
2552
|
-
|
|
2553
|
-
F:
|
|
2433
|
+
import_log4.log.error("failed", err, {
|
|
2434
|
+
F: __dxlog_file10,
|
|
2554
2435
|
L: 153,
|
|
2555
2436
|
S: this,
|
|
2556
2437
|
C: (f, a) => f(...a)
|
|
@@ -2563,8 +2444,8 @@ var InvitationsHandler = class {
|
|
|
2563
2444
|
};
|
|
2564
2445
|
if (invitation.lifetime && invitation.created) {
|
|
2565
2446
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2566
|
-
|
|
2567
|
-
F:
|
|
2447
|
+
import_log4.log.warn("invitation has already expired", void 0, {
|
|
2448
|
+
F: __dxlog_file10,
|
|
2568
2449
|
L: 164,
|
|
2569
2450
|
S: this,
|
|
2570
2451
|
C: (f, a) => f(...a)
|
|
@@ -2572,7 +2453,7 @@ var InvitationsHandler = class {
|
|
|
2572
2453
|
} else {
|
|
2573
2454
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
2574
2455
|
await swarmConnection.close();
|
|
2575
|
-
guardedState.set(null,
|
|
2456
|
+
guardedState.set(null, import_services5.Invitation.State.EXPIRED);
|
|
2576
2457
|
await ctx.dispose();
|
|
2577
2458
|
}, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
|
|
2578
2459
|
}
|
|
@@ -2580,14 +2461,14 @@ var InvitationsHandler = class {
|
|
|
2580
2461
|
let swarmConnection;
|
|
2581
2462
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
2582
2463
|
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.Options.Role.HOST, createExtension);
|
|
2583
|
-
guardedState.set(null,
|
|
2464
|
+
guardedState.set(null, import_services5.Invitation.State.CONNECTING);
|
|
2584
2465
|
});
|
|
2585
2466
|
}
|
|
2586
2467
|
acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
|
|
2587
2468
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2588
2469
|
if (deviceProfile) {
|
|
2589
|
-
(0, import_invariant6.invariant)(invitation.kind ===
|
|
2590
|
-
F:
|
|
2470
|
+
(0, import_invariant6.invariant)(invitation.kind === import_services5.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2471
|
+
F: __dxlog_file10,
|
|
2591
2472
|
L: 197,
|
|
2592
2473
|
S: this,
|
|
2593
2474
|
A: [
|
|
@@ -2596,16 +2477,16 @@ var InvitationsHandler = class {
|
|
|
2596
2477
|
]
|
|
2597
2478
|
});
|
|
2598
2479
|
}
|
|
2599
|
-
const triedPeersIds = new import_util4.ComplexSet(
|
|
2480
|
+
const triedPeersIds = new import_util4.ComplexSet(import_keys5.PublicKey.hash);
|
|
2600
2481
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2601
2482
|
const shouldCancelInvitationFlow = (extension) => {
|
|
2602
2483
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
2603
|
-
(0,
|
|
2484
|
+
(0, import_log4.log)("should cancel invitation flow", {
|
|
2604
2485
|
isLockedByAnotherConnection,
|
|
2605
|
-
invitationType:
|
|
2486
|
+
invitationType: import_services5.Invitation.Type.DELEGATED,
|
|
2606
2487
|
triedPeers: triedPeersIds.size
|
|
2607
2488
|
}, {
|
|
2608
|
-
F:
|
|
2489
|
+
F: __dxlog_file10,
|
|
2609
2490
|
L: 205,
|
|
2610
2491
|
S: this,
|
|
2611
2492
|
C: (f, a) => f(...a)
|
|
@@ -2613,7 +2494,7 @@ var InvitationsHandler = class {
|
|
|
2613
2494
|
if (isLockedByAnotherConnection) {
|
|
2614
2495
|
return false;
|
|
2615
2496
|
}
|
|
2616
|
-
return invitation.type !==
|
|
2497
|
+
return invitation.type !== import_services5.Invitation.Type.DELEGATED || triedPeersIds.size >= MAX_DELEGATED_INVITATION_HOST_TRIES;
|
|
2617
2498
|
};
|
|
2618
2499
|
let admitted = false;
|
|
2619
2500
|
const createExtension = () => {
|
|
@@ -2628,50 +2509,50 @@ var InvitationsHandler = class {
|
|
|
2628
2509
|
return;
|
|
2629
2510
|
}
|
|
2630
2511
|
connectionCtx.onDispose(async () => {
|
|
2631
|
-
(0,
|
|
2512
|
+
(0, import_log4.log)("extension disposed", {
|
|
2632
2513
|
admitted,
|
|
2633
2514
|
currentState: guardedState.current.state
|
|
2634
2515
|
}, {
|
|
2635
|
-
F:
|
|
2516
|
+
F: __dxlog_file10,
|
|
2636
2517
|
L: 233,
|
|
2637
2518
|
S: this,
|
|
2638
2519
|
C: (f, a) => f(...a)
|
|
2639
2520
|
});
|
|
2640
2521
|
if (!admitted) {
|
|
2641
|
-
guardedState.error(extension, new
|
|
2522
|
+
guardedState.error(extension, new import_context4.ContextDisposedError());
|
|
2642
2523
|
if (shouldCancelInvitationFlow(extension)) {
|
|
2643
2524
|
await ctx.dispose();
|
|
2644
2525
|
}
|
|
2645
2526
|
}
|
|
2646
2527
|
});
|
|
2647
2528
|
(0, import_async8.scheduleTask)(connectionCtx, async () => {
|
|
2648
|
-
const traceId =
|
|
2529
|
+
const traceId = import_keys5.PublicKey.random().toHex();
|
|
2649
2530
|
try {
|
|
2650
|
-
|
|
2531
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
2651
2532
|
id: traceId
|
|
2652
2533
|
}), {
|
|
2653
|
-
F:
|
|
2534
|
+
F: __dxlog_file10,
|
|
2654
2535
|
L: 245,
|
|
2655
2536
|
S: this,
|
|
2656
2537
|
C: (f, a) => f(...a)
|
|
2657
2538
|
});
|
|
2658
2539
|
(0, import_async8.scheduleTask)(connectionCtx, () => {
|
|
2659
|
-
guardedState.set(extension,
|
|
2540
|
+
guardedState.set(extension, import_services5.Invitation.State.TIMEOUT);
|
|
2660
2541
|
extensionCtx.close();
|
|
2661
2542
|
}, timeout);
|
|
2662
|
-
(0,
|
|
2543
|
+
(0, import_log4.log)("connected", {
|
|
2663
2544
|
...protocol.toJSON()
|
|
2664
2545
|
}, {
|
|
2665
|
-
F:
|
|
2546
|
+
F: __dxlog_file10,
|
|
2666
2547
|
L: 256,
|
|
2667
2548
|
S: this,
|
|
2668
2549
|
C: (f, a) => f(...a)
|
|
2669
2550
|
});
|
|
2670
|
-
guardedState.set(extension,
|
|
2671
|
-
(0,
|
|
2551
|
+
guardedState.set(extension, import_services5.Invitation.State.CONNECTED);
|
|
2552
|
+
(0, import_log4.log)("introduce", {
|
|
2672
2553
|
...protocol.toJSON()
|
|
2673
2554
|
}, {
|
|
2674
|
-
F:
|
|
2555
|
+
F: __dxlog_file10,
|
|
2675
2556
|
L: 260,
|
|
2676
2557
|
S: this,
|
|
2677
2558
|
C: (f, a) => f(...a)
|
|
@@ -2680,11 +2561,11 @@ var InvitationsHandler = class {
|
|
|
2680
2561
|
invitationId: invitation.invitationId,
|
|
2681
2562
|
...protocol.createIntroduction()
|
|
2682
2563
|
});
|
|
2683
|
-
(0,
|
|
2564
|
+
(0, import_log4.log)("introduce response", {
|
|
2684
2565
|
...protocol.toJSON(),
|
|
2685
2566
|
response: introductionResponse
|
|
2686
2567
|
}, {
|
|
2687
|
-
F:
|
|
2568
|
+
F: __dxlog_file10,
|
|
2688
2569
|
L: 265,
|
|
2689
2570
|
S: this,
|
|
2690
2571
|
C: (f, a) => f(...a)
|
|
@@ -2692,20 +2573,20 @@ var InvitationsHandler = class {
|
|
|
2692
2573
|
invitation.authMethod = introductionResponse.authMethod;
|
|
2693
2574
|
if (isAuthenticationRequired(invitation)) {
|
|
2694
2575
|
switch (invitation.authMethod) {
|
|
2695
|
-
case
|
|
2576
|
+
case import_services5.Invitation.AuthMethod.SHARED_SECRET:
|
|
2696
2577
|
await this._handleGuestOtpAuth(extension, (state) => guardedState.set(extension, state), otpEnteredTrigger, {
|
|
2697
2578
|
timeout
|
|
2698
2579
|
});
|
|
2699
2580
|
break;
|
|
2700
|
-
case
|
|
2581
|
+
case import_services5.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
|
|
2701
2582
|
await this._handleGuestKpkAuth(extension, (state) => guardedState.set(extension, state), invitation, introductionResponse);
|
|
2702
2583
|
break;
|
|
2703
2584
|
}
|
|
2704
2585
|
}
|
|
2705
|
-
(0,
|
|
2586
|
+
(0, import_log4.log)("request admission", {
|
|
2706
2587
|
...protocol.toJSON()
|
|
2707
2588
|
}, {
|
|
2708
|
-
F:
|
|
2589
|
+
F: __dxlog_file10,
|
|
2709
2590
|
L: 291,
|
|
2710
2591
|
S: this,
|
|
2711
2592
|
C: (f, a) => f(...a)
|
|
@@ -2714,10 +2595,10 @@ var InvitationsHandler = class {
|
|
|
2714
2595
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
2715
2596
|
admitted = true;
|
|
2716
2597
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
2717
|
-
(0,
|
|
2598
|
+
(0, import_log4.log)("admitted by host", {
|
|
2718
2599
|
...protocol.toJSON()
|
|
2719
2600
|
}, {
|
|
2720
|
-
F:
|
|
2601
|
+
F: __dxlog_file10,
|
|
2721
2602
|
L: 302,
|
|
2722
2603
|
S: this,
|
|
2723
2604
|
C: (f, a) => f(...a)
|
|
@@ -2725,30 +2606,30 @@ var InvitationsHandler = class {
|
|
|
2725
2606
|
await guardedState.complete({
|
|
2726
2607
|
...guardedState.current,
|
|
2727
2608
|
...result,
|
|
2728
|
-
state:
|
|
2609
|
+
state: import_services5.Invitation.State.SUCCESS
|
|
2729
2610
|
});
|
|
2730
|
-
|
|
2611
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
|
|
2731
2612
|
id: traceId
|
|
2732
2613
|
}), {
|
|
2733
|
-
F:
|
|
2614
|
+
F: __dxlog_file10,
|
|
2734
2615
|
L: 308,
|
|
2735
2616
|
S: this,
|
|
2736
2617
|
C: (f, a) => f(...a)
|
|
2737
2618
|
});
|
|
2738
2619
|
} catch (err) {
|
|
2739
2620
|
if (err instanceof import_async8.TimeoutError) {
|
|
2740
|
-
(0,
|
|
2621
|
+
(0, import_log4.log)("timeout", {
|
|
2741
2622
|
...protocol.toJSON()
|
|
2742
2623
|
}, {
|
|
2743
|
-
F:
|
|
2624
|
+
F: __dxlog_file10,
|
|
2744
2625
|
L: 311,
|
|
2745
2626
|
S: this,
|
|
2746
2627
|
C: (f, a) => f(...a)
|
|
2747
2628
|
});
|
|
2748
|
-
guardedState.set(extension,
|
|
2629
|
+
guardedState.set(extension, import_services5.Invitation.State.TIMEOUT);
|
|
2749
2630
|
} else {
|
|
2750
|
-
(0,
|
|
2751
|
-
F:
|
|
2631
|
+
(0, import_log4.log)("auth failed", err, {
|
|
2632
|
+
F: __dxlog_file10,
|
|
2752
2633
|
L: 314,
|
|
2753
2634
|
S: this,
|
|
2754
2635
|
C: (f, a) => f(...a)
|
|
@@ -2756,11 +2637,11 @@ var InvitationsHandler = class {
|
|
|
2756
2637
|
guardedState.error(extension, err);
|
|
2757
2638
|
}
|
|
2758
2639
|
extensionCtx.close(err);
|
|
2759
|
-
|
|
2640
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.error({
|
|
2760
2641
|
id: traceId,
|
|
2761
2642
|
error: err
|
|
2762
2643
|
}), {
|
|
2763
|
-
F:
|
|
2644
|
+
F: __dxlog_file10,
|
|
2764
2645
|
L: 318,
|
|
2765
2646
|
S: this,
|
|
2766
2647
|
C: (f, a) => f(...a)
|
|
@@ -2773,18 +2654,18 @@ var InvitationsHandler = class {
|
|
|
2773
2654
|
return;
|
|
2774
2655
|
}
|
|
2775
2656
|
if (err instanceof import_async8.TimeoutError) {
|
|
2776
|
-
(0,
|
|
2657
|
+
(0, import_log4.log)("timeout", {
|
|
2777
2658
|
...protocol.toJSON()
|
|
2778
2659
|
}, {
|
|
2779
|
-
F:
|
|
2660
|
+
F: __dxlog_file10,
|
|
2780
2661
|
L: 327,
|
|
2781
2662
|
S: this,
|
|
2782
2663
|
C: (f, a) => f(...a)
|
|
2783
2664
|
});
|
|
2784
|
-
guardedState.set(extension,
|
|
2665
|
+
guardedState.set(extension, import_services5.Invitation.State.TIMEOUT);
|
|
2785
2666
|
} else {
|
|
2786
|
-
(0,
|
|
2787
|
-
F:
|
|
2667
|
+
(0, import_log4.log)("auth failed", err, {
|
|
2668
|
+
F: __dxlog_file10,
|
|
2788
2669
|
L: 330,
|
|
2789
2670
|
S: this,
|
|
2790
2671
|
C: (f, a) => f(...a)
|
|
@@ -2802,7 +2683,7 @@ var InvitationsHandler = class {
|
|
|
2802
2683
|
await ctx.dispose();
|
|
2803
2684
|
} else {
|
|
2804
2685
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2805
|
-
F:
|
|
2686
|
+
F: __dxlog_file10,
|
|
2806
2687
|
L: 345,
|
|
2807
2688
|
S: this,
|
|
2808
2689
|
A: [
|
|
@@ -2811,7 +2692,7 @@ var InvitationsHandler = class {
|
|
|
2811
2692
|
]
|
|
2812
2693
|
});
|
|
2813
2694
|
await this._joinSwarm(ctx, invitation, import_invitations2.Options.Role.GUEST, createExtension);
|
|
2814
|
-
guardedState.set(null,
|
|
2695
|
+
guardedState.set(null, import_services5.Invitation.State.CONNECTING);
|
|
2815
2696
|
}
|
|
2816
2697
|
});
|
|
2817
2698
|
}
|
|
@@ -2819,14 +2700,14 @@ var InvitationsHandler = class {
|
|
|
2819
2700
|
let label;
|
|
2820
2701
|
if (role === import_invitations2.Options.Role.GUEST) {
|
|
2821
2702
|
label = "invitation guest";
|
|
2822
|
-
} else if (invitation.kind ===
|
|
2703
|
+
} else if (invitation.kind === import_services5.Invitation.Kind.DEVICE) {
|
|
2823
2704
|
label = "invitation host for device";
|
|
2824
2705
|
} else {
|
|
2825
2706
|
label = `invitation host for space ${invitation.spaceKey?.truncate()}`;
|
|
2826
2707
|
}
|
|
2827
2708
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
2828
2709
|
topic: invitation.swarmKey,
|
|
2829
|
-
peerId:
|
|
2710
|
+
peerId: import_keys5.PublicKey.random(),
|
|
2830
2711
|
protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
|
|
2831
2712
|
teleport.addExtension("dxos.halo.invitations", extensionFactory());
|
|
2832
2713
|
}, this._defaultTeleportParams),
|
|
@@ -2881,10 +2762,10 @@ var InvitationsHandler = class {
|
|
|
2881
2762
|
},
|
|
2882
2763
|
error: (extension, error) => {
|
|
2883
2764
|
if (isStateChangeAllowed(extension)) {
|
|
2884
|
-
this._logStateUpdate(currentInvitation, extension,
|
|
2765
|
+
this._logStateUpdate(currentInvitation, extension, import_services5.Invitation.State.ERROR);
|
|
2885
2766
|
currentInvitation = {
|
|
2886
2767
|
...currentInvitation,
|
|
2887
|
-
state:
|
|
2768
|
+
state: import_services5.Invitation.State.ERROR
|
|
2888
2769
|
};
|
|
2889
2770
|
stream.next(currentInvitation);
|
|
2890
2771
|
stream.error(error);
|
|
@@ -2896,12 +2777,12 @@ var InvitationsHandler = class {
|
|
|
2896
2777
|
};
|
|
2897
2778
|
}
|
|
2898
2779
|
_logStateUpdate(invitation, actor, newState) {
|
|
2899
|
-
(0,
|
|
2780
|
+
(0, import_log4.log)("invitation state update", {
|
|
2900
2781
|
actor: actor?.constructor.name,
|
|
2901
2782
|
newState: stateToString(newState),
|
|
2902
2783
|
oldState: stateToString(invitation.state)
|
|
2903
2784
|
}, {
|
|
2904
|
-
F:
|
|
2785
|
+
F: __dxlog_file10,
|
|
2905
2786
|
L: 438,
|
|
2906
2787
|
S: this,
|
|
2907
2788
|
C: (f, a) => f(...a)
|
|
@@ -2909,30 +2790,30 @@ var InvitationsHandler = class {
|
|
|
2909
2790
|
}
|
|
2910
2791
|
_isNotTerminal(currentState) {
|
|
2911
2792
|
return ![
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2793
|
+
import_services5.Invitation.State.SUCCESS,
|
|
2794
|
+
import_services5.Invitation.State.ERROR,
|
|
2795
|
+
import_services5.Invitation.State.CANCELLED,
|
|
2796
|
+
import_services5.Invitation.State.TIMEOUT,
|
|
2797
|
+
import_services5.Invitation.State.EXPIRED
|
|
2917
2798
|
].includes(currentState);
|
|
2918
2799
|
}
|
|
2919
2800
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2920
2801
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2921
|
-
(0,
|
|
2922
|
-
F:
|
|
2802
|
+
(0, import_log4.log)("guest waiting for authentication code...", void 0, {
|
|
2803
|
+
F: __dxlog_file10,
|
|
2923
2804
|
L: 462,
|
|
2924
2805
|
S: this,
|
|
2925
2806
|
C: (f, a) => f(...a)
|
|
2926
2807
|
});
|
|
2927
|
-
setState(
|
|
2808
|
+
setState(import_services5.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2928
2809
|
const authCode = await authenticated.wait(options);
|
|
2929
|
-
(0,
|
|
2930
|
-
F:
|
|
2810
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2811
|
+
F: __dxlog_file10,
|
|
2931
2812
|
L: 466,
|
|
2932
2813
|
S: this,
|
|
2933
2814
|
C: (f, a) => f(...a)
|
|
2934
2815
|
});
|
|
2935
|
-
setState(
|
|
2816
|
+
setState(import_services5.Invitation.State.AUTHENTICATING);
|
|
2936
2817
|
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2937
2818
|
authCode
|
|
2938
2819
|
});
|
|
@@ -2943,10 +2824,10 @@ var InvitationsHandler = class {
|
|
|
2943
2824
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2944
2825
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2945
2826
|
} else {
|
|
2946
|
-
(0,
|
|
2827
|
+
(0, import_log4.log)("retrying invalid code", {
|
|
2947
2828
|
attempt
|
|
2948
2829
|
}, {
|
|
2949
|
-
F:
|
|
2830
|
+
F: __dxlog_file10,
|
|
2950
2831
|
L: 477,
|
|
2951
2832
|
S: this,
|
|
2952
2833
|
C: (f, a) => f(...a)
|
|
@@ -2963,13 +2844,13 @@ var InvitationsHandler = class {
|
|
|
2963
2844
|
if (introductionResponse.challenge == null) {
|
|
2964
2845
|
throw new Error("challenge missing in the introduction");
|
|
2965
2846
|
}
|
|
2966
|
-
(0,
|
|
2967
|
-
F:
|
|
2847
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2848
|
+
F: __dxlog_file10,
|
|
2968
2849
|
L: 496,
|
|
2969
2850
|
S: this,
|
|
2970
2851
|
C: (f, a) => f(...a)
|
|
2971
2852
|
});
|
|
2972
|
-
setState(
|
|
2853
|
+
setState(import_services5.Invitation.State.AUTHENTICATING);
|
|
2973
2854
|
const signature = (0, import_crypto.sign)(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
|
|
2974
2855
|
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2975
2856
|
signedChallenge: signature
|
|
@@ -2982,7 +2863,7 @@ var InvitationsHandler = class {
|
|
|
2982
2863
|
var createAdmissionKeypair = () => {
|
|
2983
2864
|
const keypair = (0, import_crypto.createKeyPair)();
|
|
2984
2865
|
return {
|
|
2985
|
-
publicKey:
|
|
2866
|
+
publicKey: import_keys5.PublicKey.from(keypair.publicKey),
|
|
2986
2867
|
privateKey: keypair.secretKey
|
|
2987
2868
|
};
|
|
2988
2869
|
};
|
|
@@ -3015,8 +2896,8 @@ var InvitationsServiceImpl = class {
|
|
|
3015
2896
|
return new import_codec_protobuf10.Stream(({ next, ctx }) => {
|
|
3016
2897
|
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
3017
2898
|
next({
|
|
3018
|
-
action:
|
|
3019
|
-
type:
|
|
2899
|
+
action: import_services8.QueryInvitationsResponse.Action.ADDED,
|
|
2900
|
+
type: import_services8.QueryInvitationsResponse.Type.CREATED,
|
|
3020
2901
|
invitations: [
|
|
3021
2902
|
invitation
|
|
3022
2903
|
]
|
|
@@ -3024,8 +2905,8 @@ var InvitationsServiceImpl = class {
|
|
|
3024
2905
|
});
|
|
3025
2906
|
this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
|
|
3026
2907
|
next({
|
|
3027
|
-
action:
|
|
3028
|
-
type:
|
|
2908
|
+
action: import_services8.QueryInvitationsResponse.Action.ADDED,
|
|
2909
|
+
type: import_services8.QueryInvitationsResponse.Type.ACCEPTED,
|
|
3029
2910
|
invitations: [
|
|
3030
2911
|
invitation
|
|
3031
2912
|
]
|
|
@@ -3033,8 +2914,8 @@ var InvitationsServiceImpl = class {
|
|
|
3033
2914
|
});
|
|
3034
2915
|
this._invitationsManager.removedCreated.on(ctx, (invitation) => {
|
|
3035
2916
|
next({
|
|
3036
|
-
action:
|
|
3037
|
-
type:
|
|
2917
|
+
action: import_services8.QueryInvitationsResponse.Action.REMOVED,
|
|
2918
|
+
type: import_services8.QueryInvitationsResponse.Type.CREATED,
|
|
3038
2919
|
invitations: [
|
|
3039
2920
|
invitation
|
|
3040
2921
|
]
|
|
@@ -3042,8 +2923,8 @@ var InvitationsServiceImpl = class {
|
|
|
3042
2923
|
});
|
|
3043
2924
|
this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
|
|
3044
2925
|
next({
|
|
3045
|
-
action:
|
|
3046
|
-
type:
|
|
2926
|
+
action: import_services8.QueryInvitationsResponse.Action.REMOVED,
|
|
2927
|
+
type: import_services8.QueryInvitationsResponse.Type.ACCEPTED,
|
|
3047
2928
|
invitations: [
|
|
3048
2929
|
invitation
|
|
3049
2930
|
]
|
|
@@ -3051,35 +2932,35 @@ var InvitationsServiceImpl = class {
|
|
|
3051
2932
|
});
|
|
3052
2933
|
this._invitationsManager.saved.on(ctx, (invitation) => {
|
|
3053
2934
|
next({
|
|
3054
|
-
action:
|
|
3055
|
-
type:
|
|
2935
|
+
action: import_services8.QueryInvitationsResponse.Action.SAVED,
|
|
2936
|
+
type: import_services8.QueryInvitationsResponse.Type.CREATED,
|
|
3056
2937
|
invitations: [
|
|
3057
2938
|
invitation
|
|
3058
2939
|
]
|
|
3059
2940
|
});
|
|
3060
2941
|
});
|
|
3061
2942
|
next({
|
|
3062
|
-
action:
|
|
3063
|
-
type:
|
|
2943
|
+
action: import_services8.QueryInvitationsResponse.Action.ADDED,
|
|
2944
|
+
type: import_services8.QueryInvitationsResponse.Type.CREATED,
|
|
3064
2945
|
invitations: this._invitationsManager.getCreatedInvitations(),
|
|
3065
2946
|
existing: true
|
|
3066
2947
|
});
|
|
3067
2948
|
next({
|
|
3068
|
-
action:
|
|
3069
|
-
type:
|
|
2949
|
+
action: import_services8.QueryInvitationsResponse.Action.ADDED,
|
|
2950
|
+
type: import_services8.QueryInvitationsResponse.Type.ACCEPTED,
|
|
3070
2951
|
invitations: this._invitationsManager.getAcceptedInvitations(),
|
|
3071
2952
|
existing: true
|
|
3072
2953
|
});
|
|
3073
2954
|
this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
|
|
3074
2955
|
next({
|
|
3075
|
-
action:
|
|
3076
|
-
type:
|
|
2956
|
+
action: import_services8.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
2957
|
+
type: import_services8.QueryInvitationsResponse.Type.CREATED
|
|
3077
2958
|
});
|
|
3078
2959
|
});
|
|
3079
2960
|
});
|
|
3080
2961
|
}
|
|
3081
2962
|
};
|
|
3082
|
-
var
|
|
2963
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3083
2964
|
var SpaceInvitationProtocol = class {
|
|
3084
2965
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3085
2966
|
this._spaceManager = _spaceManager;
|
|
@@ -3108,13 +2989,13 @@ var SpaceInvitationProtocol = class {
|
|
|
3108
2989
|
}
|
|
3109
2990
|
getInvitationContext() {
|
|
3110
2991
|
return {
|
|
3111
|
-
kind:
|
|
2992
|
+
kind: import_services9.Invitation.Kind.SPACE,
|
|
3112
2993
|
spaceKey: this._spaceKey
|
|
3113
2994
|
};
|
|
3114
2995
|
}
|
|
3115
2996
|
async admit(invitation, request, guestProfile) {
|
|
3116
2997
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3117
|
-
F:
|
|
2998
|
+
F: __dxlog_file11,
|
|
3118
2999
|
L: 76,
|
|
3119
3000
|
S: this,
|
|
3120
3001
|
A: [
|
|
@@ -3124,7 +3005,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3124
3005
|
});
|
|
3125
3006
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3126
3007
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3127
|
-
F:
|
|
3008
|
+
F: __dxlog_file11,
|
|
3128
3009
|
L: 78,
|
|
3129
3010
|
S: this,
|
|
3130
3011
|
A: [
|
|
@@ -3133,7 +3014,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3133
3014
|
]
|
|
3134
3015
|
});
|
|
3135
3016
|
(0, import_invariant10.invariant)(request.space, void 0, {
|
|
3136
|
-
F:
|
|
3017
|
+
F: __dxlog_file11,
|
|
3137
3018
|
L: 80,
|
|
3138
3019
|
S: this,
|
|
3139
3020
|
A: [
|
|
@@ -3142,21 +3023,21 @@ var SpaceInvitationProtocol = class {
|
|
|
3142
3023
|
]
|
|
3143
3024
|
});
|
|
3144
3025
|
const { identityKey, deviceKey } = request.space;
|
|
3145
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !==
|
|
3026
|
+
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials9.SpaceMember.Role.REMOVED) {
|
|
3146
3027
|
throw new import_protocols8.AlreadyJoinedError();
|
|
3147
3028
|
}
|
|
3148
|
-
(0,
|
|
3029
|
+
(0, import_log8.log)("writing guest credentials", {
|
|
3149
3030
|
host: this._signingContext.deviceKey,
|
|
3150
3031
|
guest: deviceKey
|
|
3151
3032
|
}, {
|
|
3152
|
-
F:
|
|
3033
|
+
F: __dxlog_file11,
|
|
3153
3034
|
L: 87,
|
|
3154
3035
|
S: this,
|
|
3155
3036
|
C: (f, a) => f(...a)
|
|
3156
3037
|
});
|
|
3157
|
-
const credentials = await (0,
|
|
3038
|
+
const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, invitation.role ?? import_credentials9.SpaceMember.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
|
|
3158
3039
|
(0, import_invariant10.invariant)(credentials[0].credential, void 0, {
|
|
3159
|
-
F:
|
|
3040
|
+
F: __dxlog_file11,
|
|
3160
3041
|
L: 101,
|
|
3161
3042
|
S: this,
|
|
3162
3043
|
A: [
|
|
@@ -3165,8 +3046,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3165
3046
|
]
|
|
3166
3047
|
});
|
|
3167
3048
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3168
|
-
(0, import_invariant10.invariant)((0,
|
|
3169
|
-
F:
|
|
3049
|
+
(0, import_invariant10.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3050
|
+
F: __dxlog_file11,
|
|
3170
3051
|
L: 103,
|
|
3171
3052
|
S: this,
|
|
3172
3053
|
A: [
|
|
@@ -3184,7 +3065,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3184
3065
|
}
|
|
3185
3066
|
async delegate(invitation) {
|
|
3186
3067
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3187
|
-
F:
|
|
3068
|
+
F: __dxlog_file11,
|
|
3188
3069
|
L: 116,
|
|
3189
3070
|
S: this,
|
|
3190
3071
|
A: [
|
|
@@ -3194,7 +3075,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3194
3075
|
});
|
|
3195
3076
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3196
3077
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3197
|
-
F:
|
|
3078
|
+
F: __dxlog_file11,
|
|
3198
3079
|
L: 118,
|
|
3199
3080
|
S: this,
|
|
3200
3081
|
A: [
|
|
@@ -3202,9 +3083,9 @@ var SpaceInvitationProtocol = class {
|
|
|
3202
3083
|
""
|
|
3203
3084
|
]
|
|
3204
3085
|
});
|
|
3205
|
-
if (invitation.authMethod ===
|
|
3086
|
+
if (invitation.authMethod === import_services9.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3206
3087
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3207
|
-
F:
|
|
3088
|
+
F: __dxlog_file11,
|
|
3208
3089
|
L: 120,
|
|
3209
3090
|
S: this,
|
|
3210
3091
|
A: [
|
|
@@ -3213,26 +3094,26 @@ var SpaceInvitationProtocol = class {
|
|
|
3213
3094
|
]
|
|
3214
3095
|
});
|
|
3215
3096
|
}
|
|
3216
|
-
(0,
|
|
3097
|
+
(0, import_log8.log)("writing delegate space invitation", {
|
|
3217
3098
|
host: this._signingContext.deviceKey,
|
|
3218
3099
|
id: invitation.invitationId
|
|
3219
3100
|
}, {
|
|
3220
|
-
F:
|
|
3101
|
+
F: __dxlog_file11,
|
|
3221
3102
|
L: 123,
|
|
3222
3103
|
S: this,
|
|
3223
3104
|
C: (f, a) => f(...a)
|
|
3224
3105
|
});
|
|
3225
|
-
const credential = await (0,
|
|
3106
|
+
const credential = await (0, import_credentials8.createDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, {
|
|
3226
3107
|
invitationId: invitation.invitationId,
|
|
3227
3108
|
authMethod: invitation.authMethod,
|
|
3228
3109
|
swarmKey: invitation.swarmKey,
|
|
3229
|
-
role: invitation.role ??
|
|
3110
|
+
role: invitation.role ?? import_credentials9.SpaceMember.Role.ADMIN,
|
|
3230
3111
|
expiresOn: invitation.lifetime ? new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime) : void 0,
|
|
3231
3112
|
multiUse: invitation.multiUse ?? false,
|
|
3232
|
-
guestKey: invitation.authMethod ===
|
|
3113
|
+
guestKey: invitation.authMethod === import_services9.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3233
3114
|
});
|
|
3234
3115
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3235
|
-
F:
|
|
3116
|
+
F: __dxlog_file11,
|
|
3236
3117
|
L: 143,
|
|
3237
3118
|
S: this,
|
|
3238
3119
|
A: [
|
|
@@ -3247,7 +3128,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3247
3128
|
}
|
|
3248
3129
|
async cancelDelegation(invitation) {
|
|
3249
3130
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3250
|
-
F:
|
|
3131
|
+
F: __dxlog_file11,
|
|
3251
3132
|
L: 149,
|
|
3252
3133
|
S: this,
|
|
3253
3134
|
A: [
|
|
@@ -3255,8 +3136,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3255
3136
|
""
|
|
3256
3137
|
]
|
|
3257
3138
|
});
|
|
3258
|
-
(0, import_invariant10.invariant)(invitation.type ===
|
|
3259
|
-
F:
|
|
3139
|
+
(0, import_invariant10.invariant)(invitation.type === import_services9.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3140
|
+
F: __dxlog_file11,
|
|
3260
3141
|
L: 150,
|
|
3261
3142
|
S: this,
|
|
3262
3143
|
A: [
|
|
@@ -3266,7 +3147,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3266
3147
|
});
|
|
3267
3148
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3268
3149
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3269
|
-
F:
|
|
3150
|
+
F: __dxlog_file11,
|
|
3270
3151
|
L: 152,
|
|
3271
3152
|
S: this,
|
|
3272
3153
|
A: [
|
|
@@ -3274,18 +3155,18 @@ var SpaceInvitationProtocol = class {
|
|
|
3274
3155
|
""
|
|
3275
3156
|
]
|
|
3276
3157
|
});
|
|
3277
|
-
(0,
|
|
3158
|
+
(0, import_log8.log)("cancelling delegated space invitation", {
|
|
3278
3159
|
host: this._signingContext.deviceKey,
|
|
3279
3160
|
id: invitation.invitationId
|
|
3280
3161
|
}, {
|
|
3281
|
-
F:
|
|
3162
|
+
F: __dxlog_file11,
|
|
3282
3163
|
L: 154,
|
|
3283
3164
|
S: this,
|
|
3284
3165
|
C: (f, a) => f(...a)
|
|
3285
3166
|
});
|
|
3286
|
-
const credential = await (0,
|
|
3167
|
+
const credential = await (0, import_credentials8.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3287
3168
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3288
|
-
F:
|
|
3169
|
+
F: __dxlog_file11,
|
|
3289
3170
|
L: 161,
|
|
3290
3171
|
S: this,
|
|
3291
3172
|
A: [
|
|
@@ -3324,7 +3205,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3324
3205
|
}
|
|
3325
3206
|
async accept(response) {
|
|
3326
3207
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3327
|
-
F:
|
|
3208
|
+
F: __dxlog_file11,
|
|
3328
3209
|
L: 196,
|
|
3329
3210
|
S: this,
|
|
3330
3211
|
A: [
|
|
@@ -3333,9 +3214,9 @@ var SpaceInvitationProtocol = class {
|
|
|
3333
3214
|
]
|
|
3334
3215
|
});
|
|
3335
3216
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3336
|
-
const assertion = (0,
|
|
3217
|
+
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
3337
3218
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3338
|
-
F:
|
|
3219
|
+
F: __dxlog_file11,
|
|
3339
3220
|
L: 199,
|
|
3340
3221
|
S: this,
|
|
3341
3222
|
A: [
|
|
@@ -3344,7 +3225,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3344
3225
|
]
|
|
3345
3226
|
});
|
|
3346
3227
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3347
|
-
F:
|
|
3228
|
+
F: __dxlog_file11,
|
|
3348
3229
|
L: 200,
|
|
3349
3230
|
S: this,
|
|
3350
3231
|
A: [
|
|
@@ -3367,7 +3248,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3367
3248
|
};
|
|
3368
3249
|
}
|
|
3369
3250
|
};
|
|
3370
|
-
var
|
|
3251
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3371
3252
|
var InvitationsManager = class {
|
|
3372
3253
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3373
3254
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3409,8 +3290,8 @@ var InvitationsManager = class {
|
|
|
3409
3290
|
try {
|
|
3410
3291
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3411
3292
|
} catch (err) {
|
|
3412
|
-
|
|
3413
|
-
F:
|
|
3293
|
+
import_log9.log.catch(err, void 0, {
|
|
3294
|
+
F: __dxlog_file12,
|
|
3414
3295
|
L: 82,
|
|
3415
3296
|
S: this,
|
|
3416
3297
|
C: (f, a) => f(...a)
|
|
@@ -3433,7 +3314,7 @@ var InvitationsManager = class {
|
|
|
3433
3314
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
3434
3315
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3435
3316
|
(0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3436
|
-
F:
|
|
3317
|
+
F: __dxlog_file12,
|
|
3437
3318
|
L: 103,
|
|
3438
3319
|
S: this,
|
|
3439
3320
|
A: [
|
|
@@ -3451,8 +3332,8 @@ var InvitationsManager = class {
|
|
|
3451
3332
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
3452
3333
|
};
|
|
3453
3334
|
} catch (err) {
|
|
3454
|
-
|
|
3455
|
-
F:
|
|
3335
|
+
import_log9.log.catch(err, void 0, {
|
|
3336
|
+
F: __dxlog_file12,
|
|
3456
3337
|
L: 110,
|
|
3457
3338
|
S: this,
|
|
3458
3339
|
C: (f, a) => f(...a)
|
|
@@ -3483,14 +3364,14 @@ var InvitationsManager = class {
|
|
|
3483
3364
|
return invitation;
|
|
3484
3365
|
}
|
|
3485
3366
|
async authenticate({ invitationId, authCode }) {
|
|
3486
|
-
(0,
|
|
3487
|
-
F:
|
|
3367
|
+
(0, import_log9.log)("authenticating...", void 0, {
|
|
3368
|
+
F: __dxlog_file12,
|
|
3488
3369
|
L: 140,
|
|
3489
3370
|
S: this,
|
|
3490
3371
|
C: (f, a) => f(...a)
|
|
3491
3372
|
});
|
|
3492
3373
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3493
|
-
F:
|
|
3374
|
+
F: __dxlog_file12,
|
|
3494
3375
|
L: 141,
|
|
3495
3376
|
S: this,
|
|
3496
3377
|
A: [
|
|
@@ -3500,10 +3381,10 @@ var InvitationsManager = class {
|
|
|
3500
3381
|
});
|
|
3501
3382
|
const observable = this._acceptInvitations.get(invitationId);
|
|
3502
3383
|
if (!observable) {
|
|
3503
|
-
|
|
3384
|
+
import_log9.log.warn("invalid invitation", {
|
|
3504
3385
|
invitationId
|
|
3505
3386
|
}, {
|
|
3506
|
-
F:
|
|
3387
|
+
F: __dxlog_file12,
|
|
3507
3388
|
L: 144,
|
|
3508
3389
|
S: this,
|
|
3509
3390
|
C: (f, a) => f(...a)
|
|
@@ -3513,16 +3394,16 @@ var InvitationsManager = class {
|
|
|
3513
3394
|
}
|
|
3514
3395
|
}
|
|
3515
3396
|
async cancelInvitation({ invitationId }) {
|
|
3516
|
-
(0,
|
|
3397
|
+
(0, import_log9.log)("cancelInvitation...", {
|
|
3517
3398
|
invitationId
|
|
3518
3399
|
}, {
|
|
3519
|
-
F:
|
|
3400
|
+
F: __dxlog_file12,
|
|
3520
3401
|
L: 151,
|
|
3521
3402
|
S: this,
|
|
3522
3403
|
C: (f, a) => f(...a)
|
|
3523
3404
|
});
|
|
3524
3405
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3525
|
-
F:
|
|
3406
|
+
F: __dxlog_file12,
|
|
3526
3407
|
L: 152,
|
|
3527
3408
|
S: this,
|
|
3528
3409
|
A: [
|
|
@@ -3535,7 +3416,7 @@ var InvitationsManager = class {
|
|
|
3535
3416
|
if (created.get().persistent) {
|
|
3536
3417
|
await this._metadataStore.removeInvitation(invitationId);
|
|
3537
3418
|
}
|
|
3538
|
-
if (created.get().type ===
|
|
3419
|
+
if (created.get().type === import_services10.Invitation.Type.DELEGATED) {
|
|
3539
3420
|
const handler = this._getHandler(created.get());
|
|
3540
3421
|
await handler.cancelDelegation(created.get());
|
|
3541
3422
|
}
|
|
@@ -3569,8 +3450,8 @@ var InvitationsManager = class {
|
|
|
3569
3450
|
}
|
|
3570
3451
|
}
|
|
3571
3452
|
_createInvitation(protocol, options) {
|
|
3572
|
-
const { invitationId =
|
|
3573
|
-
const authCode = options?.authCode ?? (authMethod ===
|
|
3453
|
+
const { invitationId = import_keys8.PublicKey.random().toHex(), type = import_services10.Invitation.Type.INTERACTIVE, authMethod = import_services10.Invitation.AuthMethod.SHARED_SECRET, state = import_services10.Invitation.State.INIT, timeout = import_client_protocol3.INVITATION_TIMEOUT, swarmKey = import_keys8.PublicKey.random(), persistent = options?.authMethod !== import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials11.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false } = options ?? {};
|
|
3454
|
+
const authCode = options?.authCode ?? (authMethod === import_services10.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials10.generatePasscode)(import_client_protocol3.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
3574
3455
|
return {
|
|
3575
3456
|
invitationId,
|
|
3576
3457
|
type,
|
|
@@ -3579,8 +3460,8 @@ var InvitationsManager = class {
|
|
|
3579
3460
|
swarmKey,
|
|
3580
3461
|
authCode,
|
|
3581
3462
|
timeout,
|
|
3582
|
-
persistent: persistent && type !==
|
|
3583
|
-
guestKeypair: guestKeypair ?? (authMethod ===
|
|
3463
|
+
persistent: persistent && type !== import_services10.Invitation.Type.DELEGATED,
|
|
3464
|
+
guestKeypair: guestKeypair ?? (authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
|
|
3584
3465
|
created,
|
|
3585
3466
|
lifetime,
|
|
3586
3467
|
role,
|
|
@@ -3591,17 +3472,17 @@ var InvitationsManager = class {
|
|
|
3591
3472
|
}
|
|
3592
3473
|
_createObservableInvitation(handler, invitation) {
|
|
3593
3474
|
const stream = new import_async11.PushStream();
|
|
3594
|
-
const ctx = new
|
|
3475
|
+
const ctx = new import_context8.Context({
|
|
3595
3476
|
onError: (err) => {
|
|
3596
3477
|
stream.error(err);
|
|
3597
3478
|
void ctx.dispose();
|
|
3598
3479
|
}
|
|
3599
3480
|
});
|
|
3600
3481
|
ctx.onDispose(() => {
|
|
3601
|
-
(0,
|
|
3482
|
+
(0, import_log9.log)("complete", {
|
|
3602
3483
|
...handler.toJSON()
|
|
3603
3484
|
}, {
|
|
3604
|
-
F:
|
|
3485
|
+
F: __dxlog_file12,
|
|
3605
3486
|
L: 241,
|
|
3606
3487
|
S: this,
|
|
3607
3488
|
C: (f, a) => f(...a)
|
|
@@ -3614,7 +3495,7 @@ var InvitationsManager = class {
|
|
|
3614
3495
|
onCancel: async () => {
|
|
3615
3496
|
stream.next({
|
|
3616
3497
|
...invitation,
|
|
3617
|
-
state:
|
|
3498
|
+
state: import_services10.Invitation.State.CANCELLED
|
|
3618
3499
|
});
|
|
3619
3500
|
await ctx.dispose();
|
|
3620
3501
|
}
|
|
@@ -3628,41 +3509,41 @@ var InvitationsManager = class {
|
|
|
3628
3509
|
_createObservableAcceptingInvitation(handler, initialState) {
|
|
3629
3510
|
const otpEnteredTrigger = new import_async11.Trigger();
|
|
3630
3511
|
const stream = new import_async11.PushStream();
|
|
3631
|
-
const ctx = new
|
|
3512
|
+
const ctx = new import_context8.Context({
|
|
3632
3513
|
onError: (err) => {
|
|
3633
3514
|
if (err instanceof import_async11.TimeoutError) {
|
|
3634
|
-
(0,
|
|
3515
|
+
(0, import_log9.log)("timeout", {
|
|
3635
3516
|
...handler.toJSON()
|
|
3636
3517
|
}, {
|
|
3637
|
-
F:
|
|
3518
|
+
F: __dxlog_file12,
|
|
3638
3519
|
L: 261,
|
|
3639
3520
|
S: this,
|
|
3640
3521
|
C: (f, a) => f(...a)
|
|
3641
3522
|
});
|
|
3642
3523
|
stream.next({
|
|
3643
3524
|
...initialState,
|
|
3644
|
-
state:
|
|
3525
|
+
state: import_services10.Invitation.State.TIMEOUT
|
|
3645
3526
|
});
|
|
3646
3527
|
} else {
|
|
3647
|
-
|
|
3648
|
-
F:
|
|
3528
|
+
import_log9.log.warn("auth failed", err, {
|
|
3529
|
+
F: __dxlog_file12,
|
|
3649
3530
|
L: 264,
|
|
3650
3531
|
S: this,
|
|
3651
3532
|
C: (f, a) => f(...a)
|
|
3652
3533
|
});
|
|
3653
3534
|
stream.next({
|
|
3654
3535
|
...initialState,
|
|
3655
|
-
state:
|
|
3536
|
+
state: import_services10.Invitation.State.ERROR
|
|
3656
3537
|
});
|
|
3657
3538
|
}
|
|
3658
3539
|
void ctx.dispose();
|
|
3659
3540
|
}
|
|
3660
3541
|
});
|
|
3661
3542
|
ctx.onDispose(() => {
|
|
3662
|
-
(0,
|
|
3543
|
+
(0, import_log9.log)("complete", {
|
|
3663
3544
|
...handler.toJSON()
|
|
3664
3545
|
}, {
|
|
3665
|
-
F:
|
|
3546
|
+
F: __dxlog_file12,
|
|
3666
3547
|
L: 271,
|
|
3667
3548
|
S: this,
|
|
3668
3549
|
C: (f, a) => f(...a)
|
|
@@ -3675,7 +3556,7 @@ var InvitationsManager = class {
|
|
|
3675
3556
|
onCancel: async () => {
|
|
3676
3557
|
stream.next({
|
|
3677
3558
|
...initialState,
|
|
3678
|
-
state:
|
|
3559
|
+
state: import_services10.Invitation.State.CANCELLED
|
|
3679
3560
|
});
|
|
3680
3561
|
await ctx.dispose();
|
|
3681
3562
|
},
|
|
@@ -3691,7 +3572,7 @@ var InvitationsManager = class {
|
|
|
3691
3572
|
};
|
|
3692
3573
|
}
|
|
3693
3574
|
async _persistIfRequired(handler, changeStream, invitation) {
|
|
3694
|
-
if (invitation.type ===
|
|
3575
|
+
if (invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
|
|
3695
3576
|
const delegationCredentialId = await handler.delegate(invitation);
|
|
3696
3577
|
changeStream.next({
|
|
3697
3578
|
...invitation,
|
|
@@ -3706,8 +3587,8 @@ var InvitationsManager = class {
|
|
|
3706
3587
|
try {
|
|
3707
3588
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3708
3589
|
} catch (err) {
|
|
3709
|
-
|
|
3710
|
-
F:
|
|
3590
|
+
import_log9.log.catch(err, void 0, {
|
|
3591
|
+
F: __dxlog_file12,
|
|
3711
3592
|
L: 307,
|
|
3712
3593
|
S: this,
|
|
3713
3594
|
C: (f, a) => f(...a)
|
|
@@ -3729,7 +3610,7 @@ var AutomergeSpaceState = class {
|
|
|
3729
3610
|
this._isProcessingRootDocs = false;
|
|
3730
3611
|
}
|
|
3731
3612
|
async processCredential(credential) {
|
|
3732
|
-
if (!(0,
|
|
3613
|
+
if (!(0, import_credentials13.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
3733
3614
|
return;
|
|
3734
3615
|
}
|
|
3735
3616
|
this.lastEpoch = credential;
|
|
@@ -3754,18 +3635,18 @@ var AutomergeSpaceState = class {
|
|
|
3754
3635
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3755
3636
|
}
|
|
3756
3637
|
};
|
|
3757
|
-
var
|
|
3638
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3758
3639
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3759
3640
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3760
3641
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3761
3642
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3762
3643
|
var NotarizationPlugin = class {
|
|
3763
3644
|
constructor() {
|
|
3764
|
-
this._ctx = new
|
|
3645
|
+
this._ctx = new import_context10.Context();
|
|
3765
3646
|
this._extensionOpened = new import_async14.Event();
|
|
3766
3647
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3767
|
-
this._processedCredentials = new import_util7.ComplexSet(
|
|
3768
|
-
this._processCredentialsTriggers = new import_util7.ComplexMap(
|
|
3648
|
+
this._processedCredentials = new import_util7.ComplexSet(import_keys10.PublicKey.hash);
|
|
3649
|
+
this._processCredentialsTriggers = new import_util7.ComplexMap(import_keys10.PublicKey.hash);
|
|
3769
3650
|
}
|
|
3770
3651
|
get hasWriter() {
|
|
3771
3652
|
return !!this._writer;
|
|
@@ -3779,16 +3660,16 @@ var NotarizationPlugin = class {
|
|
|
3779
3660
|
* Request credentials to be notarized.
|
|
3780
3661
|
*/
|
|
3781
3662
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
3782
|
-
(0,
|
|
3663
|
+
(0, import_log11.log)("notarize", {
|
|
3783
3664
|
credentials
|
|
3784
3665
|
}, {
|
|
3785
|
-
F:
|
|
3666
|
+
F: __dxlog_file13,
|
|
3786
3667
|
L: 90,
|
|
3787
3668
|
S: this,
|
|
3788
3669
|
C: (f, a) => f(...a)
|
|
3789
3670
|
});
|
|
3790
3671
|
(0, import_invariant13.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3791
|
-
F:
|
|
3672
|
+
F: __dxlog_file13,
|
|
3792
3673
|
L: 91,
|
|
3793
3674
|
S: this,
|
|
3794
3675
|
A: [
|
|
@@ -3799,10 +3680,10 @@ var NotarizationPlugin = class {
|
|
|
3799
3680
|
const errors = new import_async14.Trigger();
|
|
3800
3681
|
const ctx = this._ctx.derive({
|
|
3801
3682
|
onError: (err) => {
|
|
3802
|
-
|
|
3683
|
+
import_log11.log.warn("Notarization error", {
|
|
3803
3684
|
err
|
|
3804
3685
|
}, {
|
|
3805
|
-
F:
|
|
3686
|
+
F: __dxlog_file13,
|
|
3806
3687
|
L: 99,
|
|
3807
3688
|
S: this,
|
|
3808
3689
|
C: (f, a) => f(...a)
|
|
@@ -3814,11 +3695,11 @@ var NotarizationPlugin = class {
|
|
|
3814
3695
|
opCtx?.onDispose(() => ctx.dispose());
|
|
3815
3696
|
if (timeout !== 0) {
|
|
3816
3697
|
(0, import_async14.scheduleTask)(ctx, () => {
|
|
3817
|
-
|
|
3698
|
+
import_log11.log.warn("Notarization timeout", {
|
|
3818
3699
|
timeout,
|
|
3819
3700
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3820
3701
|
}, {
|
|
3821
|
-
F:
|
|
3702
|
+
F: __dxlog_file13,
|
|
3822
3703
|
L: 111,
|
|
3823
3704
|
S: this,
|
|
3824
3705
|
C: (f, a) => f(...a)
|
|
@@ -3838,10 +3719,10 @@ var NotarizationPlugin = class {
|
|
|
3838
3719
|
...this._extensions
|
|
3839
3720
|
].find((peer2) => !peersTried.has(peer2));
|
|
3840
3721
|
if (!peer) {
|
|
3841
|
-
|
|
3722
|
+
import_log11.log.info("Exhausted all peers to notarize with", {
|
|
3842
3723
|
retryIn: retryTimeout
|
|
3843
3724
|
}, {
|
|
3844
|
-
F:
|
|
3725
|
+
F: __dxlog_file13,
|
|
3845
3726
|
L: 136,
|
|
3846
3727
|
S: this,
|
|
3847
3728
|
C: (f, a) => f(...a)
|
|
@@ -3851,11 +3732,11 @@ var NotarizationPlugin = class {
|
|
|
3851
3732
|
return;
|
|
3852
3733
|
}
|
|
3853
3734
|
peersTried.add(peer);
|
|
3854
|
-
(0,
|
|
3735
|
+
(0, import_log11.log)("try notarizing", {
|
|
3855
3736
|
peer: peer.localPeerId,
|
|
3856
3737
|
credentialId: credentials.map((credential) => credential.id)
|
|
3857
3738
|
}, {
|
|
3858
|
-
F:
|
|
3739
|
+
F: __dxlog_file13,
|
|
3859
3740
|
L: 143,
|
|
3860
3741
|
S: this,
|
|
3861
3742
|
C: (f, a) => f(...a)
|
|
@@ -3863,8 +3744,8 @@ var NotarizationPlugin = class {
|
|
|
3863
3744
|
await peer.rpc.NotarizationService.notarize({
|
|
3864
3745
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
3865
3746
|
});
|
|
3866
|
-
(0,
|
|
3867
|
-
F:
|
|
3747
|
+
(0, import_log11.log)("success", void 0, {
|
|
3748
|
+
F: __dxlog_file13,
|
|
3868
3749
|
L: 147,
|
|
3869
3750
|
S: this,
|
|
3870
3751
|
C: (f, a) => f(...a)
|
|
@@ -3872,8 +3753,8 @@ var NotarizationPlugin = class {
|
|
|
3872
3753
|
await (0, import_async14.sleep)(successDelay);
|
|
3873
3754
|
} catch (err) {
|
|
3874
3755
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
3875
|
-
|
|
3876
|
-
F:
|
|
3756
|
+
import_log11.log.info("error notarizing (recoverable)", err, {
|
|
3757
|
+
F: __dxlog_file13,
|
|
3877
3758
|
L: 151,
|
|
3878
3759
|
S: this,
|
|
3879
3760
|
C: (f, a) => f(...a)
|
|
@@ -3886,12 +3767,12 @@ var NotarizationPlugin = class {
|
|
|
3886
3767
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
3887
3768
|
try {
|
|
3888
3769
|
await Promise.race([
|
|
3889
|
-
(0,
|
|
3770
|
+
(0, import_context10.rejectOnDispose)(ctx),
|
|
3890
3771
|
allNotarized,
|
|
3891
3772
|
errors.wait()
|
|
3892
3773
|
]);
|
|
3893
|
-
(0,
|
|
3894
|
-
F:
|
|
3774
|
+
(0, import_log11.log)("done", void 0, {
|
|
3775
|
+
F: __dxlog_file13,
|
|
3895
3776
|
L: 162,
|
|
3896
3777
|
S: this,
|
|
3897
3778
|
C: (f, a) => f(...a)
|
|
@@ -3913,7 +3794,7 @@ var NotarizationPlugin = class {
|
|
|
3913
3794
|
}
|
|
3914
3795
|
setWriter(writer) {
|
|
3915
3796
|
(0, import_invariant13.invariant)(!this._writer, "Writer already set.", {
|
|
3916
|
-
F:
|
|
3797
|
+
F: __dxlog_file13,
|
|
3917
3798
|
L: 181,
|
|
3918
3799
|
S: this,
|
|
3919
3800
|
A: [
|
|
@@ -3938,7 +3819,7 @@ var NotarizationPlugin = class {
|
|
|
3938
3819
|
}
|
|
3939
3820
|
for (const credential of request.credentials ?? []) {
|
|
3940
3821
|
(0, import_invariant13.invariant)(credential.id, "Credential must have an id", {
|
|
3941
|
-
F:
|
|
3822
|
+
F: __dxlog_file13,
|
|
3942
3823
|
L: 200,
|
|
3943
3824
|
S: this,
|
|
3944
3825
|
A: [
|
|
@@ -3955,10 +3836,10 @@ var NotarizationPlugin = class {
|
|
|
3955
3836
|
createExtension() {
|
|
3956
3837
|
const extension = new NotarizationTeleportExtension({
|
|
3957
3838
|
onOpen: async () => {
|
|
3958
|
-
(0,
|
|
3839
|
+
(0, import_log11.log)("extension opened", {
|
|
3959
3840
|
peer: extension.localPeerId
|
|
3960
3841
|
}, {
|
|
3961
|
-
F:
|
|
3842
|
+
F: __dxlog_file13,
|
|
3962
3843
|
L: 211,
|
|
3963
3844
|
S: this,
|
|
3964
3845
|
C: (f, a) => f(...a)
|
|
@@ -3967,10 +3848,10 @@ var NotarizationPlugin = class {
|
|
|
3967
3848
|
this._extensionOpened.emit();
|
|
3968
3849
|
},
|
|
3969
3850
|
onClose: async () => {
|
|
3970
|
-
(0,
|
|
3851
|
+
(0, import_log11.log)("extension closed", {
|
|
3971
3852
|
peer: extension.localPeerId
|
|
3972
3853
|
}, {
|
|
3973
|
-
F:
|
|
3854
|
+
F: __dxlog_file13,
|
|
3974
3855
|
L: 216,
|
|
3975
3856
|
S: this,
|
|
3976
3857
|
C: (f, a) => f(...a)
|
|
@@ -4022,14 +3903,14 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
4022
3903
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4023
3904
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4024
3905
|
}
|
|
4025
|
-
var
|
|
3906
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4026
3907
|
var DataSpace = class {
|
|
4027
3908
|
constructor(params) {
|
|
4028
|
-
this._ctx = new
|
|
3909
|
+
this._ctx = new import_context9.Context();
|
|
4029
3910
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4030
3911
|
this._cache = void 0;
|
|
4031
3912
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4032
|
-
this._state =
|
|
3913
|
+
this._state = import_services11.SpaceState.CLOSED;
|
|
4033
3914
|
this.error = void 0;
|
|
4034
3915
|
this.stateUpdate = new import_async12.Event();
|
|
4035
3916
|
this.metrics = {};
|
|
@@ -4044,16 +3925,16 @@ var DataSpace = class {
|
|
|
4044
3925
|
this._callbacks = params.callbacks ?? {};
|
|
4045
3926
|
this._echoHost = params.echoHost;
|
|
4046
3927
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
4047
|
-
trustedKeysProvider: () => new import_util6.ComplexSet(
|
|
3928
|
+
trustedKeysProvider: () => new import_util6.ComplexSet(import_keys9.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials12.SpaceMember.Role.REMOVED).map((member) => member.key)),
|
|
4048
3929
|
update: this._inner.stateUpdate,
|
|
4049
3930
|
authTimeout: import_client_protocol4.AUTH_TIMEOUT
|
|
4050
3931
|
});
|
|
4051
3932
|
this._cache = params.cache;
|
|
4052
3933
|
this._state = params.initialState;
|
|
4053
|
-
(0,
|
|
4054
|
-
state:
|
|
3934
|
+
(0, import_log10.log)("new state", {
|
|
3935
|
+
state: import_services11.SpaceState[this._state]
|
|
4055
3936
|
}, {
|
|
4056
|
-
F:
|
|
3937
|
+
F: __dxlog_file14,
|
|
4057
3938
|
L: 143,
|
|
4058
3939
|
S: this,
|
|
4059
3940
|
C: (f, a) => f(...a)
|
|
@@ -4094,23 +3975,20 @@ var DataSpace = class {
|
|
|
4094
3975
|
};
|
|
4095
3976
|
}
|
|
4096
3977
|
async open() {
|
|
4097
|
-
|
|
4098
|
-
await this._open();
|
|
4099
|
-
}
|
|
3978
|
+
await this._open();
|
|
4100
3979
|
}
|
|
4101
3980
|
async _open() {
|
|
4102
|
-
await this._presence.open();
|
|
4103
3981
|
await this._gossip.open();
|
|
4104
3982
|
await this._notarizationPlugin.open();
|
|
4105
3983
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4106
3984
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4107
|
-
await this._inner.open(new
|
|
4108
|
-
this._state =
|
|
4109
|
-
(0,
|
|
4110
|
-
state:
|
|
3985
|
+
await this._inner.open(new import_context9.Context());
|
|
3986
|
+
this._state = import_services11.SpaceState.CONTROL_ONLY;
|
|
3987
|
+
(0, import_log10.log)("new state", {
|
|
3988
|
+
state: import_services11.SpaceState[this._state]
|
|
4111
3989
|
}, {
|
|
4112
|
-
F:
|
|
4113
|
-
L:
|
|
3990
|
+
F: __dxlog_file14,
|
|
3991
|
+
L: 206,
|
|
4114
3992
|
S: this,
|
|
4115
3993
|
C: (f, a) => f(...a)
|
|
4116
3994
|
});
|
|
@@ -4123,23 +4001,23 @@ var DataSpace = class {
|
|
|
4123
4001
|
}
|
|
4124
4002
|
async _close() {
|
|
4125
4003
|
await this._callbacks.beforeClose?.();
|
|
4126
|
-
this._state =
|
|
4127
|
-
(0,
|
|
4128
|
-
state:
|
|
4004
|
+
this._state = import_services11.SpaceState.CLOSED;
|
|
4005
|
+
(0, import_log10.log)("new state", {
|
|
4006
|
+
state: import_services11.SpaceState[this._state]
|
|
4129
4007
|
}, {
|
|
4130
|
-
F:
|
|
4131
|
-
L:
|
|
4008
|
+
F: __dxlog_file14,
|
|
4009
|
+
L: 220,
|
|
4132
4010
|
S: this,
|
|
4133
4011
|
C: (f, a) => f(...a)
|
|
4134
4012
|
});
|
|
4135
4013
|
await this._ctx.dispose();
|
|
4136
|
-
this._ctx = new
|
|
4014
|
+
this._ctx = new import_context9.Context();
|
|
4137
4015
|
await this.authVerifier.close();
|
|
4138
4016
|
await this._inner.close();
|
|
4139
4017
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
4140
4018
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
4141
4019
|
await this._notarizationPlugin.close();
|
|
4142
|
-
await this._presence.
|
|
4020
|
+
await this._presence.destroy();
|
|
4143
4021
|
await this._gossip.close();
|
|
4144
4022
|
}
|
|
4145
4023
|
async postMessage(channel, message) {
|
|
@@ -4157,27 +4035,27 @@ var DataSpace = class {
|
|
|
4157
4035
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
4158
4036
|
await this.initializeDataPipeline();
|
|
4159
4037
|
} catch (err) {
|
|
4160
|
-
if (err instanceof import_protocols9.CancelledError || err instanceof
|
|
4161
|
-
(0,
|
|
4162
|
-
F:
|
|
4163
|
-
L:
|
|
4038
|
+
if (err instanceof import_protocols9.CancelledError || err instanceof import_context9.ContextDisposedError) {
|
|
4039
|
+
(0, import_log10.log)("data pipeline initialization cancelled", err, {
|
|
4040
|
+
F: __dxlog_file14,
|
|
4041
|
+
L: 253,
|
|
4164
4042
|
S: this,
|
|
4165
4043
|
C: (f, a) => f(...a)
|
|
4166
4044
|
});
|
|
4167
4045
|
return;
|
|
4168
4046
|
}
|
|
4169
|
-
|
|
4170
|
-
F:
|
|
4171
|
-
L:
|
|
4047
|
+
import_log10.log.error("Error initializing data pipeline", err, {
|
|
4048
|
+
F: __dxlog_file14,
|
|
4049
|
+
L: 257,
|
|
4172
4050
|
S: this,
|
|
4173
4051
|
C: (f, a) => f(...a)
|
|
4174
4052
|
});
|
|
4175
|
-
this._state =
|
|
4176
|
-
(0,
|
|
4177
|
-
state:
|
|
4053
|
+
this._state = import_services11.SpaceState.ERROR;
|
|
4054
|
+
(0, import_log10.log)("new state", {
|
|
4055
|
+
state: import_services11.SpaceState[this._state]
|
|
4178
4056
|
}, {
|
|
4179
|
-
F:
|
|
4180
|
-
L:
|
|
4057
|
+
F: __dxlog_file14,
|
|
4058
|
+
L: 259,
|
|
4181
4059
|
S: this,
|
|
4182
4060
|
C: (f, a) => f(...a)
|
|
4183
4061
|
});
|
|
@@ -4189,35 +4067,35 @@ var DataSpace = class {
|
|
|
4189
4067
|
});
|
|
4190
4068
|
}
|
|
4191
4069
|
async initializeDataPipeline() {
|
|
4192
|
-
if (this._state !==
|
|
4070
|
+
if (this._state !== import_services11.SpaceState.CONTROL_ONLY) {
|
|
4193
4071
|
throw new import_protocols9.SystemError("Invalid operation");
|
|
4194
4072
|
}
|
|
4195
|
-
this._state =
|
|
4196
|
-
(0,
|
|
4197
|
-
state:
|
|
4073
|
+
this._state = import_services11.SpaceState.INITIALIZING;
|
|
4074
|
+
(0, import_log10.log)("new state", {
|
|
4075
|
+
state: import_services11.SpaceState[this._state]
|
|
4198
4076
|
}, {
|
|
4199
|
-
F:
|
|
4200
|
-
L:
|
|
4077
|
+
F: __dxlog_file14,
|
|
4078
|
+
L: 275,
|
|
4201
4079
|
S: this,
|
|
4202
4080
|
C: (f, a) => f(...a)
|
|
4203
4081
|
});
|
|
4204
4082
|
await this._initializeAndReadControlPipeline();
|
|
4205
4083
|
await (0, import_async12.sleep)(1);
|
|
4206
4084
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4207
|
-
await (0,
|
|
4208
|
-
(0,
|
|
4209
|
-
F:
|
|
4210
|
-
L:
|
|
4085
|
+
await (0, import_context9.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
4086
|
+
(0, import_log10.log)("data pipeline ready", void 0, {
|
|
4087
|
+
F: __dxlog_file14,
|
|
4088
|
+
L: 287,
|
|
4211
4089
|
S: this,
|
|
4212
4090
|
C: (f, a) => f(...a)
|
|
4213
4091
|
});
|
|
4214
4092
|
await this._callbacks.beforeReady?.();
|
|
4215
|
-
this._state =
|
|
4216
|
-
(0,
|
|
4217
|
-
state:
|
|
4093
|
+
this._state = import_services11.SpaceState.READY;
|
|
4094
|
+
(0, import_log10.log)("new state", {
|
|
4095
|
+
state: import_services11.SpaceState[this._state]
|
|
4218
4096
|
}, {
|
|
4219
|
-
F:
|
|
4220
|
-
L:
|
|
4097
|
+
F: __dxlog_file14,
|
|
4098
|
+
L: 291,
|
|
4221
4099
|
S: this,
|
|
4222
4100
|
C: (f, a) => f(...a)
|
|
4223
4101
|
});
|
|
@@ -4231,9 +4109,9 @@ var DataSpace = class {
|
|
|
4231
4109
|
});
|
|
4232
4110
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4233
4111
|
await this._createWritableFeeds();
|
|
4234
|
-
(0,
|
|
4235
|
-
F:
|
|
4236
|
-
L:
|
|
4112
|
+
(0, import_log10.log)("writable feeds created", void 0, {
|
|
4113
|
+
F: __dxlog_file14,
|
|
4114
|
+
L: 307,
|
|
4237
4115
|
S: this,
|
|
4238
4116
|
C: (f, a) => f(...a)
|
|
4239
4117
|
});
|
|
@@ -4260,7 +4138,7 @@ var DataSpace = class {
|
|
|
4260
4138
|
spaceKey: this.key,
|
|
4261
4139
|
deviceKey: this._signingContext.deviceKey,
|
|
4262
4140
|
identityKey: this._signingContext.identityKey,
|
|
4263
|
-
designation:
|
|
4141
|
+
designation: import_credentials12.AdmittedFeed.Designation.CONTROL
|
|
4264
4142
|
}
|
|
4265
4143
|
}));
|
|
4266
4144
|
}
|
|
@@ -4277,7 +4155,7 @@ var DataSpace = class {
|
|
|
4277
4155
|
spaceKey: this.key,
|
|
4278
4156
|
deviceKey: this._signingContext.deviceKey,
|
|
4279
4157
|
identityKey: this._signingContext.identityKey,
|
|
4280
|
-
designation:
|
|
4158
|
+
designation: import_credentials12.AdmittedFeed.Designation.DATA
|
|
4281
4159
|
}
|
|
4282
4160
|
}));
|
|
4283
4161
|
}
|
|
@@ -4291,12 +4169,12 @@ var DataSpace = class {
|
|
|
4291
4169
|
}
|
|
4292
4170
|
}
|
|
4293
4171
|
_onNewAutomergeRoot(rootUrl) {
|
|
4294
|
-
(0,
|
|
4172
|
+
(0, import_log10.log)("loading automerge root doc for space", {
|
|
4295
4173
|
space: this.key,
|
|
4296
4174
|
rootUrl
|
|
4297
4175
|
}, {
|
|
4298
|
-
F:
|
|
4299
|
-
L:
|
|
4176
|
+
F: __dxlog_file14,
|
|
4177
|
+
L: 373,
|
|
4300
4178
|
S: this,
|
|
4301
4179
|
C: (f, a) => f(...a)
|
|
4302
4180
|
});
|
|
@@ -4305,7 +4183,7 @@ var DataSpace = class {
|
|
|
4305
4183
|
queueMicrotask(async () => {
|
|
4306
4184
|
try {
|
|
4307
4185
|
await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4308
|
-
await (0,
|
|
4186
|
+
await (0, import_context9.cancelWithContext)(this._ctx, handle.whenReady());
|
|
4309
4187
|
});
|
|
4310
4188
|
if (this._ctx.disposed) {
|
|
4311
4189
|
return;
|
|
@@ -4321,27 +4199,27 @@ var DataSpace = class {
|
|
|
4321
4199
|
if (!this._echoHost.roots.has(handle.documentId)) {
|
|
4322
4200
|
await this._echoHost.openSpaceRoot(handle.url);
|
|
4323
4201
|
} else {
|
|
4324
|
-
|
|
4202
|
+
import_log10.log.warn("echo database root already exists", {
|
|
4325
4203
|
space: this.key,
|
|
4326
4204
|
rootUrl
|
|
4327
4205
|
}, {
|
|
4328
|
-
F:
|
|
4329
|
-
L:
|
|
4206
|
+
F: __dxlog_file14,
|
|
4207
|
+
L: 400,
|
|
4330
4208
|
S: this,
|
|
4331
4209
|
C: (f, a) => f(...a)
|
|
4332
4210
|
});
|
|
4333
4211
|
}
|
|
4334
4212
|
} catch (err) {
|
|
4335
|
-
if (err instanceof
|
|
4213
|
+
if (err instanceof import_context9.ContextDisposedError) {
|
|
4336
4214
|
return;
|
|
4337
4215
|
}
|
|
4338
|
-
|
|
4216
|
+
import_log10.log.warn("error loading automerge root doc", {
|
|
4339
4217
|
space: this.key,
|
|
4340
4218
|
rootUrl,
|
|
4341
4219
|
err
|
|
4342
4220
|
}, {
|
|
4343
|
-
F:
|
|
4344
|
-
L:
|
|
4221
|
+
F: __dxlog_file14,
|
|
4222
|
+
L: 406,
|
|
4345
4223
|
S: this,
|
|
4346
4224
|
C: (f, a) => f(...a)
|
|
4347
4225
|
});
|
|
@@ -4367,39 +4245,36 @@ var DataSpace = class {
|
|
|
4367
4245
|
let epoch;
|
|
4368
4246
|
switch (options?.migration) {
|
|
4369
4247
|
case void 0:
|
|
4370
|
-
case
|
|
4248
|
+
case import_services11.CreateEpochRequest.Migration.NONE:
|
|
4371
4249
|
{
|
|
4372
4250
|
epoch = {
|
|
4373
4251
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4374
4252
|
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4375
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new
|
|
4253
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
4376
4254
|
automergeRoot: this._automergeSpaceState.lastEpoch?.subject.assertion?.automergeRoot
|
|
4377
4255
|
};
|
|
4378
4256
|
}
|
|
4379
4257
|
break;
|
|
4380
|
-
case
|
|
4258
|
+
case import_services11.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
4381
4259
|
{
|
|
4382
4260
|
const document = this._echoHost.automergeRepo.create();
|
|
4383
4261
|
epoch = {
|
|
4384
4262
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4385
4263
|
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4386
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new
|
|
4264
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
4387
4265
|
automergeRoot: document.url
|
|
4388
4266
|
};
|
|
4389
4267
|
}
|
|
4390
4268
|
break;
|
|
4391
|
-
case
|
|
4269
|
+
case import_services11.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
|
|
4392
4270
|
{
|
|
4393
4271
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
4394
4272
|
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
4395
|
-
await (0,
|
|
4273
|
+
await (0, import_context9.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
4396
4274
|
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
4397
|
-
await this._echoHost.automergeRepo.flush([
|
|
4398
|
-
newRoot.documentId
|
|
4399
|
-
]);
|
|
4400
4275
|
(0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4401
|
-
F:
|
|
4402
|
-
L:
|
|
4276
|
+
F: __dxlog_file14,
|
|
4277
|
+
L: 456,
|
|
4403
4278
|
S: this,
|
|
4404
4279
|
A: [
|
|
4405
4280
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -4409,28 +4284,28 @@ var DataSpace = class {
|
|
|
4409
4284
|
epoch = {
|
|
4410
4285
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4411
4286
|
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4412
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new
|
|
4287
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
4413
4288
|
automergeRoot: newRoot.url
|
|
4414
4289
|
};
|
|
4415
4290
|
}
|
|
4416
4291
|
break;
|
|
4417
|
-
case
|
|
4292
|
+
case import_services11.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
|
|
4418
4293
|
{
|
|
4419
|
-
|
|
4420
|
-
F:
|
|
4421
|
-
L:
|
|
4294
|
+
import_log10.log.info("Fragmenting", void 0, {
|
|
4295
|
+
F: __dxlog_file14,
|
|
4296
|
+
L: 468,
|
|
4422
4297
|
S: this,
|
|
4423
4298
|
C: (f, a) => f(...a)
|
|
4424
4299
|
});
|
|
4425
4300
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
4426
4301
|
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
4427
|
-
await (0,
|
|
4302
|
+
await (0, import_context9.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
4428
4303
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
4429
4304
|
const properties = findPropertiesObject(rootHandle.docSync());
|
|
4430
4305
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4431
4306
|
(0, import_invariant12.invariant)(properties, "Properties not found", {
|
|
4432
|
-
F:
|
|
4433
|
-
L:
|
|
4307
|
+
F: __dxlog_file14,
|
|
4308
|
+
L: 478,
|
|
4434
4309
|
S: this,
|
|
4435
4310
|
A: [
|
|
4436
4311
|
"properties",
|
|
@@ -4445,8 +4320,8 @@ var DataSpace = class {
|
|
|
4445
4320
|
};
|
|
4446
4321
|
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
4447
4322
|
(0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4448
|
-
F:
|
|
4449
|
-
L:
|
|
4323
|
+
F: __dxlog_file14,
|
|
4324
|
+
L: 483,
|
|
4450
4325
|
S: this,
|
|
4451
4326
|
A: [
|
|
4452
4327
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -4469,16 +4344,16 @@ var DataSpace = class {
|
|
|
4469
4344
|
epoch = {
|
|
4470
4345
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4471
4346
|
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4472
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new
|
|
4347
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
4473
4348
|
automergeRoot: newRoot.url
|
|
4474
4349
|
};
|
|
4475
4350
|
}
|
|
4476
4351
|
break;
|
|
4477
|
-
case
|
|
4352
|
+
case import_services11.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
|
|
4478
4353
|
{
|
|
4479
4354
|
(0, import_invariant12.invariant)(options.newAutomergeRoot, void 0, {
|
|
4480
|
-
F:
|
|
4481
|
-
L:
|
|
4355
|
+
F: __dxlog_file14,
|
|
4356
|
+
L: 513,
|
|
4482
4357
|
S: this,
|
|
4483
4358
|
A: [
|
|
4484
4359
|
"options.newAutomergeRoot",
|
|
@@ -4488,7 +4363,7 @@ var DataSpace = class {
|
|
|
4488
4363
|
epoch = {
|
|
4489
4364
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4490
4365
|
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4491
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new
|
|
4366
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
|
|
4492
4367
|
automergeRoot: options.newAutomergeRoot
|
|
4493
4368
|
};
|
|
4494
4369
|
}
|
|
@@ -4508,7 +4383,7 @@ var DataSpace = class {
|
|
|
4508
4383
|
})
|
|
4509
4384
|
}
|
|
4510
4385
|
});
|
|
4511
|
-
await this.inner.controlPipeline.state.waitUntilTimeframe(new
|
|
4386
|
+
await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe2.Timeframe([
|
|
4512
4387
|
[
|
|
4513
4388
|
receipt.feedKey,
|
|
4514
4389
|
receipt.seq
|
|
@@ -4517,30 +4392,25 @@ var DataSpace = class {
|
|
|
4517
4392
|
await this._echoHost.updateIndexes();
|
|
4518
4393
|
}
|
|
4519
4394
|
async activate() {
|
|
4520
|
-
if (
|
|
4521
|
-
import_services12.SpaceState.CLOSED,
|
|
4522
|
-
import_services12.SpaceState.INACTIVE
|
|
4523
|
-
].includes(this._state)) {
|
|
4395
|
+
if (this._state !== import_services11.SpaceState.INACTIVE) {
|
|
4524
4396
|
return;
|
|
4525
4397
|
}
|
|
4526
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
4398
|
+
await this._metadataStore.setSpaceState(this.key, import_services11.SpaceState.ACTIVE);
|
|
4527
4399
|
await this._open();
|
|
4528
4400
|
this.initializeDataPipelineAsync();
|
|
4529
4401
|
}
|
|
4530
4402
|
async deactivate() {
|
|
4531
|
-
if (this._state ===
|
|
4403
|
+
if (this._state === import_services11.SpaceState.INACTIVE) {
|
|
4532
4404
|
return;
|
|
4533
4405
|
}
|
|
4534
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
(0, import_log11.log)("new state", {
|
|
4540
|
-
state: import_services12.SpaceState[this._state]
|
|
4406
|
+
await this._metadataStore.setSpaceState(this.key, import_services11.SpaceState.INACTIVE);
|
|
4407
|
+
await this._close();
|
|
4408
|
+
this._state = import_services11.SpaceState.INACTIVE;
|
|
4409
|
+
(0, import_log10.log)("new state", {
|
|
4410
|
+
state: import_services11.SpaceState[this._state]
|
|
4541
4411
|
}, {
|
|
4542
|
-
F:
|
|
4543
|
-
L:
|
|
4412
|
+
F: __dxlog_file14,
|
|
4413
|
+
L: 566,
|
|
4544
4414
|
S: this,
|
|
4545
4415
|
C: (f, a) => f(...a)
|
|
4546
4416
|
});
|
|
@@ -4558,7 +4428,7 @@ _ts_decorate4([
|
|
|
4558
4428
|
], DataSpace.prototype, "key", null);
|
|
4559
4429
|
_ts_decorate4([
|
|
4560
4430
|
import_tracing5.trace.info({
|
|
4561
|
-
enum:
|
|
4431
|
+
enum: import_services11.SpaceState
|
|
4562
4432
|
})
|
|
4563
4433
|
], DataSpace.prototype, "state", null);
|
|
4564
4434
|
_ts_decorate4([
|
|
@@ -4609,7 +4479,7 @@ var findPropertiesObject = (spaceDoc) => {
|
|
|
4609
4479
|
};
|
|
4610
4480
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
4611
4481
|
const credentials = [
|
|
4612
|
-
await (0,
|
|
4482
|
+
await (0, import_credentials16.createCredential)({
|
|
4613
4483
|
signer: keyring,
|
|
4614
4484
|
issuer: space.key,
|
|
4615
4485
|
subject: space.key,
|
|
@@ -4618,14 +4488,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
4618
4488
|
spaceKey: space.key
|
|
4619
4489
|
}
|
|
4620
4490
|
}),
|
|
4621
|
-
await (0,
|
|
4491
|
+
await (0, import_credentials16.createCredential)({
|
|
4622
4492
|
signer: keyring,
|
|
4623
4493
|
issuer: space.key,
|
|
4624
4494
|
subject: signingContext.identityKey,
|
|
4625
4495
|
assertion: {
|
|
4626
4496
|
"@type": "dxos.halo.credentials.SpaceMember",
|
|
4627
4497
|
spaceKey: space.key,
|
|
4628
|
-
role:
|
|
4498
|
+
role: import_credentials17.SpaceMember.Role.OWNER,
|
|
4629
4499
|
profile: signingContext.getProfile(),
|
|
4630
4500
|
genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
|
|
4631
4501
|
}
|
|
@@ -4637,7 +4507,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
4637
4507
|
spaceKey: space.key,
|
|
4638
4508
|
identityKey: signingContext.identityKey,
|
|
4639
4509
|
deviceKey: signingContext.deviceKey,
|
|
4640
|
-
designation:
|
|
4510
|
+
designation: import_credentials17.AdmittedFeed.Designation.CONTROL
|
|
4641
4511
|
}
|
|
4642
4512
|
}),
|
|
4643
4513
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -4647,7 +4517,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
4647
4517
|
spaceKey: space.key,
|
|
4648
4518
|
identityKey: signingContext.identityKey,
|
|
4649
4519
|
deviceKey: signingContext.deviceKey,
|
|
4650
|
-
designation:
|
|
4520
|
+
designation: import_credentials17.AdmittedFeed.Designation.DATA
|
|
4651
4521
|
}
|
|
4652
4522
|
}),
|
|
4653
4523
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -4656,7 +4526,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
4656
4526
|
"@type": "dxos.halo.credentials.Epoch",
|
|
4657
4527
|
number: 0,
|
|
4658
4528
|
previousId: void 0,
|
|
4659
|
-
timeframe: new
|
|
4529
|
+
timeframe: new import_timeframe3.Timeframe(),
|
|
4660
4530
|
snapshotCid: void 0,
|
|
4661
4531
|
automergeRoot
|
|
4662
4532
|
}
|
|
@@ -4681,12 +4551,11 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4681
4551
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4682
4552
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4683
4553
|
}
|
|
4684
|
-
var
|
|
4554
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4685
4555
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4686
4556
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4687
|
-
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
4688
4557
|
var DataSpaceManager = class {
|
|
4689
|
-
constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager,
|
|
4558
|
+
constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, params) {
|
|
4690
4559
|
this._spaceManager = _spaceManager;
|
|
4691
4560
|
this._metadataStore = _metadataStore;
|
|
4692
4561
|
this._keyring = _keyring;
|
|
@@ -4694,12 +4563,14 @@ var DataSpaceManager = class {
|
|
|
4694
4563
|
this._feedStore = _feedStore;
|
|
4695
4564
|
this._echoHost = _echoHost;
|
|
4696
4565
|
this._invitationsManager = _invitationsManager;
|
|
4697
|
-
this.
|
|
4698
|
-
this._ctx = new import_context12.Context();
|
|
4566
|
+
this._ctx = new import_context11.Context();
|
|
4699
4567
|
this.updated = new import_async15.Event();
|
|
4700
|
-
this._spaces = new import_util8.ComplexMap(
|
|
4568
|
+
this._spaces = new import_util8.ComplexMap(import_keys11.PublicKey.hash);
|
|
4701
4569
|
this._isOpen = false;
|
|
4702
|
-
this._instanceId =
|
|
4570
|
+
this._instanceId = import_keys11.PublicKey.random().toHex();
|
|
4571
|
+
const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
4572
|
+
this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
|
|
4573
|
+
this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
|
|
4703
4574
|
import_tracing6.trace.diagnostic({
|
|
4704
4575
|
id: "spaces",
|
|
4705
4576
|
name: "Spaces",
|
|
@@ -4711,7 +4582,7 @@ var DataSpaceManager = class {
|
|
|
4711
4582
|
const properties = rootDoc && findPropertiesObject(rootDoc);
|
|
4712
4583
|
return {
|
|
4713
4584
|
key: space.key.toHex(),
|
|
4714
|
-
state:
|
|
4585
|
+
state: import_services12.SpaceState[space.state],
|
|
4715
4586
|
name: properties?.[1].data.name ?? null,
|
|
4716
4587
|
inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
|
|
4717
4588
|
linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
|
|
@@ -4728,46 +4599,46 @@ var DataSpaceManager = class {
|
|
|
4728
4599
|
return this._spaces;
|
|
4729
4600
|
}
|
|
4730
4601
|
async open() {
|
|
4731
|
-
(0,
|
|
4732
|
-
F:
|
|
4733
|
-
L:
|
|
4602
|
+
(0, import_log12.log)("open", void 0, {
|
|
4603
|
+
F: __dxlog_file15,
|
|
4604
|
+
L: 144,
|
|
4734
4605
|
S: this,
|
|
4735
4606
|
C: (f, a) => f(...a)
|
|
4736
4607
|
});
|
|
4737
|
-
|
|
4608
|
+
import_log12.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
|
|
4738
4609
|
id: this._instanceId
|
|
4739
4610
|
}), {
|
|
4740
|
-
F:
|
|
4741
|
-
L:
|
|
4611
|
+
F: __dxlog_file15,
|
|
4612
|
+
L: 145,
|
|
4742
4613
|
S: this,
|
|
4743
4614
|
C: (f, a) => f(...a)
|
|
4744
4615
|
});
|
|
4745
|
-
(0,
|
|
4616
|
+
(0, import_log12.log)("metadata loaded", {
|
|
4746
4617
|
spaces: this._metadataStore.spaces.length
|
|
4747
4618
|
}, {
|
|
4748
|
-
F:
|
|
4749
|
-
L:
|
|
4619
|
+
F: __dxlog_file15,
|
|
4620
|
+
L: 146,
|
|
4750
4621
|
S: this,
|
|
4751
4622
|
C: (f, a) => f(...a)
|
|
4752
4623
|
});
|
|
4753
4624
|
await (0, import_util8.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
4754
4625
|
try {
|
|
4755
|
-
(0,
|
|
4626
|
+
(0, import_log12.log)("load space", {
|
|
4756
4627
|
spaceMetadata
|
|
4757
4628
|
}, {
|
|
4758
|
-
F:
|
|
4759
|
-
L:
|
|
4629
|
+
F: __dxlog_file15,
|
|
4630
|
+
L: 150,
|
|
4760
4631
|
S: this,
|
|
4761
4632
|
C: (f, a) => f(...a)
|
|
4762
4633
|
});
|
|
4763
4634
|
await this._constructSpace(spaceMetadata);
|
|
4764
4635
|
} catch (err) {
|
|
4765
|
-
|
|
4636
|
+
import_log12.log.error("Error loading space", {
|
|
4766
4637
|
spaceMetadata,
|
|
4767
4638
|
err
|
|
4768
4639
|
}, {
|
|
4769
|
-
F:
|
|
4770
|
-
L:
|
|
4640
|
+
F: __dxlog_file15,
|
|
4641
|
+
L: 153,
|
|
4771
4642
|
S: this,
|
|
4772
4643
|
C: (f, a) => f(...a)
|
|
4773
4644
|
});
|
|
@@ -4775,19 +4646,24 @@ var DataSpaceManager = class {
|
|
|
4775
4646
|
});
|
|
4776
4647
|
this._isOpen = true;
|
|
4777
4648
|
this.updated.emit();
|
|
4778
|
-
|
|
4649
|
+
for (const space of this._spaces.values()) {
|
|
4650
|
+
if (space.state !== import_services12.SpaceState.INACTIVE) {
|
|
4651
|
+
space.initializeDataPipelineAsync();
|
|
4652
|
+
}
|
|
4653
|
+
}
|
|
4654
|
+
import_log12.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
|
|
4779
4655
|
id: this._instanceId
|
|
4780
4656
|
}), {
|
|
4781
|
-
F:
|
|
4782
|
-
L:
|
|
4657
|
+
F: __dxlog_file15,
|
|
4658
|
+
L: 166,
|
|
4783
4659
|
S: this,
|
|
4784
4660
|
C: (f, a) => f(...a)
|
|
4785
4661
|
});
|
|
4786
4662
|
}
|
|
4787
4663
|
async close() {
|
|
4788
|
-
(0,
|
|
4789
|
-
F:
|
|
4790
|
-
L:
|
|
4664
|
+
(0, import_log12.log)("close", void 0, {
|
|
4665
|
+
F: __dxlog_file15,
|
|
4666
|
+
L: 171,
|
|
4791
4667
|
S: this,
|
|
4792
4668
|
C: (f, a) => f(...a)
|
|
4793
4669
|
});
|
|
@@ -4796,15 +4672,14 @@ var DataSpaceManager = class {
|
|
|
4796
4672
|
for (const space of this._spaces.values()) {
|
|
4797
4673
|
await space.close();
|
|
4798
4674
|
}
|
|
4799
|
-
this._spaces.clear();
|
|
4800
4675
|
}
|
|
4801
4676
|
/**
|
|
4802
4677
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
4803
4678
|
*/
|
|
4804
4679
|
async createSpace() {
|
|
4805
4680
|
(0, import_invariant14.invariant)(this._isOpen, "Not open.", {
|
|
4806
|
-
F:
|
|
4807
|
-
L:
|
|
4681
|
+
F: __dxlog_file15,
|
|
4682
|
+
L: 184,
|
|
4808
4683
|
S: this,
|
|
4809
4684
|
A: [
|
|
4810
4685
|
"this._isOpen",
|
|
@@ -4819,25 +4694,24 @@ var DataSpaceManager = class {
|
|
|
4819
4694
|
genesisFeedKey: controlFeedKey,
|
|
4820
4695
|
controlFeedKey,
|
|
4821
4696
|
dataFeedKey,
|
|
4822
|
-
state:
|
|
4697
|
+
state: import_services12.SpaceState.ACTIVE
|
|
4823
4698
|
};
|
|
4824
|
-
(0,
|
|
4699
|
+
(0, import_log12.log)("creating space...", {
|
|
4825
4700
|
spaceKey
|
|
4826
4701
|
}, {
|
|
4827
|
-
F:
|
|
4828
|
-
L:
|
|
4702
|
+
F: __dxlog_file15,
|
|
4703
|
+
L: 196,
|
|
4829
4704
|
S: this,
|
|
4830
4705
|
C: (f, a) => f(...a)
|
|
4831
4706
|
});
|
|
4832
4707
|
const root = await this._echoHost.createSpaceRoot(spaceKey);
|
|
4833
4708
|
const space = await this._constructSpace(metadata);
|
|
4834
|
-
await space.open();
|
|
4835
4709
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
|
|
4836
4710
|
await this._metadataStore.addSpace(metadata);
|
|
4837
4711
|
const memberCredential = credentials[1];
|
|
4838
|
-
(0, import_invariant14.invariant)((0,
|
|
4839
|
-
F:
|
|
4840
|
-
L:
|
|
4712
|
+
(0, import_invariant14.invariant)((0, import_credentials14.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4713
|
+
F: __dxlog_file15,
|
|
4714
|
+
L: 205,
|
|
4841
4715
|
S: this,
|
|
4842
4716
|
A: [
|
|
4843
4717
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4849,63 +4723,19 @@ var DataSpaceManager = class {
|
|
|
4849
4723
|
this.updated.emit();
|
|
4850
4724
|
return space;
|
|
4851
4725
|
}
|
|
4852
|
-
async isDefaultSpace(space) {
|
|
4853
|
-
const rootDoc = await this._getSpaceRootDocument(space);
|
|
4854
|
-
const [_, properties] = findPropertiesObject(rootDoc.docSync()) ?? [];
|
|
4855
|
-
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
4856
|
-
}
|
|
4857
|
-
async createDefaultSpace() {
|
|
4858
|
-
const space = await this.createSpace();
|
|
4859
|
-
const document = await this._getSpaceRootDocument(space);
|
|
4860
|
-
const properties = {
|
|
4861
|
-
system: {
|
|
4862
|
-
type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
|
|
4863
|
-
},
|
|
4864
|
-
data: {
|
|
4865
|
-
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
|
|
4866
|
-
},
|
|
4867
|
-
meta: {
|
|
4868
|
-
keys: []
|
|
4869
|
-
}
|
|
4870
|
-
};
|
|
4871
|
-
const propertiesId = import_keys12.PublicKey.random().toHex();
|
|
4872
|
-
document.change((doc) => {
|
|
4873
|
-
(0, import_util8.assignDeep)(doc, [
|
|
4874
|
-
"objects",
|
|
4875
|
-
propertiesId
|
|
4876
|
-
], properties);
|
|
4877
|
-
});
|
|
4878
|
-
await this._echoHost.flush();
|
|
4879
|
-
return space;
|
|
4880
|
-
}
|
|
4881
|
-
async _getSpaceRootDocument(space) {
|
|
4882
|
-
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
4883
|
-
(0, import_invariant14.invariant)(automergeIndex, void 0, {
|
|
4884
|
-
F: __dxlog_file16,
|
|
4885
|
-
L: 240,
|
|
4886
|
-
S: this,
|
|
4887
|
-
A: [
|
|
4888
|
-
"automergeIndex",
|
|
4889
|
-
""
|
|
4890
|
-
]
|
|
4891
|
-
});
|
|
4892
|
-
const document = this._echoHost.automergeRepo.find(automergeIndex);
|
|
4893
|
-
await document.whenReady();
|
|
4894
|
-
return document;
|
|
4895
|
-
}
|
|
4896
4726
|
// TODO(burdon): Rename join space.
|
|
4897
4727
|
async acceptSpace(opts) {
|
|
4898
|
-
(0,
|
|
4728
|
+
(0, import_log12.log)("accept space", {
|
|
4899
4729
|
opts
|
|
4900
4730
|
}, {
|
|
4901
|
-
F:
|
|
4902
|
-
L:
|
|
4731
|
+
F: __dxlog_file15,
|
|
4732
|
+
L: 217,
|
|
4903
4733
|
S: this,
|
|
4904
4734
|
C: (f, a) => f(...a)
|
|
4905
4735
|
});
|
|
4906
4736
|
(0, import_invariant14.invariant)(this._isOpen, "Not open.", {
|
|
4907
|
-
F:
|
|
4908
|
-
L:
|
|
4737
|
+
F: __dxlog_file15,
|
|
4738
|
+
L: 218,
|
|
4909
4739
|
S: this,
|
|
4910
4740
|
A: [
|
|
4911
4741
|
"this._isOpen",
|
|
@@ -4913,8 +4743,8 @@ var DataSpaceManager = class {
|
|
|
4913
4743
|
]
|
|
4914
4744
|
});
|
|
4915
4745
|
(0, import_invariant14.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
4916
|
-
F:
|
|
4917
|
-
L:
|
|
4746
|
+
F: __dxlog_file15,
|
|
4747
|
+
L: 219,
|
|
4918
4748
|
S: this,
|
|
4919
4749
|
A: [
|
|
4920
4750
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -4928,7 +4758,6 @@ var DataSpaceManager = class {
|
|
|
4928
4758
|
dataTimeframe: opts.dataTimeframe
|
|
4929
4759
|
};
|
|
4930
4760
|
const space = await this._constructSpace(metadata);
|
|
4931
|
-
await space.open();
|
|
4932
4761
|
await this._metadataStore.addSpace(metadata);
|
|
4933
4762
|
space.initializeDataPipelineAsync();
|
|
4934
4763
|
this.updated.emit();
|
|
@@ -4940,17 +4769,17 @@ var DataSpaceManager = class {
|
|
|
4940
4769
|
* TODO(dmaretskyi): Consider removing.
|
|
4941
4770
|
*/
|
|
4942
4771
|
async waitUntilSpaceReady(spaceKey) {
|
|
4943
|
-
await (0,
|
|
4772
|
+
await (0, import_context11.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
4944
4773
|
const space = this._spaces.get(spaceKey);
|
|
4945
|
-
return !!space && space.state ===
|
|
4774
|
+
return !!space && space.state === import_services12.SpaceState.READY;
|
|
4946
4775
|
}));
|
|
4947
4776
|
}
|
|
4948
4777
|
async _constructSpace(metadata) {
|
|
4949
|
-
(0,
|
|
4778
|
+
(0, import_log12.log)("construct space", {
|
|
4950
4779
|
metadata
|
|
4951
4780
|
}, {
|
|
4952
|
-
F:
|
|
4953
|
-
L:
|
|
4781
|
+
F: __dxlog_file15,
|
|
4782
|
+
L: 252,
|
|
4954
4783
|
S: this,
|
|
4955
4784
|
C: (f, a) => f(...a)
|
|
4956
4785
|
});
|
|
@@ -4958,8 +4787,8 @@ var DataSpaceManager = class {
|
|
|
4958
4787
|
localPeerId: this._signingContext.deviceKey
|
|
4959
4788
|
});
|
|
4960
4789
|
const presence = new import_teleport_extension_gossip2.Presence({
|
|
4961
|
-
announceInterval: this.
|
|
4962
|
-
offlineTimeout: this.
|
|
4790
|
+
announceInterval: this._spaceMemberPresenceAnnounceInterval,
|
|
4791
|
+
offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
|
|
4963
4792
|
identityKey: this._signingContext.identityKey,
|
|
4964
4793
|
gossip
|
|
4965
4794
|
});
|
|
@@ -4986,15 +4815,15 @@ var DataSpaceManager = class {
|
|
|
4986
4815
|
session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
|
|
4987
4816
|
},
|
|
4988
4817
|
onAuthFailure: () => {
|
|
4989
|
-
|
|
4990
|
-
F:
|
|
4991
|
-
L:
|
|
4818
|
+
import_log12.log.warn("auth failure", void 0, {
|
|
4819
|
+
F: __dxlog_file15,
|
|
4820
|
+
L: 289,
|
|
4992
4821
|
S: this,
|
|
4993
4822
|
C: (f, a) => f(...a)
|
|
4994
4823
|
});
|
|
4995
4824
|
},
|
|
4996
4825
|
onMemberRolesChanged: async (members) => {
|
|
4997
|
-
if (dataSpace?.state ===
|
|
4826
|
+
if (dataSpace?.state === import_services12.SpaceState.READY) {
|
|
4998
4827
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
4999
4828
|
}
|
|
5000
4829
|
},
|
|
@@ -5007,7 +4836,7 @@ var DataSpaceManager = class {
|
|
|
5007
4836
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
5008
4837
|
const dataSpace = new DataSpace({
|
|
5009
4838
|
inner: space,
|
|
5010
|
-
initialState: metadata.state ===
|
|
4839
|
+
initialState: metadata.state === import_services12.SpaceState.INACTIVE ? import_services12.SpaceState.INACTIVE : import_services12.SpaceState.CLOSED,
|
|
5011
4840
|
metadataStore: this._metadataStore,
|
|
5012
4841
|
gossip,
|
|
5013
4842
|
presence,
|
|
@@ -5017,22 +4846,22 @@ var DataSpaceManager = class {
|
|
|
5017
4846
|
signingContext: this._signingContext,
|
|
5018
4847
|
callbacks: {
|
|
5019
4848
|
beforeReady: async () => {
|
|
5020
|
-
(0,
|
|
4849
|
+
(0, import_log12.log)("before space ready", {
|
|
5021
4850
|
space: space.key
|
|
5022
4851
|
}, {
|
|
5023
|
-
F:
|
|
5024
|
-
L:
|
|
4852
|
+
F: __dxlog_file15,
|
|
4853
|
+
L: 316,
|
|
5025
4854
|
S: this,
|
|
5026
4855
|
C: (f, a) => f(...a)
|
|
5027
4856
|
});
|
|
5028
4857
|
},
|
|
5029
4858
|
afterReady: async () => {
|
|
5030
|
-
(0,
|
|
4859
|
+
(0, import_log12.log)("after space ready", {
|
|
5031
4860
|
space: space.key,
|
|
5032
4861
|
open: this._isOpen
|
|
5033
4862
|
}, {
|
|
5034
|
-
F:
|
|
5035
|
-
L:
|
|
4863
|
+
F: __dxlog_file15,
|
|
4864
|
+
L: 319,
|
|
5036
4865
|
S: this,
|
|
5037
4866
|
C: (f, a) => f(...a)
|
|
5038
4867
|
});
|
|
@@ -5047,11 +4876,11 @@ var DataSpaceManager = class {
|
|
|
5047
4876
|
}
|
|
5048
4877
|
},
|
|
5049
4878
|
beforeClose: async () => {
|
|
5050
|
-
(0,
|
|
4879
|
+
(0, import_log12.log)("before space close", {
|
|
5051
4880
|
space: space.key
|
|
5052
4881
|
}, {
|
|
5053
|
-
F:
|
|
5054
|
-
L:
|
|
4882
|
+
F: __dxlog_file15,
|
|
4883
|
+
L: 327,
|
|
5055
4884
|
S: this,
|
|
5056
4885
|
C: (f, a) => f(...a)
|
|
5057
4886
|
});
|
|
@@ -5060,10 +4889,13 @@ var DataSpaceManager = class {
|
|
|
5060
4889
|
cache: metadata.cache
|
|
5061
4890
|
});
|
|
5062
4891
|
presence.newPeer.on((peerState) => {
|
|
5063
|
-
if (dataSpace.state ===
|
|
4892
|
+
if (dataSpace.state === import_services12.SpaceState.READY) {
|
|
5064
4893
|
this._handleNewPeerConnected(space, peerState);
|
|
5065
4894
|
}
|
|
5066
4895
|
});
|
|
4896
|
+
if (metadata.state !== import_services12.SpaceState.INACTIVE) {
|
|
4897
|
+
await dataSpace.open();
|
|
4898
|
+
}
|
|
5067
4899
|
if (metadata.controlTimeframe) {
|
|
5068
4900
|
dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
|
|
5069
4901
|
}
|
|
@@ -5079,20 +4911,20 @@ var DataSpaceManager = class {
|
|
|
5079
4911
|
const peers = presence.getPeersByIdentityKey(member.key);
|
|
5080
4912
|
const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
|
|
5081
4913
|
const sessionsToClose = sessions.filter((s) => {
|
|
5082
|
-
return (s && member.role ===
|
|
4914
|
+
return (s && member.role === import_credentials15.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
|
|
5083
4915
|
});
|
|
5084
4916
|
sessionsToClose.forEach((session) => {
|
|
5085
|
-
void session.close().catch(
|
|
4917
|
+
void session.close().catch(import_log12.log.error);
|
|
5086
4918
|
});
|
|
5087
4919
|
closedSessions += sessionsToClose.length;
|
|
5088
4920
|
}
|
|
5089
|
-
(0,
|
|
4921
|
+
(0, import_log12.log)("processed member role changes", {
|
|
5090
4922
|
roleChangeCount: memberInfo.length,
|
|
5091
4923
|
peersOnline: presence.getPeersOnline().length,
|
|
5092
4924
|
closedSessions
|
|
5093
4925
|
}, {
|
|
5094
|
-
F:
|
|
5095
|
-
L:
|
|
4926
|
+
F: __dxlog_file15,
|
|
4927
|
+
L: 367,
|
|
5096
4928
|
S: this,
|
|
5097
4929
|
C: (f, a) => f(...a)
|
|
5098
4930
|
});
|
|
@@ -5100,23 +4932,23 @@ var DataSpaceManager = class {
|
|
|
5100
4932
|
}
|
|
5101
4933
|
_handleNewPeerConnected(space, peerState) {
|
|
5102
4934
|
const role = space.spaceState.getMemberRole(peerState.identityKey);
|
|
5103
|
-
if (role ===
|
|
4935
|
+
if (role === import_credentials15.SpaceMember.Role.REMOVED) {
|
|
5104
4936
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
5105
4937
|
if (session != null) {
|
|
5106
|
-
(0,
|
|
4938
|
+
(0, import_log12.log)("closing a session with a removed peer", {
|
|
5107
4939
|
peerId: peerState.peerId
|
|
5108
4940
|
}, {
|
|
5109
|
-
F:
|
|
5110
|
-
L:
|
|
4941
|
+
F: __dxlog_file15,
|
|
4942
|
+
L: 381,
|
|
5111
4943
|
S: this,
|
|
5112
4944
|
C: (f, a) => f(...a)
|
|
5113
4945
|
});
|
|
5114
|
-
void session.close().catch(
|
|
4946
|
+
void session.close().catch(import_log12.log.error);
|
|
5115
4947
|
}
|
|
5116
4948
|
}
|
|
5117
4949
|
}
|
|
5118
4950
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
5119
|
-
if (dataSpace?.state !==
|
|
4951
|
+
if (dataSpace?.state !== import_services12.SpaceState.READY) {
|
|
5120
4952
|
return;
|
|
5121
4953
|
}
|
|
5122
4954
|
if (isActive) {
|
|
@@ -5133,8 +4965,8 @@ var DataSpaceManager = class {
|
|
|
5133
4965
|
async _createDelegatedInvitations(space, invitations) {
|
|
5134
4966
|
const tasks = invitations.map(([credentialId, invitation]) => {
|
|
5135
4967
|
return this._invitationsManager.createInvitation({
|
|
5136
|
-
type:
|
|
5137
|
-
kind:
|
|
4968
|
+
type: import_services12.Invitation.Type.DELEGATED,
|
|
4969
|
+
kind: import_services12.Invitation.Kind.SPACE,
|
|
5138
4970
|
spaceKey: space.key,
|
|
5139
4971
|
authMethod: invitation.authMethod,
|
|
5140
4972
|
invitationId: invitation.invitationId,
|
|
@@ -5166,7 +4998,7 @@ _ts_decorate5([
|
|
|
5166
4998
|
DataSpaceManager = _ts_decorate5([
|
|
5167
4999
|
(0, import_async15.trackLeaks)("open", "close")
|
|
5168
5000
|
], DataSpaceManager);
|
|
5169
|
-
var
|
|
5001
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5170
5002
|
var SpacesServiceImpl = class {
|
|
5171
5003
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5172
5004
|
this._identityManager = _identityManager;
|
|
@@ -5185,10 +5017,10 @@ var SpacesServiceImpl = class {
|
|
|
5185
5017
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5186
5018
|
if (state) {
|
|
5187
5019
|
switch (state) {
|
|
5188
|
-
case
|
|
5020
|
+
case import_services13.SpaceState.ACTIVE:
|
|
5189
5021
|
await space.activate();
|
|
5190
5022
|
break;
|
|
5191
|
-
case
|
|
5023
|
+
case import_services13.SpaceState.INACTIVE:
|
|
5192
5024
|
await space.deactivate();
|
|
5193
5025
|
break;
|
|
5194
5026
|
default:
|
|
@@ -5208,9 +5040,9 @@ var SpacesServiceImpl = class {
|
|
|
5208
5040
|
role: space.spaceState.getMemberRole(identity.identityKey)
|
|
5209
5041
|
});
|
|
5210
5042
|
}
|
|
5211
|
-
const credentials = await (0,
|
|
5043
|
+
const credentials = await (0, import_credentials18.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5212
5044
|
(0, import_invariant15.invariant)(credentials[0].credential, void 0, {
|
|
5213
|
-
F:
|
|
5045
|
+
F: __dxlog_file16,
|
|
5214
5046
|
L: 97,
|
|
5215
5047
|
S: this,
|
|
5216
5048
|
A: [
|
|
@@ -5219,8 +5051,8 @@ var SpacesServiceImpl = class {
|
|
|
5219
5051
|
]
|
|
5220
5052
|
});
|
|
5221
5053
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5222
|
-
(0, import_invariant15.invariant)((0,
|
|
5223
|
-
F:
|
|
5054
|
+
(0, import_invariant15.invariant)((0, import_credentials18.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5055
|
+
F: __dxlog_file16,
|
|
5224
5056
|
L: 99,
|
|
5225
5057
|
S: this,
|
|
5226
5058
|
A: [
|
|
@@ -5235,10 +5067,10 @@ var SpacesServiceImpl = class {
|
|
|
5235
5067
|
const scheduler = new import_async16.UpdateScheduler(ctx, async () => {
|
|
5236
5068
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5237
5069
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
5238
|
-
(0,
|
|
5070
|
+
(0, import_log13.log)("update", {
|
|
5239
5071
|
spaces
|
|
5240
5072
|
}, {
|
|
5241
|
-
F:
|
|
5073
|
+
F: __dxlog_file16,
|
|
5242
5074
|
L: 110,
|
|
5243
5075
|
S: this,
|
|
5244
5076
|
C: (f, a) => f(...a)
|
|
@@ -5322,7 +5154,7 @@ var SpacesServiceImpl = class {
|
|
|
5322
5154
|
});
|
|
5323
5155
|
} else {
|
|
5324
5156
|
(0, import_invariant15.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5325
|
-
F:
|
|
5157
|
+
F: __dxlog_file16,
|
|
5326
5158
|
L: 198,
|
|
5327
5159
|
S: this,
|
|
5328
5160
|
A: [
|
|
@@ -5331,7 +5163,7 @@ var SpacesServiceImpl = class {
|
|
|
5331
5163
|
]
|
|
5332
5164
|
});
|
|
5333
5165
|
(0, import_invariant15.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
5334
|
-
F:
|
|
5166
|
+
F: __dxlog_file16,
|
|
5335
5167
|
L: 199,
|
|
5336
5168
|
S: this,
|
|
5337
5169
|
A: [
|
|
@@ -5341,7 +5173,7 @@ var SpacesServiceImpl = class {
|
|
|
5341
5173
|
});
|
|
5342
5174
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5343
5175
|
(0, import_invariant15.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5344
|
-
F:
|
|
5176
|
+
F: __dxlog_file16,
|
|
5345
5177
|
L: 201,
|
|
5346
5178
|
S: this,
|
|
5347
5179
|
A: [
|
|
@@ -5400,7 +5232,7 @@ var SpacesServiceImpl = class {
|
|
|
5400
5232
|
profile: member.profile ?? {}
|
|
5401
5233
|
},
|
|
5402
5234
|
role: member.role,
|
|
5403
|
-
presence: peers.length > 0 ?
|
|
5235
|
+
presence: peers.length > 0 ? import_services13.SpaceMember.PresenceState.ONLINE : import_services13.SpaceMember.PresenceState.OFFLINE,
|
|
5404
5236
|
peerStates: peers
|
|
5405
5237
|
};
|
|
5406
5238
|
}),
|
|
@@ -5438,8 +5270,8 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5438
5270
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5439
5271
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5440
5272
|
}
|
|
5441
|
-
var
|
|
5442
|
-
var ServiceContext = class extends
|
|
5273
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5274
|
+
var ServiceContext = class extends import_context12.Resource {
|
|
5443
5275
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5444
5276
|
super();
|
|
5445
5277
|
this.storage = storage;
|
|
@@ -5449,7 +5281,7 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5449
5281
|
this._runtimeParams = _runtimeParams;
|
|
5450
5282
|
this.initialized = new import_async17.Trigger();
|
|
5451
5283
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5452
|
-
this._instanceId =
|
|
5284
|
+
this._instanceId = import_keys12.PublicKey.random().toHex();
|
|
5453
5285
|
this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
|
|
5454
5286
|
this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5455
5287
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
@@ -5478,20 +5310,20 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5478
5310
|
});
|
|
5479
5311
|
this.invitations = new InvitationsHandler(this.networkManager, _runtimeParams?.invitationConnectionDefaultParams);
|
|
5480
5312
|
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
5481
|
-
this._handlerFactories.set(
|
|
5313
|
+
this._handlerFactories.set(import_services14.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
5482
5314
|
}
|
|
5483
5315
|
async _open(ctx) {
|
|
5484
5316
|
await this._checkStorageVersion();
|
|
5485
|
-
(0,
|
|
5486
|
-
F:
|
|
5317
|
+
(0, import_log14.log)("opening...", void 0, {
|
|
5318
|
+
F: __dxlog_file17,
|
|
5487
5319
|
L: 152,
|
|
5488
5320
|
S: this,
|
|
5489
5321
|
C: (f, a) => f(...a)
|
|
5490
5322
|
});
|
|
5491
|
-
|
|
5323
|
+
import_log14.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
|
|
5492
5324
|
id: this._instanceId
|
|
5493
5325
|
}), {
|
|
5494
|
-
F:
|
|
5326
|
+
F: __dxlog_file17,
|
|
5495
5327
|
L: 153,
|
|
5496
5328
|
S: this,
|
|
5497
5329
|
C: (f, a) => f(...a)
|
|
@@ -5506,32 +5338,32 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5506
5338
|
await this._initialize(ctx);
|
|
5507
5339
|
}
|
|
5508
5340
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
5509
|
-
(0,
|
|
5341
|
+
(0, import_log14.log)("loaded persistent invitations", {
|
|
5510
5342
|
count: loadedInvitations.invitations?.length
|
|
5511
5343
|
}, {
|
|
5512
|
-
F:
|
|
5344
|
+
F: __dxlog_file17,
|
|
5513
5345
|
L: 166,
|
|
5514
5346
|
S: this,
|
|
5515
5347
|
C: (f, a) => f(...a)
|
|
5516
5348
|
});
|
|
5517
|
-
|
|
5349
|
+
import_log14.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
|
|
5518
5350
|
id: this._instanceId
|
|
5519
5351
|
}), {
|
|
5520
|
-
F:
|
|
5352
|
+
F: __dxlog_file17,
|
|
5521
5353
|
L: 168,
|
|
5522
5354
|
S: this,
|
|
5523
5355
|
C: (f, a) => f(...a)
|
|
5524
5356
|
});
|
|
5525
|
-
(0,
|
|
5526
|
-
F:
|
|
5357
|
+
(0, import_log14.log)("opened", void 0, {
|
|
5358
|
+
F: __dxlog_file17,
|
|
5527
5359
|
L: 169,
|
|
5528
5360
|
S: this,
|
|
5529
5361
|
C: (f, a) => f(...a)
|
|
5530
5362
|
});
|
|
5531
5363
|
}
|
|
5532
5364
|
async _close(ctx) {
|
|
5533
|
-
(0,
|
|
5534
|
-
F:
|
|
5365
|
+
(0, import_log14.log)("closing...", void 0, {
|
|
5366
|
+
F: __dxlog_file17,
|
|
5535
5367
|
L: 173,
|
|
5536
5368
|
S: this,
|
|
5537
5369
|
C: (f, a) => f(...a)
|
|
@@ -5547,8 +5379,8 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5547
5379
|
await this.echoHost.close(ctx);
|
|
5548
5380
|
await this.networkManager.close();
|
|
5549
5381
|
await this.signalManager.close();
|
|
5550
|
-
(0,
|
|
5551
|
-
F:
|
|
5382
|
+
(0, import_log14.log)("closed", void 0, {
|
|
5383
|
+
F: __dxlog_file17,
|
|
5552
5384
|
L: 185,
|
|
5553
5385
|
S: this,
|
|
5554
5386
|
C: (f, a) => f(...a)
|
|
@@ -5556,13 +5388,13 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5556
5388
|
}
|
|
5557
5389
|
async createIdentity(params = {}) {
|
|
5558
5390
|
const identity = await this.identityManager.createIdentity(params);
|
|
5559
|
-
await this._initialize(new
|
|
5391
|
+
await this._initialize(new import_context12.Context());
|
|
5560
5392
|
return identity;
|
|
5561
5393
|
}
|
|
5562
5394
|
getInvitationHandler(invitation) {
|
|
5563
5395
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5564
5396
|
(0, import_invariant16.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5565
|
-
F:
|
|
5397
|
+
F: __dxlog_file17,
|
|
5566
5398
|
L: 196,
|
|
5567
5399
|
S: this,
|
|
5568
5400
|
A: [
|
|
@@ -5582,7 +5414,7 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5582
5414
|
}
|
|
5583
5415
|
async _acceptIdentity(params) {
|
|
5584
5416
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5585
|
-
await this._initialize(new
|
|
5417
|
+
await this._initialize(new import_context12.Context());
|
|
5586
5418
|
return identity;
|
|
5587
5419
|
}
|
|
5588
5420
|
async _checkStorageVersion() {
|
|
@@ -5593,8 +5425,8 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5593
5425
|
}
|
|
5594
5426
|
// Called when identity is created.
|
|
5595
5427
|
async _initialize(ctx) {
|
|
5596
|
-
(0,
|
|
5597
|
-
F:
|
|
5428
|
+
(0, import_log14.log)("initializing spaces...", void 0, {
|
|
5429
|
+
F: __dxlog_file17,
|
|
5598
5430
|
L: 227,
|
|
5599
5431
|
S: this,
|
|
5600
5432
|
C: (f, a) => f(...a)
|
|
@@ -5615,9 +5447,9 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5615
5447
|
};
|
|
5616
5448
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.echoHost, this.invitationsManager, this._runtimeParams);
|
|
5617
5449
|
await this.dataSpaceManager.open();
|
|
5618
|
-
this._handlerFactories.set(
|
|
5450
|
+
this._handlerFactories.set(import_services14.Invitation.Kind.SPACE, (invitation) => {
|
|
5619
5451
|
(0, import_invariant16.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5620
|
-
F:
|
|
5452
|
+
F: __dxlog_file17,
|
|
5621
5453
|
L: 252,
|
|
5622
5454
|
S: this,
|
|
5623
5455
|
A: [
|
|
@@ -5630,7 +5462,7 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5630
5462
|
this.initialized.wake();
|
|
5631
5463
|
this._deviceSpaceSync = {
|
|
5632
5464
|
processCredential: async (credential) => {
|
|
5633
|
-
const assertion = (0,
|
|
5465
|
+
const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
|
|
5634
5466
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
5635
5467
|
return;
|
|
5636
5468
|
}
|
|
@@ -5638,10 +5470,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5638
5470
|
return;
|
|
5639
5471
|
}
|
|
5640
5472
|
if (!this.dataSpaceManager) {
|
|
5641
|
-
(0,
|
|
5473
|
+
(0, import_log14.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5642
5474
|
details: assertion
|
|
5643
5475
|
}, {
|
|
5644
|
-
F:
|
|
5476
|
+
F: __dxlog_file17,
|
|
5645
5477
|
L: 268,
|
|
5646
5478
|
S: this,
|
|
5647
5479
|
C: (f, a) => f(...a)
|
|
@@ -5649,10 +5481,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5649
5481
|
return;
|
|
5650
5482
|
}
|
|
5651
5483
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
5652
|
-
(0,
|
|
5484
|
+
(0, import_log14.log)("space already exists, ignoring space admission", {
|
|
5653
5485
|
details: assertion
|
|
5654
5486
|
}, {
|
|
5655
|
-
F:
|
|
5487
|
+
F: __dxlog_file17,
|
|
5656
5488
|
L: 272,
|
|
5657
5489
|
S: this,
|
|
5658
5490
|
C: (f, a) => f(...a)
|
|
@@ -5660,10 +5492,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5660
5492
|
return;
|
|
5661
5493
|
}
|
|
5662
5494
|
try {
|
|
5663
|
-
(0,
|
|
5495
|
+
(0, import_log14.log)("accepting space recorded in halo", {
|
|
5664
5496
|
details: assertion
|
|
5665
5497
|
}, {
|
|
5666
|
-
F:
|
|
5498
|
+
F: __dxlog_file17,
|
|
5667
5499
|
L: 277,
|
|
5668
5500
|
S: this,
|
|
5669
5501
|
C: (f, a) => f(...a)
|
|
@@ -5673,8 +5505,8 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5673
5505
|
genesisFeedKey: assertion.genesisFeedKey
|
|
5674
5506
|
});
|
|
5675
5507
|
} catch (err) {
|
|
5676
|
-
|
|
5677
|
-
F:
|
|
5508
|
+
import_log14.log.catch(err, void 0, {
|
|
5509
|
+
F: __dxlog_file17,
|
|
5678
5510
|
L: 283,
|
|
5679
5511
|
S: this,
|
|
5680
5512
|
C: (f, a) => f(...a)
|
|
@@ -5727,7 +5559,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5727
5559
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5728
5560
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5729
5561
|
}
|
|
5730
|
-
var
|
|
5562
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
5731
5563
|
var Lock = class {
|
|
5732
5564
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
5733
5565
|
this._lockPath = lockPath;
|
|
@@ -5738,16 +5570,16 @@ var Lock = class {
|
|
|
5738
5570
|
return this._lockPath;
|
|
5739
5571
|
}
|
|
5740
5572
|
async acquire() {
|
|
5741
|
-
(0,
|
|
5742
|
-
F:
|
|
5573
|
+
(0, import_log15.log)("acquiring lock...", void 0, {
|
|
5574
|
+
F: __dxlog_file18,
|
|
5743
5575
|
L: 32,
|
|
5744
5576
|
S: this,
|
|
5745
5577
|
C: (f, a) => f(...a)
|
|
5746
5578
|
});
|
|
5747
5579
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
5748
5580
|
await this._onAcquire?.();
|
|
5749
|
-
(0,
|
|
5750
|
-
F:
|
|
5581
|
+
(0, import_log15.log)("acquired lock", void 0, {
|
|
5582
|
+
F: __dxlog_file18,
|
|
5751
5583
|
L: 37,
|
|
5752
5584
|
S: this,
|
|
5753
5585
|
C: (f, a) => f(...a)
|
|
@@ -5756,7 +5588,7 @@ var Lock = class {
|
|
|
5756
5588
|
async release() {
|
|
5757
5589
|
await this._onRelease?.();
|
|
5758
5590
|
(0, import_invariant17.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
5759
|
-
F:
|
|
5591
|
+
F: __dxlog_file18,
|
|
5760
5592
|
L: 42,
|
|
5761
5593
|
S: this,
|
|
5762
5594
|
A: [
|
|
@@ -5768,11 +5600,11 @@ var Lock = class {
|
|
|
5768
5600
|
}
|
|
5769
5601
|
};
|
|
5770
5602
|
_ts_decorate7([
|
|
5771
|
-
|
|
5603
|
+
import_log15.logInfo
|
|
5772
5604
|
], Lock.prototype, "lockKey", null);
|
|
5773
5605
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
5774
5606
|
var getRootPath = (config) => {
|
|
5775
|
-
const { dataRoot = (0, import_util10.isNode)() ?
|
|
5607
|
+
const { dataRoot = (0, import_util10.isNode)() ? import_client_protocol5.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5776
5608
|
return `${dataRoot}/`;
|
|
5777
5609
|
};
|
|
5778
5610
|
var isPersistent = (config) => {
|
|
@@ -5823,12 +5655,12 @@ var toStorageType = (type) => {
|
|
|
5823
5655
|
};
|
|
5824
5656
|
var createLevel = async (config) => {
|
|
5825
5657
|
const persistent = isPersistent(config);
|
|
5826
|
-
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${
|
|
5658
|
+
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys13.PublicKey.random().toHex()}`;
|
|
5827
5659
|
const level = (0, import_kv_store.createLevel)(storagePath);
|
|
5828
5660
|
await level.open();
|
|
5829
5661
|
return level;
|
|
5830
5662
|
};
|
|
5831
|
-
var
|
|
5663
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
5832
5664
|
var DevicesServiceImpl = class {
|
|
5833
5665
|
constructor(_identityManager) {
|
|
5834
5666
|
this._identityManager = _identityManager;
|
|
@@ -5846,7 +5678,7 @@ var DevicesServiceImpl = class {
|
|
|
5846
5678
|
});
|
|
5847
5679
|
} else {
|
|
5848
5680
|
(0, import_invariant19.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
5849
|
-
F:
|
|
5681
|
+
F: __dxlog_file19,
|
|
5850
5682
|
L: 32,
|
|
5851
5683
|
S: this,
|
|
5852
5684
|
A: [
|
|
@@ -5861,9 +5693,9 @@ var DevicesServiceImpl = class {
|
|
|
5861
5693
|
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
5862
5694
|
return {
|
|
5863
5695
|
deviceKey: key,
|
|
5864
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
5696
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services16.DeviceKind.CURRENT : import_services16.DeviceKind.TRUSTED,
|
|
5865
5697
|
profile,
|
|
5866
|
-
presence: isMe ?
|
|
5698
|
+
presence: isMe ? import_services16.Device.PresenceState.ONLINE : peerState ? import_services16.Device.PresenceState.ONLINE : import_services16.Device.PresenceState.OFFLINE
|
|
5867
5699
|
};
|
|
5868
5700
|
})
|
|
5869
5701
|
});
|
|
@@ -5912,7 +5744,7 @@ var DiagnosticsCollector = class {
|
|
|
5912
5744
|
}
|
|
5913
5745
|
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
5914
5746
|
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
5915
|
-
keys: options.humanize ?
|
|
5747
|
+
keys: options.humanize ? import_services17.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services17.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
5916
5748
|
}, {
|
|
5917
5749
|
timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
|
|
5918
5750
|
});
|
|
@@ -5927,7 +5759,7 @@ var DiagnosticsCollector = class {
|
|
|
5927
5759
|
client: clientDiagnostics,
|
|
5928
5760
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
5929
5761
|
};
|
|
5930
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
5762
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util12.jsonKeyReplacer)(options)));
|
|
5931
5763
|
}
|
|
5932
5764
|
};
|
|
5933
5765
|
var findSystemServiceProvider = () => {
|
|
@@ -5937,35 +5769,35 @@ var findSystemServiceProvider = () => {
|
|
|
5937
5769
|
};
|
|
5938
5770
|
var findConfigs = () => {
|
|
5939
5771
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
5940
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
5772
|
+
return configs.map((r) => r.instance.deref()).filter(import_util12.nonNullable);
|
|
5941
5773
|
};
|
|
5942
5774
|
var LoggingServiceImpl = class {
|
|
5943
5775
|
constructor() {
|
|
5944
5776
|
this._logs = new import_async20.Event();
|
|
5945
5777
|
this._started = Date.now();
|
|
5946
|
-
this._sessionId =
|
|
5778
|
+
this._sessionId = import_keys16.PublicKey.random().toHex();
|
|
5947
5779
|
this._logProcessor = (_config, entry2) => {
|
|
5948
5780
|
this._logs.emit(entry2);
|
|
5949
5781
|
};
|
|
5950
5782
|
}
|
|
5951
5783
|
async open() {
|
|
5952
|
-
|
|
5784
|
+
import_log17.log.runtimeConfig.processors.push(this._logProcessor);
|
|
5953
5785
|
}
|
|
5954
5786
|
async close() {
|
|
5955
|
-
const index =
|
|
5956
|
-
|
|
5787
|
+
const index = import_log17.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
5788
|
+
import_log17.log.runtimeConfig.processors.splice(index, 1);
|
|
5957
5789
|
}
|
|
5958
5790
|
async controlMetrics({ reset, record }) {
|
|
5959
5791
|
if (reset) {
|
|
5960
|
-
|
|
5792
|
+
import_util14.tracer.clear();
|
|
5961
5793
|
}
|
|
5962
5794
|
if (record === true) {
|
|
5963
|
-
|
|
5795
|
+
import_util14.tracer.start();
|
|
5964
5796
|
} else if (record === false) {
|
|
5965
|
-
|
|
5797
|
+
import_util14.tracer.stop();
|
|
5966
5798
|
}
|
|
5967
5799
|
return {
|
|
5968
|
-
recording:
|
|
5800
|
+
recording: import_util14.tracer.recording
|
|
5969
5801
|
};
|
|
5970
5802
|
}
|
|
5971
5803
|
/**
|
|
@@ -5973,10 +5805,10 @@ var LoggingServiceImpl = class {
|
|
|
5973
5805
|
*/
|
|
5974
5806
|
queryMetrics({ interval = 5e3 }) {
|
|
5975
5807
|
const getNumericalValues = (key) => {
|
|
5976
|
-
const events =
|
|
5808
|
+
const events = import_util14.tracer.get(key) ?? [];
|
|
5977
5809
|
return {
|
|
5978
5810
|
key,
|
|
5979
|
-
stats: (0,
|
|
5811
|
+
stats: (0, import_util14.numericalValues)(events, "duration")
|
|
5980
5812
|
};
|
|
5981
5813
|
};
|
|
5982
5814
|
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
@@ -6014,7 +5846,7 @@ var LoggingServiceImpl = class {
|
|
|
6014
5846
|
}
|
|
6015
5847
|
const record = {
|
|
6016
5848
|
...entry2,
|
|
6017
|
-
context: (0,
|
|
5849
|
+
context: (0, import_util14.jsonify)((0, import_log17.getContextFromEntry)(entry2)),
|
|
6018
5850
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6019
5851
|
meta: {
|
|
6020
5852
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6023,7 +5855,7 @@ var LoggingServiceImpl = class {
|
|
|
6023
5855
|
scope: {
|
|
6024
5856
|
hostSessionId: this._sessionId,
|
|
6025
5857
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6026
|
-
name: (0,
|
|
5858
|
+
name: (0, import_util14.getDebugName)(entry2.meta?.S)
|
|
6027
5859
|
}
|
|
6028
5860
|
}
|
|
6029
5861
|
};
|
|
@@ -6040,16 +5872,16 @@ var LoggingServiceImpl = class {
|
|
|
6040
5872
|
};
|
|
6041
5873
|
var matchFilter = (filter, level, path2, options) => {
|
|
6042
5874
|
switch (options) {
|
|
6043
|
-
case
|
|
5875
|
+
case import_services18.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
6044
5876
|
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
6045
|
-
case
|
|
5877
|
+
case import_services18.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
6046
5878
|
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
6047
5879
|
}
|
|
6048
5880
|
};
|
|
6049
5881
|
var shouldLog = (entry2, request) => {
|
|
6050
|
-
const options = request.options ??
|
|
5882
|
+
const options = request.options ?? import_services18.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
6051
5883
|
if (request.filters === void 0) {
|
|
6052
|
-
return options ===
|
|
5884
|
+
return options === import_services18.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
6053
5885
|
} else {
|
|
6054
5886
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
6055
5887
|
}
|
|
@@ -6104,9 +5936,9 @@ var SystemServiceImpl = class {
|
|
|
6104
5936
|
const diagnostics = await this._getDiagnostics();
|
|
6105
5937
|
return {
|
|
6106
5938
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6107
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6108
|
-
truncate: keys ===
|
|
6109
|
-
humanize: keys ===
|
|
5939
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util15.jsonKeyReplacer)({
|
|
5940
|
+
truncate: keys === import_services19.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
5941
|
+
humanize: keys === import_services19.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6110
5942
|
})))
|
|
6111
5943
|
};
|
|
6112
5944
|
}
|
|
@@ -6147,7 +5979,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6147
5979
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6148
5980
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6149
5981
|
}
|
|
6150
|
-
var
|
|
5982
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6151
5983
|
var ClientServicesHost = class {
|
|
6152
5984
|
constructor({
|
|
6153
5985
|
config,
|
|
@@ -6167,7 +5999,7 @@ var ClientServicesHost = class {
|
|
|
6167
5999
|
this._storage = storage;
|
|
6168
6000
|
this._level = level;
|
|
6169
6001
|
this._callbacks = callbacks;
|
|
6170
|
-
this._runtimeParams = runtimeParams
|
|
6002
|
+
this._runtimeParams = runtimeParams;
|
|
6171
6003
|
if (config) {
|
|
6172
6004
|
this.initialize({
|
|
6173
6005
|
config,
|
|
@@ -6180,7 +6012,7 @@ var ClientServicesHost = class {
|
|
|
6180
6012
|
lockKey,
|
|
6181
6013
|
onAcquire: () => {
|
|
6182
6014
|
if (!this._opening) {
|
|
6183
|
-
void this.open(new
|
|
6015
|
+
void this.open(new import_context13.Context());
|
|
6184
6016
|
}
|
|
6185
6017
|
},
|
|
6186
6018
|
onRelease: () => this.close()
|
|
@@ -6189,14 +6021,14 @@ var ClientServicesHost = class {
|
|
|
6189
6021
|
this._systemService = new SystemServiceImpl({
|
|
6190
6022
|
config: () => this._config,
|
|
6191
6023
|
statusUpdate: this._statusUpdate,
|
|
6192
|
-
getCurrentStatus: () => this.isOpen ?
|
|
6024
|
+
getCurrentStatus: () => this.isOpen ? import_services15.SystemStatus.ACTIVE : import_services15.SystemStatus.INACTIVE,
|
|
6193
6025
|
getDiagnostics: () => {
|
|
6194
6026
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
6195
6027
|
},
|
|
6196
6028
|
onUpdateStatus: async (status) => {
|
|
6197
|
-
if (!this.isOpen && status ===
|
|
6029
|
+
if (!this.isOpen && status === import_services15.SystemStatus.ACTIVE) {
|
|
6198
6030
|
await this._resourceLock?.acquire();
|
|
6199
|
-
} else if (this.isOpen && status ===
|
|
6031
|
+
} else if (this.isOpen && status === import_services15.SystemStatus.INACTIVE) {
|
|
6200
6032
|
await this._resourceLock?.release();
|
|
6201
6033
|
}
|
|
6202
6034
|
},
|
|
@@ -6206,7 +6038,7 @@ var ClientServicesHost = class {
|
|
|
6206
6038
|
});
|
|
6207
6039
|
this.diagnosticsBroadcastHandler = createCollectDiagnosticsBroadcastHandler(this._systemService);
|
|
6208
6040
|
this._loggingService = new LoggingServiceImpl();
|
|
6209
|
-
this._serviceRegistry = new ServiceRegistry(
|
|
6041
|
+
this._serviceRegistry = new ServiceRegistry(import_client_protocol6.clientServiceBundle, {
|
|
6210
6042
|
SystemService: this._systemService,
|
|
6211
6043
|
TracingService: this._tracingService
|
|
6212
6044
|
});
|
|
@@ -6236,24 +6068,24 @@ var ClientServicesHost = class {
|
|
|
6236
6068
|
*/
|
|
6237
6069
|
initialize({ config, ...options }) {
|
|
6238
6070
|
(0, import_invariant18.invariant)(!this._open, "service host is open", {
|
|
6239
|
-
F:
|
|
6240
|
-
L:
|
|
6071
|
+
F: __dxlog_file20,
|
|
6072
|
+
L: 189,
|
|
6241
6073
|
S: this,
|
|
6242
6074
|
A: [
|
|
6243
6075
|
"!this._open",
|
|
6244
6076
|
"'service host is open'"
|
|
6245
6077
|
]
|
|
6246
6078
|
});
|
|
6247
|
-
(0,
|
|
6248
|
-
F:
|
|
6249
|
-
L:
|
|
6079
|
+
(0, import_log16.log)("initializing...", void 0, {
|
|
6080
|
+
F: __dxlog_file20,
|
|
6081
|
+
L: 190,
|
|
6250
6082
|
S: this,
|
|
6251
6083
|
C: (f, a) => f(...a)
|
|
6252
6084
|
});
|
|
6253
6085
|
if (config) {
|
|
6254
6086
|
(0, import_invariant18.invariant)(!this._config, "config already set", {
|
|
6255
|
-
F:
|
|
6256
|
-
L:
|
|
6087
|
+
F: __dxlog_file20,
|
|
6088
|
+
L: 193,
|
|
6257
6089
|
S: this,
|
|
6258
6090
|
A: [
|
|
6259
6091
|
"!this._config",
|
|
@@ -6266,9 +6098,9 @@ var ClientServicesHost = class {
|
|
|
6266
6098
|
}
|
|
6267
6099
|
}
|
|
6268
6100
|
if (!options.signalManager) {
|
|
6269
|
-
|
|
6270
|
-
F:
|
|
6271
|
-
L:
|
|
6101
|
+
import_log16.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6102
|
+
F: __dxlog_file20,
|
|
6103
|
+
L: 201,
|
|
6272
6104
|
S: this,
|
|
6273
6105
|
C: (f, a) => f(...a)
|
|
6274
6106
|
});
|
|
@@ -6278,8 +6110,8 @@ var ClientServicesHost = class {
|
|
|
6278
6110
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6279
6111
|
this._signalManager = signalManager;
|
|
6280
6112
|
(0, import_invariant18.invariant)(!this._networkManager, "network manager already set", {
|
|
6281
|
-
F:
|
|
6282
|
-
L:
|
|
6113
|
+
F: __dxlog_file20,
|
|
6114
|
+
L: 212,
|
|
6283
6115
|
S: this,
|
|
6284
6116
|
A: [
|
|
6285
6117
|
"!this._networkManager",
|
|
@@ -6291,9 +6123,9 @@ var ClientServicesHost = class {
|
|
|
6291
6123
|
transportFactory,
|
|
6292
6124
|
signalManager
|
|
6293
6125
|
});
|
|
6294
|
-
(0,
|
|
6295
|
-
F:
|
|
6296
|
-
L:
|
|
6126
|
+
(0, import_log16.log)("initialized", void 0, {
|
|
6127
|
+
F: __dxlog_file20,
|
|
6128
|
+
L: 219,
|
|
6297
6129
|
S: this,
|
|
6298
6130
|
C: (f, a) => f(...a)
|
|
6299
6131
|
});
|
|
@@ -6302,18 +6134,18 @@ var ClientServicesHost = class {
|
|
|
6302
6134
|
if (this._open) {
|
|
6303
6135
|
return;
|
|
6304
6136
|
}
|
|
6305
|
-
const traceId =
|
|
6306
|
-
|
|
6137
|
+
const traceId = import_keys14.PublicKey.random().toHex();
|
|
6138
|
+
import_log16.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
|
|
6307
6139
|
id: traceId
|
|
6308
6140
|
}), {
|
|
6309
|
-
F:
|
|
6310
|
-
L:
|
|
6141
|
+
F: __dxlog_file20,
|
|
6142
|
+
L: 230,
|
|
6311
6143
|
S: this,
|
|
6312
6144
|
C: (f, a) => f(...a)
|
|
6313
6145
|
});
|
|
6314
6146
|
(0, import_invariant18.invariant)(this._config, "config not set", {
|
|
6315
|
-
F:
|
|
6316
|
-
L:
|
|
6147
|
+
F: __dxlog_file20,
|
|
6148
|
+
L: 232,
|
|
6317
6149
|
S: this,
|
|
6318
6150
|
A: [
|
|
6319
6151
|
"this._config",
|
|
@@ -6321,8 +6153,8 @@ var ClientServicesHost = class {
|
|
|
6321
6153
|
]
|
|
6322
6154
|
});
|
|
6323
6155
|
(0, import_invariant18.invariant)(this._storage, "storage not set", {
|
|
6324
|
-
F:
|
|
6325
|
-
L:
|
|
6156
|
+
F: __dxlog_file20,
|
|
6157
|
+
L: 233,
|
|
6326
6158
|
S: this,
|
|
6327
6159
|
A: [
|
|
6328
6160
|
"this._storage",
|
|
@@ -6330,8 +6162,8 @@ var ClientServicesHost = class {
|
|
|
6330
6162
|
]
|
|
6331
6163
|
});
|
|
6332
6164
|
(0, import_invariant18.invariant)(this._signalManager, "signal manager not set", {
|
|
6333
|
-
F:
|
|
6334
|
-
L:
|
|
6165
|
+
F: __dxlog_file20,
|
|
6166
|
+
L: 234,
|
|
6335
6167
|
S: this,
|
|
6336
6168
|
A: [
|
|
6337
6169
|
"this._signalManager",
|
|
@@ -6339,8 +6171,8 @@ var ClientServicesHost = class {
|
|
|
6339
6171
|
]
|
|
6340
6172
|
});
|
|
6341
6173
|
(0, import_invariant18.invariant)(this._networkManager, "network manager not set", {
|
|
6342
|
-
F:
|
|
6343
|
-
L:
|
|
6174
|
+
F: __dxlog_file20,
|
|
6175
|
+
L: 235,
|
|
6344
6176
|
S: this,
|
|
6345
6177
|
A: [
|
|
6346
6178
|
"this._networkManager",
|
|
@@ -6348,11 +6180,11 @@ var ClientServicesHost = class {
|
|
|
6348
6180
|
]
|
|
6349
6181
|
});
|
|
6350
6182
|
this._opening = true;
|
|
6351
|
-
(0,
|
|
6183
|
+
(0, import_log16.log)("opening...", {
|
|
6352
6184
|
lockKey: this._resourceLock?.lockKey
|
|
6353
6185
|
}, {
|
|
6354
|
-
F:
|
|
6355
|
-
L:
|
|
6186
|
+
F: __dxlog_file20,
|
|
6187
|
+
L: 238,
|
|
6356
6188
|
S: this,
|
|
6357
6189
|
C: (f, a) => f(...a)
|
|
6358
6190
|
});
|
|
@@ -6363,10 +6195,9 @@ var ClientServicesHost = class {
|
|
|
6363
6195
|
await this._level.open();
|
|
6364
6196
|
await this._loggingService.open();
|
|
6365
6197
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
6366
|
-
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6367
6198
|
this._serviceRegistry.setServices({
|
|
6368
6199
|
SystemService: this._systemService,
|
|
6369
|
-
IdentityService:
|
|
6200
|
+
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
6370
6201
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6371
6202
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6372
6203
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
|
|
@@ -6386,13 +6217,12 @@ var ClientServicesHost = class {
|
|
|
6386
6217
|
})
|
|
6387
6218
|
});
|
|
6388
6219
|
await this._serviceContext.open(ctx);
|
|
6389
|
-
await identityService.open();
|
|
6390
6220
|
const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
|
|
6391
6221
|
if (devtoolsProxy) {
|
|
6392
6222
|
this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
|
|
6393
6223
|
url: devtoolsProxy,
|
|
6394
6224
|
requested: {},
|
|
6395
|
-
exposed:
|
|
6225
|
+
exposed: import_client_protocol6.clientServiceBundle,
|
|
6396
6226
|
handlers: this.services
|
|
6397
6227
|
});
|
|
6398
6228
|
void this._devtoolsProxy.open();
|
|
@@ -6402,18 +6232,18 @@ var ClientServicesHost = class {
|
|
|
6402
6232
|
this._open = true;
|
|
6403
6233
|
this._statusUpdate.emit();
|
|
6404
6234
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6405
|
-
(0,
|
|
6235
|
+
(0, import_log16.log)("opened", {
|
|
6406
6236
|
deviceKey
|
|
6407
6237
|
}, {
|
|
6408
|
-
F:
|
|
6238
|
+
F: __dxlog_file20,
|
|
6409
6239
|
L: 314,
|
|
6410
6240
|
S: this,
|
|
6411
6241
|
C: (f, a) => f(...a)
|
|
6412
6242
|
});
|
|
6413
|
-
|
|
6243
|
+
import_log16.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
|
|
6414
6244
|
id: traceId
|
|
6415
6245
|
}), {
|
|
6416
|
-
F:
|
|
6246
|
+
F: __dxlog_file20,
|
|
6417
6247
|
L: 315,
|
|
6418
6248
|
S: this,
|
|
6419
6249
|
C: (f, a) => f(...a)
|
|
@@ -6424,10 +6254,10 @@ var ClientServicesHost = class {
|
|
|
6424
6254
|
return;
|
|
6425
6255
|
}
|
|
6426
6256
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6427
|
-
(0,
|
|
6257
|
+
(0, import_log16.log)("closing...", {
|
|
6428
6258
|
deviceKey
|
|
6429
6259
|
}, {
|
|
6430
|
-
F:
|
|
6260
|
+
F: __dxlog_file20,
|
|
6431
6261
|
L: 326,
|
|
6432
6262
|
S: this,
|
|
6433
6263
|
C: (f, a) => f(...a)
|
|
@@ -6442,43 +6272,43 @@ var ClientServicesHost = class {
|
|
|
6442
6272
|
await this._level?.close();
|
|
6443
6273
|
this._open = false;
|
|
6444
6274
|
this._statusUpdate.emit();
|
|
6445
|
-
(0,
|
|
6275
|
+
(0, import_log16.log)("closed", {
|
|
6446
6276
|
deviceKey
|
|
6447
6277
|
}, {
|
|
6448
|
-
F:
|
|
6278
|
+
F: __dxlog_file20,
|
|
6449
6279
|
L: 335,
|
|
6450
6280
|
S: this,
|
|
6451
6281
|
C: (f, a) => f(...a)
|
|
6452
6282
|
});
|
|
6453
6283
|
}
|
|
6454
6284
|
async reset() {
|
|
6455
|
-
const traceId =
|
|
6456
|
-
|
|
6285
|
+
const traceId = import_keys14.PublicKey.random().toHex();
|
|
6286
|
+
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
|
|
6457
6287
|
id: traceId
|
|
6458
6288
|
}), {
|
|
6459
|
-
F:
|
|
6289
|
+
F: __dxlog_file20,
|
|
6460
6290
|
L: 340,
|
|
6461
6291
|
S: this,
|
|
6462
6292
|
C: (f, a) => f(...a)
|
|
6463
6293
|
});
|
|
6464
|
-
|
|
6465
|
-
F:
|
|
6294
|
+
import_log16.log.info("resetting...", void 0, {
|
|
6295
|
+
F: __dxlog_file20,
|
|
6466
6296
|
L: 342,
|
|
6467
6297
|
S: this,
|
|
6468
6298
|
C: (f, a) => f(...a)
|
|
6469
6299
|
});
|
|
6470
6300
|
await this._serviceContext?.close();
|
|
6471
6301
|
await this._storage.reset();
|
|
6472
|
-
|
|
6473
|
-
F:
|
|
6302
|
+
import_log16.log.info("reset", void 0, {
|
|
6303
|
+
F: __dxlog_file20,
|
|
6474
6304
|
L: 345,
|
|
6475
6305
|
S: this,
|
|
6476
6306
|
C: (f, a) => f(...a)
|
|
6477
6307
|
});
|
|
6478
|
-
|
|
6308
|
+
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
|
|
6479
6309
|
id: traceId
|
|
6480
6310
|
}), {
|
|
6481
|
-
F:
|
|
6311
|
+
F: __dxlog_file20,
|
|
6482
6312
|
L: 346,
|
|
6483
6313
|
S: this,
|
|
6484
6314
|
C: (f, a) => f(...a)
|
|
@@ -6488,6 +6318,38 @@ var ClientServicesHost = class {
|
|
|
6488
6318
|
async _createIdentity(params) {
|
|
6489
6319
|
const identity = await this._serviceContext.createIdentity(params);
|
|
6490
6320
|
await this._serviceContext.initialized.wait();
|
|
6321
|
+
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
6322
|
+
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
6323
|
+
(0, import_invariant18.invariant)(automergeIndex, void 0, {
|
|
6324
|
+
F: __dxlog_file20,
|
|
6325
|
+
L: 358,
|
|
6326
|
+
S: this,
|
|
6327
|
+
A: [
|
|
6328
|
+
"automergeIndex",
|
|
6329
|
+
""
|
|
6330
|
+
]
|
|
6331
|
+
});
|
|
6332
|
+
const document = this._serviceContext.echoHost.automergeRepo.find(automergeIndex);
|
|
6333
|
+
await document.whenReady();
|
|
6334
|
+
const properties = {
|
|
6335
|
+
system: {
|
|
6336
|
+
type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol6.PropertiesType))
|
|
6337
|
+
},
|
|
6338
|
+
data: {
|
|
6339
|
+
[import_client_protocol6.defaultKey]: identity.identityKey.toHex()
|
|
6340
|
+
},
|
|
6341
|
+
meta: {
|
|
6342
|
+
keys: []
|
|
6343
|
+
}
|
|
6344
|
+
};
|
|
6345
|
+
const propertiesId = import_keys14.PublicKey.random().toHex();
|
|
6346
|
+
document.change((doc) => {
|
|
6347
|
+
(0, import_util11.assignDeep)(doc, [
|
|
6348
|
+
"objects",
|
|
6349
|
+
propertiesId
|
|
6350
|
+
], properties);
|
|
6351
|
+
});
|
|
6352
|
+
await this._serviceContext.echoHost.flush();
|
|
6491
6353
|
return identity;
|
|
6492
6354
|
}
|
|
6493
6355
|
};
|
|
@@ -6549,4 +6411,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6549
6411
|
subscribeToSpaces,
|
|
6550
6412
|
subscribeToSwarmInfo
|
|
6551
6413
|
});
|
|
6552
|
-
//# sourceMappingURL=chunk-
|
|
6414
|
+
//# sourceMappingURL=chunk-FTGPY2GQ.cjs.map
|