@dxos/client-services 0.4.10-main.3e35a2f → 0.4.10-main.3f5e2d2
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-S3G2RM7S.mjs → chunk-HIQTBJPW.mjs} +837 -715
- package/dist/lib/browser/chunk-HIQTBJPW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +10 -4
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +132 -116
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-3T6D6GIB.cjs → chunk-JGUWA36I.cjs} +859 -733
- package/dist/lib/node/chunk-JGUWA36I.cjs.map +7 -0
- package/dist/lib/node/index.cjs +50 -44
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +131 -118
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +3 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/index.d.ts +1 -0
- package/dist/types/src/packlets/invitations/index.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts +1 -0
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +6 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +8 -3
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts +44 -0
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +7 -23
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +2 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +6 -6
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +2 -2
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +8 -3
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +4 -3
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +9 -6
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +34 -34
- package/src/packlets/identity/identity-manager.ts +1 -0
- package/src/packlets/identity/identity.test.ts +3 -0
- package/src/packlets/invitations/device-invitation-protocol.ts +6 -1
- package/src/packlets/invitations/index.ts +1 -0
- package/src/packlets/invitations/invitation-extension.ts +28 -1
- package/src/packlets/invitations/invitation-protocol.ts +7 -1
- package/src/packlets/invitations/invitations-handler.ts +77 -91
- package/src/packlets/invitations/invitations-manager.ts +271 -0
- package/src/packlets/invitations/invitations-service.ts +23 -168
- package/src/packlets/invitations/space-invitation-protocol.ts +45 -3
- package/src/packlets/services/automerge-host.test.ts +4 -4
- package/src/packlets/services/service-context.test.ts +3 -3
- package/src/packlets/services/service-context.ts +23 -25
- package/src/packlets/services/service-host.test.ts +6 -0
- package/src/packlets/services/service-host.ts +9 -29
- package/src/packlets/spaces/data-space-manager.test.ts +4 -4
- package/src/packlets/spaces/data-space-manager.ts +56 -13
- package/src/packlets/spaces/data-space.ts +14 -19
- package/src/packlets/testing/invitation-utils.ts +100 -97
- package/src/packlets/testing/test-builder.ts +29 -16
- package/src/packlets/vault/worker-runtime.ts +3 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-S3G2RM7S.mjs.map +0 -7
- package/dist/lib/node/chunk-3T6D6GIB.cjs.map +0 -7
- package/dist/types/src/packlets/indexing/index.d.ts +0 -2
- package/dist/types/src/packlets/indexing/index.d.ts.map +0 -1
- package/dist/types/src/packlets/indexing/util.d.ts +0 -15
- package/dist/types/src/packlets/indexing/util.d.ts.map +0 -1
- package/src/packlets/indexing/index.ts +0 -5
- package/src/packlets/indexing/util.ts +0 -89
|
@@ -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_JGUWA36I_exports = {};
|
|
30
|
+
__export(chunk_JGUWA36I_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -41,6 +41,7 @@ __export(chunk_3T6D6GIB_exports, {
|
|
|
41
41
|
IdentityManager: () => IdentityManager,
|
|
42
42
|
IdentityServiceImpl: () => IdentityServiceImpl,
|
|
43
43
|
InvitationsHandler: () => InvitationsHandler,
|
|
44
|
+
InvitationsManager: () => InvitationsManager,
|
|
44
45
|
InvitationsServiceImpl: () => InvitationsServiceImpl,
|
|
45
46
|
Lock: () => Lock,
|
|
46
47
|
ServiceContext: () => ServiceContext,
|
|
@@ -48,6 +49,7 @@ __export(chunk_3T6D6GIB_exports, {
|
|
|
48
49
|
SpaceInvitationProtocol: () => SpaceInvitationProtocol,
|
|
49
50
|
SpacesServiceImpl: () => SpacesServiceImpl,
|
|
50
51
|
TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
|
|
52
|
+
createAdmissionKeypair: () => createAdmissionKeypair,
|
|
51
53
|
createAuthProvider: () => createAuthProvider,
|
|
52
54
|
createCollectDiagnosticsBroadcastHandler: () => createCollectDiagnosticsBroadcastHandler,
|
|
53
55
|
createCollectDiagnosticsBroadcastSender: () => createCollectDiagnosticsBroadcastSender,
|
|
@@ -64,7 +66,7 @@ __export(chunk_3T6D6GIB_exports, {
|
|
|
64
66
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
65
67
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
66
68
|
});
|
|
67
|
-
module.exports = __toCommonJS(
|
|
69
|
+
module.exports = __toCommonJS(chunk_JGUWA36I_exports);
|
|
68
70
|
var import_async = require("@dxos/async");
|
|
69
71
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
70
72
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -118,7 +120,7 @@ var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
118
120
|
var import_async7 = require("@dxos/async");
|
|
119
121
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
120
122
|
var import_context4 = require("@dxos/context");
|
|
121
|
-
var
|
|
123
|
+
var import_crypto = require("@dxos/crypto");
|
|
122
124
|
var import_invariant5 = require("@dxos/invariant");
|
|
123
125
|
var import_keys5 = require("@dxos/keys");
|
|
124
126
|
var import_log4 = require("@dxos/log");
|
|
@@ -128,6 +130,7 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
128
130
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
129
131
|
var import_async8 = require("@dxos/async");
|
|
130
132
|
var import_context5 = require("@dxos/context");
|
|
133
|
+
var import_crypto2 = require("@dxos/crypto");
|
|
131
134
|
var import_invariant6 = require("@dxos/invariant");
|
|
132
135
|
var import_keys6 = require("@dxos/keys");
|
|
133
136
|
var import_log5 = require("@dxos/log");
|
|
@@ -135,62 +138,67 @@ var import_protocols5 = require("@dxos/protocols");
|
|
|
135
138
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
136
139
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
137
140
|
var import_teleport = require("@dxos/teleport");
|
|
138
|
-
var import_async9 = require("@dxos/async");
|
|
139
141
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
140
|
-
var import_context6 = require("@dxos/context");
|
|
141
|
-
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
142
|
-
var import_invariant7 = require("@dxos/invariant");
|
|
143
|
-
var import_log6 = require("@dxos/log");
|
|
144
142
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
145
|
-
var
|
|
143
|
+
var import_credentials7 = require("@dxos/credentials");
|
|
146
144
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
147
|
-
var
|
|
148
|
-
var
|
|
145
|
+
var import_invariant7 = require("@dxos/invariant");
|
|
146
|
+
var import_log6 = require("@dxos/log");
|
|
149
147
|
var import_protocols6 = require("@dxos/protocols");
|
|
150
148
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
149
|
+
var import_credentials8 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
150
|
+
var import_async9 = require("@dxos/async");
|
|
151
|
+
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
152
|
+
var import_context6 = require("@dxos/context");
|
|
153
|
+
var import_credentials9 = require("@dxos/credentials");
|
|
154
|
+
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
155
|
+
var import_invariant8 = require("@dxos/invariant");
|
|
156
|
+
var import_keys7 = require("@dxos/keys");
|
|
157
|
+
var import_log7 = require("@dxos/log");
|
|
158
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
151
159
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
152
160
|
var import_debug2 = require("@dxos/debug");
|
|
153
161
|
var import_rpc = require("@dxos/rpc");
|
|
154
162
|
var import_tracing3 = require("@dxos/tracing");
|
|
155
163
|
var import_async10 = require("@dxos/async");
|
|
156
|
-
var
|
|
164
|
+
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
157
165
|
var import_context7 = require("@dxos/context");
|
|
158
166
|
var import_debug3 = require("@dxos/debug");
|
|
159
|
-
var import_echo_db = require("@dxos/echo-db");
|
|
160
167
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
161
168
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
169
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
162
170
|
var import_invariant9 = require("@dxos/invariant");
|
|
163
|
-
var
|
|
171
|
+
var import_keys8 = require("@dxos/keys");
|
|
164
172
|
var import_log8 = require("@dxos/log");
|
|
165
173
|
var import_protocols7 = require("@dxos/protocols");
|
|
166
|
-
var
|
|
167
|
-
var
|
|
174
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
175
|
+
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
168
176
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
169
177
|
var import_tracing4 = require("@dxos/tracing");
|
|
170
178
|
var import_util4 = require("@dxos/util");
|
|
171
179
|
var import_async11 = require("@dxos/async");
|
|
172
|
-
var
|
|
180
|
+
var import_credentials11 = require("@dxos/credentials");
|
|
173
181
|
var import_async12 = require("@dxos/async");
|
|
174
182
|
var import_context8 = require("@dxos/context");
|
|
175
183
|
var import_invariant10 = require("@dxos/invariant");
|
|
176
|
-
var
|
|
184
|
+
var import_keys9 = require("@dxos/keys");
|
|
177
185
|
var import_log9 = require("@dxos/log");
|
|
178
186
|
var import_protocols8 = require("@dxos/protocols");
|
|
179
187
|
var import_teleport2 = require("@dxos/teleport");
|
|
180
188
|
var import_util5 = require("@dxos/util");
|
|
181
189
|
var import_async13 = require("@dxos/async");
|
|
182
190
|
var import_context9 = require("@dxos/context");
|
|
183
|
-
var
|
|
191
|
+
var import_credentials12 = require("@dxos/credentials");
|
|
184
192
|
var import_invariant11 = require("@dxos/invariant");
|
|
185
|
-
var
|
|
193
|
+
var import_keys10 = require("@dxos/keys");
|
|
186
194
|
var import_log10 = require("@dxos/log");
|
|
187
195
|
var import_protocols9 = require("@dxos/protocols");
|
|
188
|
-
var
|
|
196
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
189
197
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
190
198
|
var import_util6 = require("@dxos/util");
|
|
191
|
-
var
|
|
199
|
+
var import_credentials13 = require("@dxos/credentials");
|
|
192
200
|
var import_debug4 = require("@dxos/debug");
|
|
193
|
-
var
|
|
201
|
+
var import_credentials14 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
194
202
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
195
203
|
var import_async14 = require("@dxos/async");
|
|
196
204
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
@@ -198,80 +206,76 @@ var import_debug5 = require("@dxos/debug");
|
|
|
198
206
|
var import_invariant12 = require("@dxos/invariant");
|
|
199
207
|
var import_log11 = require("@dxos/log");
|
|
200
208
|
var import_protocols10 = require("@dxos/protocols");
|
|
201
|
-
var
|
|
209
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
202
210
|
var import_async15 = require("@dxos/async");
|
|
203
211
|
var import_context10 = require("@dxos/context");
|
|
204
|
-
var
|
|
212
|
+
var import_credentials15 = require("@dxos/credentials");
|
|
205
213
|
var import_debug6 = require("@dxos/debug");
|
|
214
|
+
var import_echo_db = require("@dxos/echo-db");
|
|
206
215
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
207
216
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
208
|
-
var import_indexing = require("@dxos/indexing");
|
|
209
217
|
var import_invariant13 = require("@dxos/invariant");
|
|
210
218
|
var import_keyring = require("@dxos/keyring");
|
|
211
|
-
var
|
|
219
|
+
var import_keys11 = require("@dxos/keys");
|
|
212
220
|
var import_log12 = require("@dxos/log");
|
|
213
221
|
var import_protocols11 = require("@dxos/protocols");
|
|
214
|
-
var
|
|
222
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
215
223
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
216
224
|
var import_tracing5 = require("@dxos/tracing");
|
|
217
225
|
var import_util7 = require("@dxos/util");
|
|
218
|
-
var import_automerge = require("@dxos/automerge/automerge");
|
|
219
|
-
var import_debug7 = require("@dxos/debug");
|
|
220
|
-
var import_protocols12 = require("@dxos/protocols");
|
|
221
226
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
222
|
-
var
|
|
227
|
+
var import_credentials16 = require("@dxos/credentials");
|
|
223
228
|
var import_invariant14 = require("@dxos/invariant");
|
|
224
|
-
var
|
|
225
|
-
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
226
|
-
var import_tracing6 = require("@dxos/tracing");
|
|
229
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
227
230
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
228
|
-
var
|
|
231
|
+
var import_tracing6 = require("@dxos/tracing");
|
|
229
232
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
233
|
+
var import_config = require("@dxos/config");
|
|
234
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
230
235
|
var import_tracing7 = require("@dxos/tracing");
|
|
231
236
|
var import_util8 = require("@dxos/util");
|
|
232
237
|
var import_async16 = require("@dxos/async");
|
|
233
|
-
var
|
|
238
|
+
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
234
239
|
var import_context11 = require("@dxos/context");
|
|
235
240
|
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
236
|
-
var
|
|
237
|
-
var import_indexing2 = require("@dxos/indexing");
|
|
241
|
+
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
238
242
|
var import_invariant15 = require("@dxos/invariant");
|
|
239
|
-
var
|
|
243
|
+
var import_keys12 = require("@dxos/keys");
|
|
240
244
|
var import_log13 = require("@dxos/log");
|
|
241
245
|
var import_messaging = require("@dxos/messaging");
|
|
242
246
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
243
|
-
var
|
|
244
|
-
var
|
|
247
|
+
var import_protocols13 = require("@dxos/protocols");
|
|
248
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
245
249
|
var import_tracing8 = require("@dxos/tracing");
|
|
246
250
|
var import_util9 = require("@dxos/util");
|
|
247
251
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
248
252
|
var import_async17 = require("@dxos/async");
|
|
249
253
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
250
254
|
var import_invariant16 = require("@dxos/invariant");
|
|
251
|
-
var
|
|
255
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
252
256
|
var import_invariant17 = require("@dxos/invariant");
|
|
253
257
|
var import_lock_file = require("@dxos/lock-file");
|
|
254
258
|
var import_log14 = require("@dxos/log");
|
|
255
259
|
var import_async18 = require("@dxos/async");
|
|
256
260
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
257
|
-
var
|
|
261
|
+
var import_keys13 = require("@dxos/keys");
|
|
258
262
|
var import_log15 = require("@dxos/log");
|
|
259
|
-
var
|
|
263
|
+
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
260
264
|
var import_util10 = require("@dxos/util");
|
|
261
265
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
262
|
-
var
|
|
266
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
263
267
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
264
268
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
265
|
-
var
|
|
269
|
+
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
266
270
|
var import_config3 = require("@dxos/protocols/proto/dxos/config");
|
|
267
271
|
var import_util11 = require("@dxos/util");
|
|
268
272
|
var import_level = require("level");
|
|
269
273
|
var import_node_path = __toESM(require("node:path"));
|
|
270
|
-
var
|
|
274
|
+
var import_keys14 = require("@dxos/keys");
|
|
271
275
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
272
|
-
var
|
|
276
|
+
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
273
277
|
var import_util12 = require("@dxos/util");
|
|
274
|
-
var
|
|
278
|
+
var import_keys15 = require("@dxos/keys");
|
|
275
279
|
var import_util13 = require("@dxos/util");
|
|
276
280
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
277
281
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
@@ -1290,7 +1294,9 @@ var IdentityManager = class {
|
|
|
1290
1294
|
C: (f, a) => f(...a)
|
|
1291
1295
|
});
|
|
1292
1296
|
},
|
|
1293
|
-
memberKey: identityKey
|
|
1297
|
+
memberKey: identityKey,
|
|
1298
|
+
onDelegatedInvitationStatusChange: async () => {
|
|
1299
|
+
}
|
|
1294
1300
|
});
|
|
1295
1301
|
}
|
|
1296
1302
|
};
|
|
@@ -1387,10 +1393,13 @@ var DeviceInvitationProtocol = class {
|
|
|
1387
1393
|
kind: import_services2.Invitation.Kind.DEVICE
|
|
1388
1394
|
};
|
|
1389
1395
|
}
|
|
1390
|
-
async
|
|
1396
|
+
async delegate(invitation) {
|
|
1397
|
+
throw new Error("delegation not supported");
|
|
1398
|
+
}
|
|
1399
|
+
async admit(_, request) {
|
|
1391
1400
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1392
1401
|
F: __dxlog_file5,
|
|
1393
|
-
L:
|
|
1402
|
+
L: 42,
|
|
1394
1403
|
S: this,
|
|
1395
1404
|
A: [
|
|
1396
1405
|
"request.device",
|
|
@@ -1436,7 +1445,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1436
1445
|
async accept(response, request) {
|
|
1437
1446
|
(0, import_invariant4.invariant)(response.device, void 0, {
|
|
1438
1447
|
F: __dxlog_file5,
|
|
1439
|
-
L:
|
|
1448
|
+
L: 87,
|
|
1440
1449
|
S: this,
|
|
1441
1450
|
A: [
|
|
1442
1451
|
"response.device",
|
|
@@ -1446,7 +1455,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1446
1455
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1447
1456
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1448
1457
|
F: __dxlog_file5,
|
|
1449
|
-
L:
|
|
1458
|
+
L: 90,
|
|
1450
1459
|
S: this,
|
|
1451
1460
|
A: [
|
|
1452
1461
|
"request.device",
|
|
@@ -1485,6 +1494,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1485
1494
|
this._callbacks = _callbacks;
|
|
1486
1495
|
this._ctx = new import_context5.Context();
|
|
1487
1496
|
this._remoteOptionsTrigger = new import_async8.Trigger();
|
|
1497
|
+
this._challenge = void 0;
|
|
1488
1498
|
this.invitation = void 0;
|
|
1489
1499
|
this.guestProfile = void 0;
|
|
1490
1500
|
this.authenticationPassed = false;
|
|
@@ -1499,7 +1509,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1499
1509
|
options: async (options) => {
|
|
1500
1510
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1501
1511
|
F: __dxlog_file6,
|
|
1502
|
-
L:
|
|
1512
|
+
L: 90,
|
|
1503
1513
|
S: this,
|
|
1504
1514
|
A: [
|
|
1505
1515
|
"!this._remoteOptions",
|
|
@@ -1516,7 +1526,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1516
1526
|
id: traceId
|
|
1517
1527
|
}), {
|
|
1518
1528
|
F: __dxlog_file6,
|
|
1519
|
-
L:
|
|
1529
|
+
L: 99,
|
|
1520
1530
|
S: this,
|
|
1521
1531
|
C: (f, a) => f(...a)
|
|
1522
1532
|
});
|
|
@@ -1526,7 +1536,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1526
1536
|
invitationId
|
|
1527
1537
|
}, {
|
|
1528
1538
|
F: __dxlog_file6,
|
|
1529
|
-
L:
|
|
1539
|
+
L: 103,
|
|
1530
1540
|
S: this,
|
|
1531
1541
|
C: (f, a) => f(...a)
|
|
1532
1542
|
});
|
|
@@ -1540,7 +1550,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1540
1550
|
guestProfile: profile
|
|
1541
1551
|
}, {
|
|
1542
1552
|
F: __dxlog_file6,
|
|
1543
|
-
L:
|
|
1553
|
+
L: 112,
|
|
1544
1554
|
S: this,
|
|
1545
1555
|
C: (f, a) => f(...a)
|
|
1546
1556
|
});
|
|
@@ -1549,25 +1559,27 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1549
1559
|
...this.invitation,
|
|
1550
1560
|
state: import_services4.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1551
1561
|
});
|
|
1562
|
+
this._challenge = this.invitation.authMethod === import_services4.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
1552
1563
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1553
1564
|
id: traceId
|
|
1554
1565
|
}), {
|
|
1555
1566
|
F: __dxlog_file6,
|
|
1556
|
-
L:
|
|
1567
|
+
L: 122,
|
|
1557
1568
|
S: this,
|
|
1558
1569
|
C: (f, a) => f(...a)
|
|
1559
1570
|
});
|
|
1560
1571
|
return {
|
|
1561
|
-
authMethod: this.invitation.authMethod
|
|
1572
|
+
authMethod: this.invitation.authMethod,
|
|
1573
|
+
challenge: this._challenge
|
|
1562
1574
|
};
|
|
1563
1575
|
},
|
|
1564
|
-
authenticate: async ({ authCode: code }) => {
|
|
1576
|
+
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
1565
1577
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1566
1578
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.begin({
|
|
1567
1579
|
id: traceId
|
|
1568
1580
|
}), {
|
|
1569
1581
|
F: __dxlog_file6,
|
|
1570
|
-
L:
|
|
1582
|
+
L: 131,
|
|
1571
1583
|
S: this,
|
|
1572
1584
|
C: (f, a) => f(...a)
|
|
1573
1585
|
});
|
|
@@ -1575,14 +1587,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1575
1587
|
authCode: code
|
|
1576
1588
|
}, {
|
|
1577
1589
|
F: __dxlog_file6,
|
|
1578
|
-
L:
|
|
1590
|
+
L: 132,
|
|
1579
1591
|
S: this,
|
|
1580
1592
|
C: (f, a) => f(...a)
|
|
1581
1593
|
});
|
|
1582
1594
|
let status = import_invitations2.AuthenticationResponse.Status.OK;
|
|
1583
1595
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1584
1596
|
F: __dxlog_file6,
|
|
1585
|
-
L:
|
|
1597
|
+
L: 135,
|
|
1586
1598
|
S: this,
|
|
1587
1599
|
A: [
|
|
1588
1600
|
"this.invitation",
|
|
@@ -1593,7 +1605,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1593
1605
|
case import_services4.Invitation.AuthMethod.NONE: {
|
|
1594
1606
|
(0, import_log5.log)("authentication not required", void 0, {
|
|
1595
1607
|
F: __dxlog_file6,
|
|
1596
|
-
L:
|
|
1608
|
+
L: 138,
|
|
1597
1609
|
S: this,
|
|
1598
1610
|
C: (f, a) => f(...a)
|
|
1599
1611
|
});
|
|
@@ -1613,12 +1625,25 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1613
1625
|
}
|
|
1614
1626
|
break;
|
|
1615
1627
|
}
|
|
1628
|
+
case import_services4.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
|
|
1629
|
+
if (!this.invitation.guestKeypair) {
|
|
1630
|
+
status = import_invitations2.AuthenticationResponse.Status.INTERNAL_ERROR;
|
|
1631
|
+
break;
|
|
1632
|
+
}
|
|
1633
|
+
const isSignatureValid = this._challenge && (0, import_crypto2.verify)(this._challenge, Buffer.from(signedChallenge ?? []), this.invitation.guestKeypair.publicKey.asBuffer());
|
|
1634
|
+
if (isSignatureValid) {
|
|
1635
|
+
this.authenticationPassed = true;
|
|
1636
|
+
} else {
|
|
1637
|
+
status = import_invitations2.AuthenticationResponse.Status.INVALID_SIGNATURE;
|
|
1638
|
+
}
|
|
1639
|
+
break;
|
|
1640
|
+
}
|
|
1616
1641
|
default: {
|
|
1617
1642
|
import_log5.log.error("invalid authentication method", {
|
|
1618
1643
|
authMethod: this.invitation.authMethod
|
|
1619
1644
|
}, {
|
|
1620
1645
|
F: __dxlog_file6,
|
|
1621
|
-
L:
|
|
1646
|
+
L: 176,
|
|
1622
1647
|
S: this,
|
|
1623
1648
|
C: (f, a) => f(...a)
|
|
1624
1649
|
});
|
|
@@ -1633,7 +1658,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1633
1658
|
}
|
|
1634
1659
|
}), {
|
|
1635
1660
|
F: __dxlog_file6,
|
|
1636
|
-
L:
|
|
1661
|
+
L: 182,
|
|
1637
1662
|
S: this,
|
|
1638
1663
|
C: (f, a) => f(...a)
|
|
1639
1664
|
});
|
|
@@ -1647,14 +1672,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1647
1672
|
id: traceId
|
|
1648
1673
|
}), {
|
|
1649
1674
|
F: __dxlog_file6,
|
|
1650
|
-
L:
|
|
1675
|
+
L: 188,
|
|
1651
1676
|
S: this,
|
|
1652
1677
|
C: (f, a) => f(...a)
|
|
1653
1678
|
});
|
|
1654
1679
|
try {
|
|
1655
1680
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1656
1681
|
F: __dxlog_file6,
|
|
1657
|
-
L:
|
|
1682
|
+
L: 191,
|
|
1658
1683
|
S: this,
|
|
1659
1684
|
A: [
|
|
1660
1685
|
"this.invitation",
|
|
@@ -1669,7 +1694,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1669
1694
|
id: traceId
|
|
1670
1695
|
}), {
|
|
1671
1696
|
F: __dxlog_file6,
|
|
1672
|
-
L:
|
|
1697
|
+
L: 199,
|
|
1673
1698
|
S: this,
|
|
1674
1699
|
C: (f, a) => f(...a)
|
|
1675
1700
|
});
|
|
@@ -1726,7 +1751,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1726
1751
|
options: async (options) => {
|
|
1727
1752
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1728
1753
|
F: __dxlog_file6,
|
|
1729
|
-
L:
|
|
1754
|
+
L: 266,
|
|
1730
1755
|
S: this,
|
|
1731
1756
|
A: [
|
|
1732
1757
|
"!this._remoteOptions",
|
|
@@ -1753,7 +1778,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1753
1778
|
try {
|
|
1754
1779
|
(0, import_log5.log)("begin options", void 0, {
|
|
1755
1780
|
F: __dxlog_file6,
|
|
1756
|
-
L:
|
|
1781
|
+
L: 287,
|
|
1757
1782
|
S: this,
|
|
1758
1783
|
C: (f, a) => f(...a)
|
|
1759
1784
|
});
|
|
@@ -1765,7 +1790,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1765
1790
|
}));
|
|
1766
1791
|
(0, import_log5.log)("end options", void 0, {
|
|
1767
1792
|
F: __dxlog_file6,
|
|
1768
|
-
L:
|
|
1793
|
+
L: 290,
|
|
1769
1794
|
S: this,
|
|
1770
1795
|
C: (f, a) => f(...a)
|
|
1771
1796
|
});
|
|
@@ -1779,7 +1804,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1779
1804
|
} catch (err) {
|
|
1780
1805
|
(0, import_log5.log)("openError", err, {
|
|
1781
1806
|
F: __dxlog_file6,
|
|
1782
|
-
L:
|
|
1807
|
+
L: 300,
|
|
1783
1808
|
S: this,
|
|
1784
1809
|
C: (f, a) => f(...a)
|
|
1785
1810
|
});
|
|
@@ -1789,7 +1814,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1789
1814
|
async onClose() {
|
|
1790
1815
|
(0, import_log5.log)("onClose", void 0, {
|
|
1791
1816
|
F: __dxlog_file6,
|
|
1792
|
-
L:
|
|
1817
|
+
L: 306,
|
|
1793
1818
|
S: this,
|
|
1794
1819
|
C: (f, a) => f(...a)
|
|
1795
1820
|
});
|
|
@@ -1805,50 +1830,7 @@ var InvitationsHandler = class {
|
|
|
1805
1830
|
constructor(_networkManager) {
|
|
1806
1831
|
this._networkManager = _networkManager;
|
|
1807
1832
|
}
|
|
1808
|
-
|
|
1809
|
-
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random(), persistent = true, created = /* @__PURE__ */ new Date(), lifetime = 86400, multiUse = false } = options ?? {};
|
|
1810
|
-
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1811
|
-
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
1812
|
-
F: __dxlog_file7,
|
|
1813
|
-
L: 85,
|
|
1814
|
-
S: this,
|
|
1815
|
-
A: [
|
|
1816
|
-
"protocol",
|
|
1817
|
-
""
|
|
1818
|
-
]
|
|
1819
|
-
});
|
|
1820
|
-
const invitation = {
|
|
1821
|
-
invitationId,
|
|
1822
|
-
type,
|
|
1823
|
-
authMethod,
|
|
1824
|
-
state,
|
|
1825
|
-
swarmKey,
|
|
1826
|
-
authCode,
|
|
1827
|
-
timeout,
|
|
1828
|
-
persistent: persistent && type !== import_services3.Invitation.Type.OFFLINE,
|
|
1829
|
-
created,
|
|
1830
|
-
lifetime,
|
|
1831
|
-
multiUse,
|
|
1832
|
-
...protocol.getInvitationContext()
|
|
1833
|
-
};
|
|
1834
|
-
const stream = new import_async7.PushStream();
|
|
1835
|
-
const ctx = new import_context4.Context({
|
|
1836
|
-
onError: (err) => {
|
|
1837
|
-
stream.error(err);
|
|
1838
|
-
void ctx.dispose();
|
|
1839
|
-
}
|
|
1840
|
-
});
|
|
1841
|
-
ctx.onDispose(() => {
|
|
1842
|
-
(0, import_log4.log)("complete", {
|
|
1843
|
-
...protocol.toJSON()
|
|
1844
|
-
}, {
|
|
1845
|
-
F: __dxlog_file7,
|
|
1846
|
-
L: 111,
|
|
1847
|
-
S: this,
|
|
1848
|
-
C: (f, a) => f(...a)
|
|
1849
|
-
});
|
|
1850
|
-
stream.complete();
|
|
1851
|
-
});
|
|
1833
|
+
handleInvitationFlow(ctx, stream, protocol, invitation) {
|
|
1852
1834
|
const createExtension = () => {
|
|
1853
1835
|
const extension = new InvitationHostExtension({
|
|
1854
1836
|
onStateUpdate: (invitation2) => {
|
|
@@ -1857,8 +1839,8 @@ var InvitationsHandler = class {
|
|
|
1857
1839
|
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1858
1840
|
});
|
|
1859
1841
|
},
|
|
1860
|
-
resolveInvitation: async ({ invitationId
|
|
1861
|
-
if (
|
|
1842
|
+
resolveInvitation: async ({ invitationId }) => {
|
|
1843
|
+
if (invitationId && invitationId !== invitation.invitationId) {
|
|
1862
1844
|
return void 0;
|
|
1863
1845
|
}
|
|
1864
1846
|
return invitation;
|
|
@@ -1868,14 +1850,14 @@ var InvitationsHandler = class {
|
|
|
1868
1850
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
1869
1851
|
(0, import_invariant5.invariant)(deviceKey, void 0, {
|
|
1870
1852
|
F: __dxlog_file7,
|
|
1871
|
-
L:
|
|
1853
|
+
L: 87,
|
|
1872
1854
|
S: this,
|
|
1873
1855
|
A: [
|
|
1874
1856
|
"deviceKey",
|
|
1875
1857
|
""
|
|
1876
1858
|
]
|
|
1877
1859
|
});
|
|
1878
|
-
const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
|
|
1860
|
+
const admissionResponse = await protocol.admit(invitation, admissionRequest, extension.guestProfile);
|
|
1879
1861
|
extension.completedTrigger.wake(deviceKey);
|
|
1880
1862
|
return admissionResponse;
|
|
1881
1863
|
} catch (err) {
|
|
@@ -1891,7 +1873,7 @@ var InvitationsHandler = class {
|
|
|
1891
1873
|
id: traceId
|
|
1892
1874
|
}), {
|
|
1893
1875
|
F: __dxlog_file7,
|
|
1894
|
-
L:
|
|
1876
|
+
L: 105,
|
|
1895
1877
|
S: this,
|
|
1896
1878
|
C: (f, a) => f(...a)
|
|
1897
1879
|
});
|
|
@@ -1899,7 +1881,7 @@ var InvitationsHandler = class {
|
|
|
1899
1881
|
...protocol.toJSON()
|
|
1900
1882
|
}, {
|
|
1901
1883
|
F: __dxlog_file7,
|
|
1902
|
-
L:
|
|
1884
|
+
L: 106,
|
|
1903
1885
|
S: this,
|
|
1904
1886
|
C: (f, a) => f(...a)
|
|
1905
1887
|
});
|
|
@@ -1908,14 +1890,14 @@ var InvitationsHandler = class {
|
|
|
1908
1890
|
state: import_services3.Invitation.State.CONNECTED
|
|
1909
1891
|
});
|
|
1910
1892
|
const deviceKey = await extension.completedTrigger.wait({
|
|
1911
|
-
timeout
|
|
1893
|
+
timeout: invitation.timeout
|
|
1912
1894
|
});
|
|
1913
1895
|
(0, import_log4.log)("admitted guest", {
|
|
1914
1896
|
guest: deviceKey,
|
|
1915
1897
|
...protocol.toJSON()
|
|
1916
1898
|
}, {
|
|
1917
1899
|
F: __dxlog_file7,
|
|
1918
|
-
L:
|
|
1900
|
+
L: 109,
|
|
1919
1901
|
S: this,
|
|
1920
1902
|
C: (f, a) => f(...a)
|
|
1921
1903
|
});
|
|
@@ -1927,7 +1909,7 @@ var InvitationsHandler = class {
|
|
|
1927
1909
|
id: traceId
|
|
1928
1910
|
}), {
|
|
1929
1911
|
F: __dxlog_file7,
|
|
1930
|
-
L:
|
|
1912
|
+
L: 111,
|
|
1931
1913
|
S: this,
|
|
1932
1914
|
C: (f, a) => f(...a)
|
|
1933
1915
|
});
|
|
@@ -1937,7 +1919,7 @@ var InvitationsHandler = class {
|
|
|
1937
1919
|
...protocol.toJSON()
|
|
1938
1920
|
}, {
|
|
1939
1921
|
F: __dxlog_file7,
|
|
1940
|
-
L:
|
|
1922
|
+
L: 114,
|
|
1941
1923
|
S: this,
|
|
1942
1924
|
C: (f, a) => f(...a)
|
|
1943
1925
|
});
|
|
@@ -1948,7 +1930,7 @@ var InvitationsHandler = class {
|
|
|
1948
1930
|
} else {
|
|
1949
1931
|
import_log4.log.error("failed", err, {
|
|
1950
1932
|
F: __dxlog_file7,
|
|
1951
|
-
L:
|
|
1933
|
+
L: 117,
|
|
1952
1934
|
S: this,
|
|
1953
1935
|
C: (f, a) => f(...a)
|
|
1954
1936
|
});
|
|
@@ -1959,12 +1941,12 @@ var InvitationsHandler = class {
|
|
|
1959
1941
|
error: err
|
|
1960
1942
|
}), {
|
|
1961
1943
|
F: __dxlog_file7,
|
|
1962
|
-
L:
|
|
1944
|
+
L: 120,
|
|
1963
1945
|
S: this,
|
|
1964
1946
|
C: (f, a) => f(...a)
|
|
1965
1947
|
});
|
|
1966
1948
|
} finally {
|
|
1967
|
-
if (!multiUse) {
|
|
1949
|
+
if (!invitation.multiUse) {
|
|
1968
1950
|
await swarmConnection.close();
|
|
1969
1951
|
await ctx.dispose();
|
|
1970
1952
|
}
|
|
@@ -1980,7 +1962,7 @@ var InvitationsHandler = class {
|
|
|
1980
1962
|
...protocol.toJSON()
|
|
1981
1963
|
}, {
|
|
1982
1964
|
F: __dxlog_file7,
|
|
1983
|
-
L:
|
|
1965
|
+
L: 135,
|
|
1984
1966
|
S: this,
|
|
1985
1967
|
C: (f, a) => f(...a)
|
|
1986
1968
|
});
|
|
@@ -1991,7 +1973,7 @@ var InvitationsHandler = class {
|
|
|
1991
1973
|
} else {
|
|
1992
1974
|
import_log4.log.error("failed", err, {
|
|
1993
1975
|
F: __dxlog_file7,
|
|
1994
|
-
L:
|
|
1976
|
+
L: 138,
|
|
1995
1977
|
S: this,
|
|
1996
1978
|
C: (f, a) => f(...a)
|
|
1997
1979
|
});
|
|
@@ -2001,11 +1983,11 @@ var InvitationsHandler = class {
|
|
|
2001
1983
|
});
|
|
2002
1984
|
return extension;
|
|
2003
1985
|
};
|
|
2004
|
-
if (invitation.lifetime && invitation.created
|
|
1986
|
+
if (invitation.lifetime && invitation.created) {
|
|
2005
1987
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2006
1988
|
import_log4.log.warn("invitation has already expired", void 0, {
|
|
2007
1989
|
F: __dxlog_file7,
|
|
2008
|
-
L:
|
|
1990
|
+
L: 149,
|
|
2009
1991
|
S: this,
|
|
2010
1992
|
C: (f, a) => f(...a)
|
|
2011
1993
|
});
|
|
@@ -2039,24 +2021,12 @@ var InvitationsHandler = class {
|
|
|
2039
2021
|
state: import_services3.Invitation.State.CONNECTING
|
|
2040
2022
|
});
|
|
2041
2023
|
});
|
|
2042
|
-
const observable = new import_client_protocol2.CancellableInvitation({
|
|
2043
|
-
initialInvitation: invitation,
|
|
2044
|
-
subscriber: stream.observable,
|
|
2045
|
-
onCancel: async () => {
|
|
2046
|
-
stream.next({
|
|
2047
|
-
...invitation,
|
|
2048
|
-
state: import_services3.Invitation.State.CANCELLED
|
|
2049
|
-
});
|
|
2050
|
-
await ctx.dispose();
|
|
2051
|
-
}
|
|
2052
|
-
});
|
|
2053
|
-
return observable;
|
|
2054
2024
|
}
|
|
2055
2025
|
acceptInvitation(protocol, invitation, deviceProfile) {
|
|
2056
2026
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2057
2027
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
2058
2028
|
F: __dxlog_file7,
|
|
2059
|
-
L:
|
|
2029
|
+
L: 191,
|
|
2060
2030
|
S: this,
|
|
2061
2031
|
A: [
|
|
2062
2032
|
"protocol",
|
|
@@ -2066,7 +2036,7 @@ var InvitationsHandler = class {
|
|
|
2066
2036
|
if (deviceProfile) {
|
|
2067
2037
|
(0, import_invariant5.invariant)(invitation.kind === import_services3.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2068
2038
|
F: __dxlog_file7,
|
|
2069
|
-
L:
|
|
2039
|
+
L: 194,
|
|
2070
2040
|
S: this,
|
|
2071
2041
|
A: [
|
|
2072
2042
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -2081,7 +2051,7 @@ var InvitationsHandler = class {
|
|
|
2081
2051
|
const setState = (newData) => {
|
|
2082
2052
|
(0, import_invariant5.invariant)(newData.state !== void 0, void 0, {
|
|
2083
2053
|
F: __dxlog_file7,
|
|
2084
|
-
L:
|
|
2054
|
+
L: 205,
|
|
2085
2055
|
S: this,
|
|
2086
2056
|
A: [
|
|
2087
2057
|
"newData.state !== undefined",
|
|
@@ -2101,7 +2071,7 @@ var InvitationsHandler = class {
|
|
|
2101
2071
|
...protocol.toJSON()
|
|
2102
2072
|
}, {
|
|
2103
2073
|
F: __dxlog_file7,
|
|
2104
|
-
L:
|
|
2074
|
+
L: 213,
|
|
2105
2075
|
S: this,
|
|
2106
2076
|
C: (f, a) => f(...a)
|
|
2107
2077
|
});
|
|
@@ -2111,7 +2081,7 @@ var InvitationsHandler = class {
|
|
|
2111
2081
|
} else {
|
|
2112
2082
|
import_log4.log.warn("auth failed", err, {
|
|
2113
2083
|
F: __dxlog_file7,
|
|
2114
|
-
L:
|
|
2084
|
+
L: 216,
|
|
2115
2085
|
S: this,
|
|
2116
2086
|
C: (f, a) => f(...a)
|
|
2117
2087
|
});
|
|
@@ -2125,7 +2095,7 @@ var InvitationsHandler = class {
|
|
|
2125
2095
|
...protocol.toJSON()
|
|
2126
2096
|
}, {
|
|
2127
2097
|
F: __dxlog_file7,
|
|
2128
|
-
L:
|
|
2098
|
+
L: 224,
|
|
2129
2099
|
S: this,
|
|
2130
2100
|
C: (f, a) => f(...a)
|
|
2131
2101
|
});
|
|
@@ -2140,7 +2110,7 @@ var InvitationsHandler = class {
|
|
|
2140
2110
|
currentState
|
|
2141
2111
|
}, {
|
|
2142
2112
|
F: __dxlog_file7,
|
|
2143
|
-
L:
|
|
2113
|
+
L: 234,
|
|
2144
2114
|
S: this,
|
|
2145
2115
|
C: (f, a) => f(...a)
|
|
2146
2116
|
});
|
|
@@ -2155,7 +2125,7 @@ var InvitationsHandler = class {
|
|
|
2155
2125
|
id: traceId
|
|
2156
2126
|
}), {
|
|
2157
2127
|
F: __dxlog_file7,
|
|
2158
|
-
L:
|
|
2128
|
+
L: 243,
|
|
2159
2129
|
S: this,
|
|
2160
2130
|
C: (f, a) => f(...a)
|
|
2161
2131
|
});
|
|
@@ -2167,7 +2137,7 @@ var InvitationsHandler = class {
|
|
|
2167
2137
|
...protocol.toJSON()
|
|
2168
2138
|
}, {
|
|
2169
2139
|
F: __dxlog_file7,
|
|
2170
|
-
L:
|
|
2140
|
+
L: 251,
|
|
2171
2141
|
S: this,
|
|
2172
2142
|
C: (f, a) => f(...a)
|
|
2173
2143
|
});
|
|
@@ -2178,7 +2148,7 @@ var InvitationsHandler = class {
|
|
|
2178
2148
|
...protocol.toJSON()
|
|
2179
2149
|
}, {
|
|
2180
2150
|
F: __dxlog_file7,
|
|
2181
|
-
L:
|
|
2151
|
+
L: 255,
|
|
2182
2152
|
S: this,
|
|
2183
2153
|
C: (f, a) => f(...a)
|
|
2184
2154
|
});
|
|
@@ -2188,62 +2158,28 @@ var InvitationsHandler = class {
|
|
|
2188
2158
|
response: introductionResponse
|
|
2189
2159
|
}, {
|
|
2190
2160
|
F: __dxlog_file7,
|
|
2191
|
-
L:
|
|
2161
|
+
L: 259,
|
|
2192
2162
|
S: this,
|
|
2193
2163
|
C: (f, a) => f(...a)
|
|
2194
2164
|
});
|
|
2195
2165
|
invitation.authMethod = introductionResponse.authMethod;
|
|
2196
2166
|
if (isAuthenticationRequired(invitation)) {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2206
|
-
});
|
|
2207
|
-
const authCode = await authenticated.wait({
|
|
2208
|
-
timeout
|
|
2209
|
-
});
|
|
2210
|
-
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2211
|
-
F: __dxlog_file7,
|
|
2212
|
-
L: 327,
|
|
2213
|
-
S: this,
|
|
2214
|
-
C: (f, a) => f(...a)
|
|
2215
|
-
});
|
|
2216
|
-
setState({
|
|
2217
|
-
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2218
|
-
});
|
|
2219
|
-
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2220
|
-
authCode
|
|
2221
|
-
});
|
|
2222
|
-
if (response.status === void 0 || response.status === import_invitations.AuthenticationResponse.Status.OK) {
|
|
2167
|
+
switch (invitation.authMethod) {
|
|
2168
|
+
case import_services3.Invitation.AuthMethod.SHARED_SECRET:
|
|
2169
|
+
await this._handleGuestOtpAuth(extension, setState, authenticated, {
|
|
2170
|
+
timeout
|
|
2171
|
+
});
|
|
2172
|
+
break;
|
|
2173
|
+
case import_services3.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
|
|
2174
|
+
await this._handleGuestKpkAuth(extension, setState, invitation, introductionResponse);
|
|
2223
2175
|
break;
|
|
2224
|
-
}
|
|
2225
|
-
if (response.status === import_invitations.AuthenticationResponse.Status.INVALID_OTP) {
|
|
2226
|
-
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2227
|
-
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2228
|
-
} else {
|
|
2229
|
-
(0, import_log4.log)("retrying invalid code", {
|
|
2230
|
-
attempt
|
|
2231
|
-
}, {
|
|
2232
|
-
F: __dxlog_file7,
|
|
2233
|
-
L: 338,
|
|
2234
|
-
S: this,
|
|
2235
|
-
C: (f, a) => f(...a)
|
|
2236
|
-
});
|
|
2237
|
-
authenticated.reset();
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
2176
|
}
|
|
2241
2177
|
}
|
|
2242
2178
|
(0, import_log4.log)("request admission", {
|
|
2243
2179
|
...protocol.toJSON()
|
|
2244
2180
|
}, {
|
|
2245
2181
|
F: __dxlog_file7,
|
|
2246
|
-
L:
|
|
2182
|
+
L: 275,
|
|
2247
2183
|
S: this,
|
|
2248
2184
|
C: (f, a) => f(...a)
|
|
2249
2185
|
});
|
|
@@ -2255,7 +2191,7 @@ var InvitationsHandler = class {
|
|
|
2255
2191
|
...protocol.toJSON()
|
|
2256
2192
|
}, {
|
|
2257
2193
|
F: __dxlog_file7,
|
|
2258
|
-
L:
|
|
2194
|
+
L: 286,
|
|
2259
2195
|
S: this,
|
|
2260
2196
|
C: (f, a) => f(...a)
|
|
2261
2197
|
});
|
|
@@ -2268,7 +2204,7 @@ var InvitationsHandler = class {
|
|
|
2268
2204
|
id: traceId
|
|
2269
2205
|
}), {
|
|
2270
2206
|
F: __dxlog_file7,
|
|
2271
|
-
L:
|
|
2207
|
+
L: 288,
|
|
2272
2208
|
S: this,
|
|
2273
2209
|
C: (f, a) => f(...a)
|
|
2274
2210
|
});
|
|
@@ -2278,7 +2214,7 @@ var InvitationsHandler = class {
|
|
|
2278
2214
|
...protocol.toJSON()
|
|
2279
2215
|
}, {
|
|
2280
2216
|
F: __dxlog_file7,
|
|
2281
|
-
L:
|
|
2217
|
+
L: 291,
|
|
2282
2218
|
S: this,
|
|
2283
2219
|
C: (f, a) => f(...a)
|
|
2284
2220
|
});
|
|
@@ -2288,7 +2224,7 @@ var InvitationsHandler = class {
|
|
|
2288
2224
|
} else {
|
|
2289
2225
|
(0, import_log4.log)("auth failed", err, {
|
|
2290
2226
|
F: __dxlog_file7,
|
|
2291
|
-
L:
|
|
2227
|
+
L: 294,
|
|
2292
2228
|
S: this,
|
|
2293
2229
|
C: (f, a) => f(...a)
|
|
2294
2230
|
});
|
|
@@ -2299,7 +2235,7 @@ var InvitationsHandler = class {
|
|
|
2299
2235
|
error: err
|
|
2300
2236
|
}), {
|
|
2301
2237
|
F: __dxlog_file7,
|
|
2302
|
-
L:
|
|
2238
|
+
L: 297,
|
|
2303
2239
|
S: this,
|
|
2304
2240
|
C: (f, a) => f(...a)
|
|
2305
2241
|
});
|
|
@@ -2317,7 +2253,7 @@ var InvitationsHandler = class {
|
|
|
2317
2253
|
...protocol.toJSON()
|
|
2318
2254
|
}, {
|
|
2319
2255
|
F: __dxlog_file7,
|
|
2320
|
-
L:
|
|
2256
|
+
L: 308,
|
|
2321
2257
|
S: this,
|
|
2322
2258
|
C: (f, a) => f(...a)
|
|
2323
2259
|
});
|
|
@@ -2327,7 +2263,7 @@ var InvitationsHandler = class {
|
|
|
2327
2263
|
} else {
|
|
2328
2264
|
(0, import_log4.log)("auth failed", err, {
|
|
2329
2265
|
F: __dxlog_file7,
|
|
2330
|
-
L:
|
|
2266
|
+
L: 311,
|
|
2331
2267
|
S: this,
|
|
2332
2268
|
C: (f, a) => f(...a)
|
|
2333
2269
|
});
|
|
@@ -2344,7 +2280,7 @@ var InvitationsHandler = class {
|
|
|
2344
2280
|
} else {
|
|
2345
2281
|
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2346
2282
|
F: __dxlog_file7,
|
|
2347
|
-
L:
|
|
2283
|
+
L: 325,
|
|
2348
2284
|
S: this,
|
|
2349
2285
|
A: [
|
|
2350
2286
|
"invitation.swarmKey",
|
|
@@ -2382,195 +2318,110 @@ var InvitationsHandler = class {
|
|
|
2382
2318
|
});
|
|
2383
2319
|
return observable;
|
|
2384
2320
|
}
|
|
2321
|
+
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2322
|
+
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2323
|
+
(0, import_log4.log)("guest waiting for authentication code...", void 0, {
|
|
2324
|
+
F: __dxlog_file7,
|
|
2325
|
+
L: 365,
|
|
2326
|
+
S: this,
|
|
2327
|
+
C: (f, a) => f(...a)
|
|
2328
|
+
});
|
|
2329
|
+
setState({
|
|
2330
|
+
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2331
|
+
});
|
|
2332
|
+
const authCode = await authenticated.wait(options);
|
|
2333
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2334
|
+
F: __dxlog_file7,
|
|
2335
|
+
L: 369,
|
|
2336
|
+
S: this,
|
|
2337
|
+
C: (f, a) => f(...a)
|
|
2338
|
+
});
|
|
2339
|
+
setState({
|
|
2340
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2341
|
+
});
|
|
2342
|
+
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2343
|
+
authCode
|
|
2344
|
+
});
|
|
2345
|
+
if (response.status === void 0 || response.status === import_invitations.AuthenticationResponse.Status.OK) {
|
|
2346
|
+
break;
|
|
2347
|
+
}
|
|
2348
|
+
if (response.status === import_invitations.AuthenticationResponse.Status.INVALID_OTP) {
|
|
2349
|
+
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2350
|
+
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2351
|
+
} else {
|
|
2352
|
+
(0, import_log4.log)("retrying invalid code", {
|
|
2353
|
+
attempt
|
|
2354
|
+
}, {
|
|
2355
|
+
F: __dxlog_file7,
|
|
2356
|
+
L: 380,
|
|
2357
|
+
S: this,
|
|
2358
|
+
C: (f, a) => f(...a)
|
|
2359
|
+
});
|
|
2360
|
+
authenticated.reset();
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
async _handleGuestKpkAuth(extension, setState, invitation, introductionResponse) {
|
|
2366
|
+
if (invitation.guestKeypair?.privateKey == null) {
|
|
2367
|
+
throw new Error("keypair missing in the invitation");
|
|
2368
|
+
}
|
|
2369
|
+
if (introductionResponse.challenge == null) {
|
|
2370
|
+
throw new Error("challenge missing in the introduction");
|
|
2371
|
+
}
|
|
2372
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2373
|
+
F: __dxlog_file7,
|
|
2374
|
+
L: 399,
|
|
2375
|
+
S: this,
|
|
2376
|
+
C: (f, a) => f(...a)
|
|
2377
|
+
});
|
|
2378
|
+
setState({
|
|
2379
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2380
|
+
});
|
|
2381
|
+
const signature = (0, import_crypto.sign)(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
|
|
2382
|
+
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2383
|
+
signedChallenge: signature
|
|
2384
|
+
});
|
|
2385
|
+
if (response.status !== import_invitations.AuthenticationResponse.Status.OK) {
|
|
2386
|
+
throw new Error(`Authentication failed with code: ${response.status}`);
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
};
|
|
2390
|
+
var createAdmissionKeypair = () => {
|
|
2391
|
+
const keypair = (0, import_crypto.createKeyPair)();
|
|
2392
|
+
return {
|
|
2393
|
+
publicKey: import_keys5.PublicKey.from(keypair.publicKey),
|
|
2394
|
+
privateKey: keypair.secretKey
|
|
2395
|
+
};
|
|
2385
2396
|
};
|
|
2386
|
-
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
2387
2397
|
var InvitationsServiceImpl = class {
|
|
2388
|
-
constructor(
|
|
2389
|
-
this.
|
|
2390
|
-
this._getHandler = _getHandler;
|
|
2391
|
-
this._metadataStore = _metadataStore;
|
|
2392
|
-
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2393
|
-
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2394
|
-
this._invitationCreated = new import_async9.Event();
|
|
2395
|
-
this._invitationAccepted = new import_async9.Event();
|
|
2396
|
-
this._removedCreated = new import_async9.Event();
|
|
2397
|
-
this._removedAccepted = new import_async9.Event();
|
|
2398
|
-
this._saved = new import_async9.Event();
|
|
2399
|
-
this._persistentInvitationsLoadedEvent = new import_async9.Event();
|
|
2400
|
-
this._persistentInvitationsLoaded = false;
|
|
2398
|
+
constructor(_invitationsManager) {
|
|
2399
|
+
this._invitationsManager = _invitationsManager;
|
|
2401
2400
|
}
|
|
2402
2401
|
// TODO(burdon): Guest/host label.
|
|
2403
2402
|
getLoggingContext() {
|
|
2404
2403
|
return {};
|
|
2405
2404
|
}
|
|
2406
2405
|
createInvitation(options) {
|
|
2407
|
-
let invitation;
|
|
2408
|
-
const savePersistentInvitationCtx = new import_context6.Context();
|
|
2409
|
-
const existingInvitation = this._createInvitations.get(options.invitationId);
|
|
2410
|
-
if (existingInvitation) {
|
|
2411
|
-
invitation = existingInvitation;
|
|
2412
|
-
} else {
|
|
2413
|
-
const handler = this._getHandler(options);
|
|
2414
|
-
invitation = this._invitationsHandler.createInvitation(handler, options);
|
|
2415
|
-
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
2416
|
-
this._invitationCreated.emit(invitation.get());
|
|
2417
|
-
}
|
|
2418
2406
|
return new import_codec_protobuf8.Stream(({ next, close }) => {
|
|
2419
|
-
|
|
2420
|
-
(0, import_async9.scheduleTask)(savePersistentInvitationCtx, async () => {
|
|
2421
|
-
try {
|
|
2422
|
-
await this._metadataStore.addInvitation(invitation.get());
|
|
2423
|
-
this._saved.emit(invitation.get());
|
|
2424
|
-
} catch (err) {
|
|
2425
|
-
close(err);
|
|
2426
|
-
}
|
|
2427
|
-
});
|
|
2428
|
-
}
|
|
2429
|
-
invitation.subscribe((invitation2) => {
|
|
2430
|
-
next(invitation2);
|
|
2431
|
-
}, async (err) => {
|
|
2432
|
-
await savePersistentInvitationCtx.dispose();
|
|
2433
|
-
close(err);
|
|
2434
|
-
}, async () => {
|
|
2435
|
-
close();
|
|
2436
|
-
if (invitation.get().persistent) {
|
|
2437
|
-
await savePersistentInvitationCtx.dispose();
|
|
2438
|
-
await this._metadataStore.removeInvitation(invitation.get().invitationId);
|
|
2439
|
-
}
|
|
2440
|
-
this._createInvitations.delete(invitation.get().invitationId);
|
|
2441
|
-
if (!invitation.get().multiUse) {
|
|
2442
|
-
this._removedCreated.emit(invitation.get());
|
|
2443
|
-
}
|
|
2444
|
-
});
|
|
2407
|
+
void this._invitationsManager.createInvitation(options).then((invitation) => invitation.subscribe(next, close, close)).catch(close);
|
|
2445
2408
|
});
|
|
2446
2409
|
}
|
|
2447
|
-
|
|
2448
|
-
const
|
|
2449
|
-
const freshInvitations = persistentInvitations.filter(async (invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
2450
|
-
const cInvitations = freshInvitations.map((persistentInvitation) => {
|
|
2451
|
-
(0, import_invariant7.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2452
|
-
F: __dxlog_file8,
|
|
2453
|
-
L: 109,
|
|
2454
|
-
S: this,
|
|
2455
|
-
A: [
|
|
2456
|
-
"!this._createInvitations.get(persistentInvitation.invitationId)",
|
|
2457
|
-
"'invitation already exists'"
|
|
2458
|
-
]
|
|
2459
|
-
});
|
|
2460
|
-
const handler = this._getHandler(persistentInvitation);
|
|
2461
|
-
const invitation = this._invitationsHandler.createInvitation(handler, persistentInvitation);
|
|
2462
|
-
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
2463
|
-
this._invitationCreated.emit(invitation.get());
|
|
2464
|
-
return persistentInvitation;
|
|
2465
|
-
});
|
|
2466
|
-
this._persistentInvitationsLoadedEvent.emit();
|
|
2467
|
-
this._persistentInvitationsLoaded = true;
|
|
2468
|
-
return {
|
|
2469
|
-
invitations: cInvitations
|
|
2470
|
-
};
|
|
2471
|
-
}
|
|
2472
|
-
acceptInvitation({ invitation: options, deviceProfile }) {
|
|
2473
|
-
let invitation;
|
|
2474
|
-
if (deviceProfile) {
|
|
2475
|
-
(0, import_invariant7.invariant)(options.kind === import_services5.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2476
|
-
F: __dxlog_file8,
|
|
2477
|
-
L: 127,
|
|
2478
|
-
S: this,
|
|
2479
|
-
A: [
|
|
2480
|
-
"options.kind === Invitation.Kind.DEVICE",
|
|
2481
|
-
"'deviceProfile provided for non-device invitation'"
|
|
2482
|
-
]
|
|
2483
|
-
});
|
|
2484
|
-
}
|
|
2485
|
-
const existingInvitation = this._acceptInvitations.get(options.invitationId);
|
|
2486
|
-
if (existingInvitation) {
|
|
2487
|
-
invitation = existingInvitation;
|
|
2488
|
-
} else {
|
|
2489
|
-
const handler = this._getHandler(options);
|
|
2490
|
-
invitation = this._invitationsHandler.acceptInvitation(handler, options, deviceProfile);
|
|
2491
|
-
this._acceptInvitations.set(invitation.get().invitationId, invitation);
|
|
2492
|
-
this._invitationAccepted.emit(invitation.get());
|
|
2493
|
-
}
|
|
2410
|
+
acceptInvitation(request) {
|
|
2411
|
+
const invitation = this._invitationsManager.acceptInvitation(request);
|
|
2494
2412
|
return new import_codec_protobuf8.Stream(({ next, close }) => {
|
|
2495
|
-
invitation.subscribe(
|
|
2496
|
-
next(invitation2);
|
|
2497
|
-
}, (err) => {
|
|
2498
|
-
close(err);
|
|
2499
|
-
}, () => {
|
|
2500
|
-
close();
|
|
2501
|
-
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2502
|
-
if (!invitation.get().multiUse) {
|
|
2503
|
-
this._removedAccepted.emit(invitation.get());
|
|
2504
|
-
}
|
|
2505
|
-
});
|
|
2413
|
+
invitation.subscribe(next, close, close);
|
|
2506
2414
|
});
|
|
2507
2415
|
}
|
|
2508
|
-
async authenticate(
|
|
2509
|
-
|
|
2510
|
-
F: __dxlog_file8,
|
|
2511
|
-
L: 160,
|
|
2512
|
-
S: this,
|
|
2513
|
-
C: (f, a) => f(...a)
|
|
2514
|
-
});
|
|
2515
|
-
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2516
|
-
F: __dxlog_file8,
|
|
2517
|
-
L: 161,
|
|
2518
|
-
S: this,
|
|
2519
|
-
A: [
|
|
2520
|
-
"invitationId",
|
|
2521
|
-
""
|
|
2522
|
-
]
|
|
2523
|
-
});
|
|
2524
|
-
const observable = this._acceptInvitations.get(invitationId);
|
|
2525
|
-
if (!observable) {
|
|
2526
|
-
import_log6.log.warn("invalid invitation", {
|
|
2527
|
-
invitationId
|
|
2528
|
-
}, {
|
|
2529
|
-
F: __dxlog_file8,
|
|
2530
|
-
L: 164,
|
|
2531
|
-
S: this,
|
|
2532
|
-
C: (f, a) => f(...a)
|
|
2533
|
-
});
|
|
2534
|
-
} else {
|
|
2535
|
-
await observable.authenticate(authCode);
|
|
2536
|
-
}
|
|
2416
|
+
async authenticate(request) {
|
|
2417
|
+
return this._invitationsManager.authenticate(request);
|
|
2537
2418
|
}
|
|
2538
|
-
async cancelInvitation(
|
|
2539
|
-
|
|
2540
|
-
invitationId
|
|
2541
|
-
}, {
|
|
2542
|
-
F: __dxlog_file8,
|
|
2543
|
-
L: 171,
|
|
2544
|
-
S: this,
|
|
2545
|
-
C: (f, a) => f(...a)
|
|
2546
|
-
});
|
|
2547
|
-
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2548
|
-
F: __dxlog_file8,
|
|
2549
|
-
L: 172,
|
|
2550
|
-
S: this,
|
|
2551
|
-
A: [
|
|
2552
|
-
"invitationId",
|
|
2553
|
-
""
|
|
2554
|
-
]
|
|
2555
|
-
});
|
|
2556
|
-
const created = this._createInvitations.get(invitationId);
|
|
2557
|
-
const accepted = this._acceptInvitations.get(invitationId);
|
|
2558
|
-
if (created) {
|
|
2559
|
-
await created.cancel();
|
|
2560
|
-
this._createInvitations.delete(invitationId);
|
|
2561
|
-
this._removedCreated.emit(created.get());
|
|
2562
|
-
if (created.get().persistent) {
|
|
2563
|
-
await this._metadataStore.removeInvitation(created.get().invitationId);
|
|
2564
|
-
}
|
|
2565
|
-
} else if (accepted) {
|
|
2566
|
-
await accepted.cancel();
|
|
2567
|
-
this._acceptInvitations.delete(invitationId);
|
|
2568
|
-
this._removedAccepted.emit(accepted.get());
|
|
2569
|
-
}
|
|
2419
|
+
async cancelInvitation(request) {
|
|
2420
|
+
return this._invitationsManager.cancelInvitation(request);
|
|
2570
2421
|
}
|
|
2571
2422
|
queryInvitations() {
|
|
2572
2423
|
return new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
2573
|
-
this.
|
|
2424
|
+
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
2574
2425
|
next({
|
|
2575
2426
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2576
2427
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
@@ -2579,7 +2430,7 @@ var InvitationsServiceImpl = class {
|
|
|
2579
2430
|
]
|
|
2580
2431
|
});
|
|
2581
2432
|
});
|
|
2582
|
-
this.
|
|
2433
|
+
this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
|
|
2583
2434
|
next({
|
|
2584
2435
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2585
2436
|
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
@@ -2588,7 +2439,7 @@ var InvitationsServiceImpl = class {
|
|
|
2588
2439
|
]
|
|
2589
2440
|
});
|
|
2590
2441
|
});
|
|
2591
|
-
this.
|
|
2442
|
+
this._invitationsManager.removedCreated.on(ctx, (invitation) => {
|
|
2592
2443
|
next({
|
|
2593
2444
|
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2594
2445
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
@@ -2597,7 +2448,7 @@ var InvitationsServiceImpl = class {
|
|
|
2597
2448
|
]
|
|
2598
2449
|
});
|
|
2599
2450
|
});
|
|
2600
|
-
this.
|
|
2451
|
+
this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
|
|
2601
2452
|
next({
|
|
2602
2453
|
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2603
2454
|
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
@@ -2606,7 +2457,7 @@ var InvitationsServiceImpl = class {
|
|
|
2606
2457
|
]
|
|
2607
2458
|
});
|
|
2608
2459
|
});
|
|
2609
|
-
this.
|
|
2460
|
+
this._invitationsManager.saved.on(ctx, (invitation) => {
|
|
2610
2461
|
next({
|
|
2611
2462
|
action: import_services5.QueryInvitationsResponse.Action.SAVED,
|
|
2612
2463
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
@@ -2618,32 +2469,25 @@ var InvitationsServiceImpl = class {
|
|
|
2618
2469
|
next({
|
|
2619
2470
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2620
2471
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2621
|
-
invitations:
|
|
2472
|
+
invitations: this._invitationsManager.getCreatedInvitations(),
|
|
2622
2473
|
existing: true
|
|
2623
2474
|
});
|
|
2624
2475
|
next({
|
|
2625
2476
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2626
2477
|
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2627
|
-
invitations:
|
|
2478
|
+
invitations: this._invitationsManager.getAcceptedInvitations(),
|
|
2628
2479
|
existing: true
|
|
2629
2480
|
});
|
|
2630
|
-
|
|
2481
|
+
this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
|
|
2631
2482
|
next({
|
|
2632
2483
|
action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
2633
2484
|
type: import_services5.QueryInvitationsResponse.Type.CREATED
|
|
2634
2485
|
});
|
|
2635
|
-
}
|
|
2636
|
-
this._persistentInvitationsLoadedEvent.on(ctx, () => {
|
|
2637
|
-
next({
|
|
2638
|
-
action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
2639
|
-
type: import_services5.QueryInvitationsResponse.Type.CREATED
|
|
2640
|
-
});
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2486
|
+
});
|
|
2643
2487
|
});
|
|
2644
2488
|
}
|
|
2645
2489
|
};
|
|
2646
|
-
var
|
|
2490
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
2647
2491
|
var SpaceInvitationProtocol = class {
|
|
2648
2492
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
2649
2493
|
this._spaceManager = _spaceManager;
|
|
@@ -2663,10 +2507,10 @@ var SpaceInvitationProtocol = class {
|
|
|
2663
2507
|
spaceKey: this._spaceKey
|
|
2664
2508
|
};
|
|
2665
2509
|
}
|
|
2666
|
-
async admit(request, guestProfile) {
|
|
2667
|
-
(0,
|
|
2668
|
-
F:
|
|
2669
|
-
L:
|
|
2510
|
+
async admit(invitation, request, guestProfile) {
|
|
2511
|
+
(0, import_invariant7.invariant)(this._spaceKey, void 0, {
|
|
2512
|
+
F: __dxlog_file8,
|
|
2513
|
+
L: 55,
|
|
2670
2514
|
S: this,
|
|
2671
2515
|
A: [
|
|
2672
2516
|
"this._spaceKey",
|
|
@@ -2674,18 +2518,18 @@ var SpaceInvitationProtocol = class {
|
|
|
2674
2518
|
]
|
|
2675
2519
|
});
|
|
2676
2520
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2677
|
-
(0,
|
|
2678
|
-
F:
|
|
2679
|
-
L:
|
|
2521
|
+
(0, import_invariant7.invariant)(space, void 0, {
|
|
2522
|
+
F: __dxlog_file8,
|
|
2523
|
+
L: 57,
|
|
2680
2524
|
S: this,
|
|
2681
2525
|
A: [
|
|
2682
2526
|
"space",
|
|
2683
2527
|
""
|
|
2684
2528
|
]
|
|
2685
2529
|
});
|
|
2686
|
-
(0,
|
|
2687
|
-
F:
|
|
2688
|
-
L:
|
|
2530
|
+
(0, import_invariant7.invariant)(request.space, void 0, {
|
|
2531
|
+
F: __dxlog_file8,
|
|
2532
|
+
L: 59,
|
|
2689
2533
|
S: this,
|
|
2690
2534
|
A: [
|
|
2691
2535
|
"request.space",
|
|
@@ -2693,19 +2537,19 @@ var SpaceInvitationProtocol = class {
|
|
|
2693
2537
|
]
|
|
2694
2538
|
});
|
|
2695
2539
|
const { identityKey, deviceKey } = request.space;
|
|
2696
|
-
(0,
|
|
2540
|
+
(0, import_log6.log)("writing guest credentials", {
|
|
2697
2541
|
host: this._signingContext.deviceKey,
|
|
2698
2542
|
guest: deviceKey
|
|
2699
2543
|
}, {
|
|
2700
|
-
F:
|
|
2701
|
-
L:
|
|
2544
|
+
F: __dxlog_file8,
|
|
2545
|
+
L: 62,
|
|
2702
2546
|
S: this,
|
|
2703
2547
|
C: (f, a) => f(...a)
|
|
2704
2548
|
});
|
|
2705
|
-
const credentials = await (0,
|
|
2706
|
-
(0,
|
|
2707
|
-
F:
|
|
2708
|
-
L:
|
|
2549
|
+
const credentials = await (0, import_credentials7.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile, invitation.delegationCredentialId);
|
|
2550
|
+
(0, import_invariant7.invariant)(credentials[0].credential, void 0, {
|
|
2551
|
+
F: __dxlog_file8,
|
|
2552
|
+
L: 74,
|
|
2709
2553
|
S: this,
|
|
2710
2554
|
A: [
|
|
2711
2555
|
"credentials[0].credential",
|
|
@@ -2713,22 +2557,85 @@ var SpaceInvitationProtocol = class {
|
|
|
2713
2557
|
]
|
|
2714
2558
|
});
|
|
2715
2559
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2716
|
-
(0,
|
|
2717
|
-
F:
|
|
2718
|
-
L:
|
|
2560
|
+
(0, import_invariant7.invariant)((0, import_credentials7.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2561
|
+
F: __dxlog_file8,
|
|
2562
|
+
L: 76,
|
|
2719
2563
|
S: this,
|
|
2720
2564
|
A: [
|
|
2721
2565
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
2722
2566
|
""
|
|
2723
2567
|
]
|
|
2724
2568
|
});
|
|
2725
|
-
await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
|
|
2726
|
-
return {
|
|
2727
|
-
space: {
|
|
2728
|
-
credential: spaceMemberCredential,
|
|
2729
|
-
controlTimeframe: space.inner.controlPipeline.state.timeframe
|
|
2730
|
-
}
|
|
2731
|
-
};
|
|
2569
|
+
await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
|
|
2570
|
+
return {
|
|
2571
|
+
space: {
|
|
2572
|
+
credential: spaceMemberCredential,
|
|
2573
|
+
controlTimeframe: space.inner.controlPipeline.state.timeframe
|
|
2574
|
+
}
|
|
2575
|
+
};
|
|
2576
|
+
}
|
|
2577
|
+
async delegate(invitation) {
|
|
2578
|
+
(0, import_invariant7.invariant)(this._spaceKey, void 0, {
|
|
2579
|
+
F: __dxlog_file8,
|
|
2580
|
+
L: 89,
|
|
2581
|
+
S: this,
|
|
2582
|
+
A: [
|
|
2583
|
+
"this._spaceKey",
|
|
2584
|
+
""
|
|
2585
|
+
]
|
|
2586
|
+
});
|
|
2587
|
+
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2588
|
+
(0, import_invariant7.invariant)(space, void 0, {
|
|
2589
|
+
F: __dxlog_file8,
|
|
2590
|
+
L: 91,
|
|
2591
|
+
S: this,
|
|
2592
|
+
A: [
|
|
2593
|
+
"space",
|
|
2594
|
+
""
|
|
2595
|
+
]
|
|
2596
|
+
});
|
|
2597
|
+
if (invitation.authMethod === import_services6.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
2598
|
+
(0, import_invariant7.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
2599
|
+
F: __dxlog_file8,
|
|
2600
|
+
L: 93,
|
|
2601
|
+
S: this,
|
|
2602
|
+
A: [
|
|
2603
|
+
"invitation.guestKeypair?.publicKey",
|
|
2604
|
+
""
|
|
2605
|
+
]
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
(0, import_log6.log)("writing delegate space invitation", {
|
|
2609
|
+
host: this._signingContext.deviceKey,
|
|
2610
|
+
id: invitation.invitationId
|
|
2611
|
+
}, {
|
|
2612
|
+
F: __dxlog_file8,
|
|
2613
|
+
L: 96,
|
|
2614
|
+
S: this,
|
|
2615
|
+
C: (f, a) => f(...a)
|
|
2616
|
+
});
|
|
2617
|
+
const credential = await (0, import_credentials7.createDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, {
|
|
2618
|
+
invitationId: invitation.invitationId,
|
|
2619
|
+
authMethod: invitation.authMethod,
|
|
2620
|
+
swarmKey: invitation.swarmKey,
|
|
2621
|
+
role: import_credentials8.SpaceMember.Role.ADMIN,
|
|
2622
|
+
expiresOn: invitation.lifetime ? new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime) : void 0,
|
|
2623
|
+
multiUse: invitation.multiUse ?? false,
|
|
2624
|
+
guestKey: invitation.authMethod === import_services6.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
2625
|
+
});
|
|
2626
|
+
(0, import_invariant7.invariant)(credential.credential, void 0, {
|
|
2627
|
+
F: __dxlog_file8,
|
|
2628
|
+
L: 116,
|
|
2629
|
+
S: this,
|
|
2630
|
+
A: [
|
|
2631
|
+
"credential.credential",
|
|
2632
|
+
""
|
|
2633
|
+
]
|
|
2634
|
+
});
|
|
2635
|
+
await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, [
|
|
2636
|
+
credential
|
|
2637
|
+
]);
|
|
2638
|
+
return credential.credential.credential.id;
|
|
2732
2639
|
}
|
|
2733
2640
|
checkInvitation(invitation) {
|
|
2734
2641
|
if (invitation.spaceKey && this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
@@ -2753,9 +2660,9 @@ var SpaceInvitationProtocol = class {
|
|
|
2753
2660
|
};
|
|
2754
2661
|
}
|
|
2755
2662
|
async accept(response) {
|
|
2756
|
-
(0,
|
|
2757
|
-
F:
|
|
2758
|
-
L:
|
|
2663
|
+
(0, import_invariant7.invariant)(response.space, void 0, {
|
|
2664
|
+
F: __dxlog_file8,
|
|
2665
|
+
L: 149,
|
|
2759
2666
|
S: this,
|
|
2760
2667
|
A: [
|
|
2761
2668
|
"response.space",
|
|
@@ -2763,19 +2670,19 @@ var SpaceInvitationProtocol = class {
|
|
|
2763
2670
|
]
|
|
2764
2671
|
});
|
|
2765
2672
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
2766
|
-
const assertion = (0,
|
|
2767
|
-
(0,
|
|
2768
|
-
F:
|
|
2769
|
-
L:
|
|
2673
|
+
const assertion = (0, import_credentials7.getCredentialAssertion)(credential);
|
|
2674
|
+
(0, import_invariant7.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2675
|
+
F: __dxlog_file8,
|
|
2676
|
+
L: 152,
|
|
2770
2677
|
S: this,
|
|
2771
2678
|
A: [
|
|
2772
2679
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
2773
2680
|
"'Invalid credential'"
|
|
2774
2681
|
]
|
|
2775
2682
|
});
|
|
2776
|
-
(0,
|
|
2777
|
-
F:
|
|
2778
|
-
L:
|
|
2683
|
+
(0, import_invariant7.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2684
|
+
F: __dxlog_file8,
|
|
2685
|
+
L: 153,
|
|
2779
2686
|
S: this,
|
|
2780
2687
|
A: [
|
|
2781
2688
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -2797,6 +2704,284 @@ var SpaceInvitationProtocol = class {
|
|
|
2797
2704
|
};
|
|
2798
2705
|
}
|
|
2799
2706
|
};
|
|
2707
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
2708
|
+
var InvitationsManager = class {
|
|
2709
|
+
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
2710
|
+
this._invitationsHandler = _invitationsHandler;
|
|
2711
|
+
this._getHandler = _getHandler;
|
|
2712
|
+
this._metadataStore = _metadataStore;
|
|
2713
|
+
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2714
|
+
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2715
|
+
this.invitationCreated = new import_async9.Event();
|
|
2716
|
+
this.invitationAccepted = new import_async9.Event();
|
|
2717
|
+
this.removedCreated = new import_async9.Event();
|
|
2718
|
+
this.removedAccepted = new import_async9.Event();
|
|
2719
|
+
this.saved = new import_async9.Event();
|
|
2720
|
+
this._persistentInvitationsLoadedEvent = new import_async9.Event();
|
|
2721
|
+
this._persistentInvitationsLoaded = false;
|
|
2722
|
+
}
|
|
2723
|
+
async createInvitation(options) {
|
|
2724
|
+
if (options.invitationId) {
|
|
2725
|
+
const existingInvitation = this._createInvitations.get(options.invitationId);
|
|
2726
|
+
if (existingInvitation) {
|
|
2727
|
+
return existingInvitation;
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
const handler = this._getHandler(options);
|
|
2731
|
+
const invitation = this._createInvitation(handler, options);
|
|
2732
|
+
const { ctx, stream, observableInvitation } = this._createObservableInvitation(handler, invitation);
|
|
2733
|
+
this._createInvitations.set(invitation.invitationId, observableInvitation);
|
|
2734
|
+
this.invitationCreated.emit(invitation);
|
|
2735
|
+
this._onInvitationComplete(observableInvitation, async () => {
|
|
2736
|
+
this._createInvitations.delete(observableInvitation.get().invitationId);
|
|
2737
|
+
this.removedCreated.emit(observableInvitation.get());
|
|
2738
|
+
if (observableInvitation.get().persistent) {
|
|
2739
|
+
await this._safeDeleteInvitation(observableInvitation.get());
|
|
2740
|
+
}
|
|
2741
|
+
});
|
|
2742
|
+
try {
|
|
2743
|
+
await this._persistIfRequired(handler, stream, invitation);
|
|
2744
|
+
} catch (err) {
|
|
2745
|
+
import_log7.log.catch(err, void 0, {
|
|
2746
|
+
F: __dxlog_file9,
|
|
2747
|
+
L: 76,
|
|
2748
|
+
S: this,
|
|
2749
|
+
C: (f, a) => f(...a)
|
|
2750
|
+
});
|
|
2751
|
+
await observableInvitation.cancel();
|
|
2752
|
+
return observableInvitation;
|
|
2753
|
+
}
|
|
2754
|
+
this._invitationsHandler.handleInvitationFlow(ctx, stream, handler, observableInvitation.get());
|
|
2755
|
+
return observableInvitation;
|
|
2756
|
+
}
|
|
2757
|
+
async loadPersistentInvitations() {
|
|
2758
|
+
if (this._persistentInvitationsLoaded) {
|
|
2759
|
+
const invitations = this.getCreatedInvitations().filter((i) => i.persistent);
|
|
2760
|
+
return {
|
|
2761
|
+
invitations
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
try {
|
|
2765
|
+
const persistentInvitations = this._metadataStore.getInvitations();
|
|
2766
|
+
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
2767
|
+
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
2768
|
+
(0, import_invariant8.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2769
|
+
F: __dxlog_file9,
|
|
2770
|
+
L: 97,
|
|
2771
|
+
S: this,
|
|
2772
|
+
A: [
|
|
2773
|
+
"!this._createInvitations.get(persistentInvitation.invitationId)",
|
|
2774
|
+
"'invitation already exists'"
|
|
2775
|
+
]
|
|
2776
|
+
});
|
|
2777
|
+
return this.createInvitation({
|
|
2778
|
+
...persistentInvitation,
|
|
2779
|
+
persistent: false
|
|
2780
|
+
});
|
|
2781
|
+
});
|
|
2782
|
+
const cInvitations = await Promise.all(loadTasks);
|
|
2783
|
+
return {
|
|
2784
|
+
invitations: cInvitations.map((invitation) => invitation.get())
|
|
2785
|
+
};
|
|
2786
|
+
} catch (err) {
|
|
2787
|
+
import_log7.log.catch(err, void 0, {
|
|
2788
|
+
F: __dxlog_file9,
|
|
2789
|
+
L: 104,
|
|
2790
|
+
S: this,
|
|
2791
|
+
C: (f, a) => f(...a)
|
|
2792
|
+
});
|
|
2793
|
+
return {
|
|
2794
|
+
invitations: []
|
|
2795
|
+
};
|
|
2796
|
+
} finally {
|
|
2797
|
+
this._persistentInvitationsLoadedEvent.emit();
|
|
2798
|
+
this._persistentInvitationsLoaded = true;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
acceptInvitation(request) {
|
|
2802
|
+
const options = request.invitation;
|
|
2803
|
+
const existingInvitation = this._acceptInvitations.get(options.invitationId);
|
|
2804
|
+
if (existingInvitation) {
|
|
2805
|
+
return existingInvitation;
|
|
2806
|
+
}
|
|
2807
|
+
const handler = this._getHandler(options);
|
|
2808
|
+
const invitation = this._invitationsHandler.acceptInvitation(handler, options, request.deviceProfile);
|
|
2809
|
+
this._acceptInvitations.set(invitation.get().invitationId, invitation);
|
|
2810
|
+
this.invitationAccepted.emit(invitation.get());
|
|
2811
|
+
this._onInvitationComplete(invitation, () => {
|
|
2812
|
+
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2813
|
+
this.removedAccepted.emit(invitation.get());
|
|
2814
|
+
});
|
|
2815
|
+
return invitation;
|
|
2816
|
+
}
|
|
2817
|
+
async authenticate({ invitationId, authCode }) {
|
|
2818
|
+
(0, import_log7.log)("authenticating...", void 0, {
|
|
2819
|
+
F: __dxlog_file9,
|
|
2820
|
+
L: 133,
|
|
2821
|
+
S: this,
|
|
2822
|
+
C: (f, a) => f(...a)
|
|
2823
|
+
});
|
|
2824
|
+
(0, import_invariant8.invariant)(invitationId, void 0, {
|
|
2825
|
+
F: __dxlog_file9,
|
|
2826
|
+
L: 134,
|
|
2827
|
+
S: this,
|
|
2828
|
+
A: [
|
|
2829
|
+
"invitationId",
|
|
2830
|
+
""
|
|
2831
|
+
]
|
|
2832
|
+
});
|
|
2833
|
+
const observable = this._acceptInvitations.get(invitationId);
|
|
2834
|
+
if (!observable) {
|
|
2835
|
+
import_log7.log.warn("invalid invitation", {
|
|
2836
|
+
invitationId
|
|
2837
|
+
}, {
|
|
2838
|
+
F: __dxlog_file9,
|
|
2839
|
+
L: 137,
|
|
2840
|
+
S: this,
|
|
2841
|
+
C: (f, a) => f(...a)
|
|
2842
|
+
});
|
|
2843
|
+
} else {
|
|
2844
|
+
await observable.authenticate(authCode);
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
async cancelInvitation({ invitationId }) {
|
|
2848
|
+
(0, import_log7.log)("cancelInvitation...", {
|
|
2849
|
+
invitationId
|
|
2850
|
+
}, {
|
|
2851
|
+
F: __dxlog_file9,
|
|
2852
|
+
L: 144,
|
|
2853
|
+
S: this,
|
|
2854
|
+
C: (f, a) => f(...a)
|
|
2855
|
+
});
|
|
2856
|
+
(0, import_invariant8.invariant)(invitationId, void 0, {
|
|
2857
|
+
F: __dxlog_file9,
|
|
2858
|
+
L: 145,
|
|
2859
|
+
S: this,
|
|
2860
|
+
A: [
|
|
2861
|
+
"invitationId",
|
|
2862
|
+
""
|
|
2863
|
+
]
|
|
2864
|
+
});
|
|
2865
|
+
const created = this._createInvitations.get(invitationId);
|
|
2866
|
+
if (created) {
|
|
2867
|
+
if (created.get().persistent) {
|
|
2868
|
+
await this._metadataStore.removeInvitation(invitationId);
|
|
2869
|
+
}
|
|
2870
|
+
await created.cancel();
|
|
2871
|
+
this._createInvitations.delete(invitationId);
|
|
2872
|
+
this.removedCreated.emit(created.get());
|
|
2873
|
+
return;
|
|
2874
|
+
}
|
|
2875
|
+
const accepted = this._acceptInvitations.get(invitationId);
|
|
2876
|
+
if (accepted) {
|
|
2877
|
+
await accepted.cancel();
|
|
2878
|
+
this._acceptInvitations.delete(invitationId);
|
|
2879
|
+
this.removedAccepted.emit(accepted.get());
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
getCreatedInvitations() {
|
|
2883
|
+
return [
|
|
2884
|
+
...this._createInvitations.values()
|
|
2885
|
+
].map((i) => i.get());
|
|
2886
|
+
}
|
|
2887
|
+
getAcceptedInvitations() {
|
|
2888
|
+
return [
|
|
2889
|
+
...this._acceptInvitations.values()
|
|
2890
|
+
].map((i) => i.get());
|
|
2891
|
+
}
|
|
2892
|
+
onPersistentInvitationsLoaded(ctx, callback) {
|
|
2893
|
+
if (this._persistentInvitationsLoaded) {
|
|
2894
|
+
callback();
|
|
2895
|
+
} else {
|
|
2896
|
+
this._persistentInvitationsLoadedEvent.once(ctx, () => callback());
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
_createInvitation(protocol, options) {
|
|
2900
|
+
const { invitationId = import_keys7.PublicKey.random().toHex(), type = import_services7.Invitation.Type.INTERACTIVE, authMethod = import_services7.Invitation.AuthMethod.SHARED_SECRET, state = import_services7.Invitation.State.INIT, timeout = import_client_protocol3.INVITATION_TIMEOUT, swarmKey = import_keys7.PublicKey.random(), persistent = options?.authMethod !== import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, lifetime = 86400, multiUse = false } = options ?? {};
|
|
2901
|
+
const authCode = options?.authCode ?? (authMethod === import_services7.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials9.generatePasscode)(import_client_protocol3.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
2902
|
+
return {
|
|
2903
|
+
invitationId,
|
|
2904
|
+
type,
|
|
2905
|
+
authMethod,
|
|
2906
|
+
state,
|
|
2907
|
+
swarmKey,
|
|
2908
|
+
authCode,
|
|
2909
|
+
timeout,
|
|
2910
|
+
persistent: persistent && type !== import_services7.Invitation.Type.DELEGATED,
|
|
2911
|
+
guestKeypair: guestKeypair ?? (authMethod === import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
|
|
2912
|
+
created,
|
|
2913
|
+
lifetime,
|
|
2914
|
+
multiUse,
|
|
2915
|
+
delegationCredentialId: options?.delegationCredentialId,
|
|
2916
|
+
...protocol.getInvitationContext()
|
|
2917
|
+
};
|
|
2918
|
+
}
|
|
2919
|
+
_createObservableInvitation(handler, invitation) {
|
|
2920
|
+
const stream = new import_async9.PushStream();
|
|
2921
|
+
const ctx = new import_context6.Context({
|
|
2922
|
+
onError: (err) => {
|
|
2923
|
+
stream.error(err);
|
|
2924
|
+
void ctx.dispose();
|
|
2925
|
+
}
|
|
2926
|
+
});
|
|
2927
|
+
ctx.onDispose(() => {
|
|
2928
|
+
(0, import_log7.log)("complete", {
|
|
2929
|
+
...handler.toJSON()
|
|
2930
|
+
}, {
|
|
2931
|
+
F: __dxlog_file9,
|
|
2932
|
+
L: 228,
|
|
2933
|
+
S: this,
|
|
2934
|
+
C: (f, a) => f(...a)
|
|
2935
|
+
});
|
|
2936
|
+
stream.complete();
|
|
2937
|
+
});
|
|
2938
|
+
const observableInvitation = new import_client_protocol3.CancellableInvitation({
|
|
2939
|
+
initialInvitation: invitation,
|
|
2940
|
+
subscriber: stream.observable,
|
|
2941
|
+
onCancel: async () => {
|
|
2942
|
+
stream.next({
|
|
2943
|
+
...invitation,
|
|
2944
|
+
state: import_services7.Invitation.State.CANCELLED
|
|
2945
|
+
});
|
|
2946
|
+
await ctx.dispose();
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2949
|
+
return {
|
|
2950
|
+
ctx,
|
|
2951
|
+
stream,
|
|
2952
|
+
observableInvitation
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
async _persistIfRequired(handler, changeStream, invitation) {
|
|
2956
|
+
if (invitation.type === import_services7.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
|
|
2957
|
+
const delegationCredentialId = await handler.delegate(invitation);
|
|
2958
|
+
changeStream.next({
|
|
2959
|
+
...invitation,
|
|
2960
|
+
delegationCredentialId
|
|
2961
|
+
});
|
|
2962
|
+
} else if (invitation.persistent) {
|
|
2963
|
+
await this._metadataStore.addInvitation(invitation);
|
|
2964
|
+
this.saved.emit(invitation);
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
async _safeDeleteInvitation(invitation) {
|
|
2968
|
+
try {
|
|
2969
|
+
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
2970
|
+
} catch (err) {
|
|
2971
|
+
import_log7.log.catch(err, void 0, {
|
|
2972
|
+
F: __dxlog_file9,
|
|
2973
|
+
L: 260,
|
|
2974
|
+
S: this,
|
|
2975
|
+
C: (f, a) => f(...a)
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
_onInvitationComplete(invitation, callback) {
|
|
2980
|
+
invitation.subscribe(() => {
|
|
2981
|
+
}, () => {
|
|
2982
|
+
}, callback);
|
|
2983
|
+
}
|
|
2984
|
+
};
|
|
2800
2985
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
2801
2986
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2802
2987
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -2881,7 +3066,7 @@ var AutomergeSpaceState = class {
|
|
|
2881
3066
|
this._isProcessingRootDocs = false;
|
|
2882
3067
|
}
|
|
2883
3068
|
async processCredential(credential) {
|
|
2884
|
-
if (!(0,
|
|
3069
|
+
if (!(0, import_credentials11.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
2885
3070
|
return;
|
|
2886
3071
|
}
|
|
2887
3072
|
this.lastEpoch = credential;
|
|
@@ -2916,8 +3101,8 @@ var NotarizationPlugin = class {
|
|
|
2916
3101
|
this._ctx = new import_context8.Context();
|
|
2917
3102
|
this._extensionOpened = new import_async12.Event();
|
|
2918
3103
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2919
|
-
this._processedCredentials = new import_util5.ComplexSet(
|
|
2920
|
-
this._processCredentialsTriggers = new import_util5.ComplexMap(
|
|
3104
|
+
this._processedCredentials = new import_util5.ComplexSet(import_keys9.PublicKey.hash);
|
|
3105
|
+
this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys9.PublicKey.hash);
|
|
2921
3106
|
}
|
|
2922
3107
|
get hasWriter() {
|
|
2923
3108
|
return !!this._writer;
|
|
@@ -3181,7 +3366,7 @@ var DataSpace = class {
|
|
|
3181
3366
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3182
3367
|
this._cache = void 0;
|
|
3183
3368
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
3184
|
-
this._state =
|
|
3369
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
3185
3370
|
this.error = void 0;
|
|
3186
3371
|
this.stateUpdate = new import_async10.Event();
|
|
3187
3372
|
this.metrics = {};
|
|
@@ -3194,19 +3379,19 @@ var DataSpace = class {
|
|
|
3194
3379
|
this._metadataStore = params.metadataStore;
|
|
3195
3380
|
this._signingContext = params.signingContext;
|
|
3196
3381
|
this._callbacks = params.callbacks ?? {};
|
|
3197
|
-
this.
|
|
3382
|
+
this._echoHost = params.echoHost;
|
|
3198
3383
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
3199
|
-
trustedKeysProvider: () => new import_util4.ComplexSet(
|
|
3384
|
+
trustedKeysProvider: () => new import_util4.ComplexSet(import_keys8.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
|
|
3200
3385
|
update: this._inner.stateUpdate,
|
|
3201
|
-
authTimeout:
|
|
3386
|
+
authTimeout: import_client_protocol4.AUTH_TIMEOUT
|
|
3202
3387
|
});
|
|
3203
3388
|
this._cache = params.cache;
|
|
3204
3389
|
this._state = params.initialState;
|
|
3205
3390
|
(0, import_log8.log)("new state", {
|
|
3206
|
-
state:
|
|
3391
|
+
state: import_services8.SpaceState[this._state]
|
|
3207
3392
|
}, {
|
|
3208
3393
|
F: __dxlog_file11,
|
|
3209
|
-
L:
|
|
3394
|
+
L: 135,
|
|
3210
3395
|
S: this,
|
|
3211
3396
|
C: (f, a) => f(...a)
|
|
3212
3397
|
});
|
|
@@ -3251,12 +3436,12 @@ var DataSpace = class {
|
|
|
3251
3436
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3252
3437
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3253
3438
|
await this._inner.open(new import_context7.Context());
|
|
3254
|
-
this._state =
|
|
3439
|
+
this._state = import_services8.SpaceState.CONTROL_ONLY;
|
|
3255
3440
|
(0, import_log8.log)("new state", {
|
|
3256
|
-
state:
|
|
3441
|
+
state: import_services8.SpaceState[this._state]
|
|
3257
3442
|
}, {
|
|
3258
3443
|
F: __dxlog_file11,
|
|
3259
|
-
L:
|
|
3444
|
+
L: 193,
|
|
3260
3445
|
S: this,
|
|
3261
3446
|
C: (f, a) => f(...a)
|
|
3262
3447
|
});
|
|
@@ -3269,12 +3454,12 @@ var DataSpace = class {
|
|
|
3269
3454
|
}
|
|
3270
3455
|
async _close() {
|
|
3271
3456
|
await this._callbacks.beforeClose?.();
|
|
3272
|
-
this._state =
|
|
3457
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
3273
3458
|
(0, import_log8.log)("new state", {
|
|
3274
|
-
state:
|
|
3459
|
+
state: import_services8.SpaceState[this._state]
|
|
3275
3460
|
}, {
|
|
3276
3461
|
F: __dxlog_file11,
|
|
3277
|
-
L:
|
|
3462
|
+
L: 207,
|
|
3278
3463
|
S: this,
|
|
3279
3464
|
C: (f, a) => f(...a)
|
|
3280
3465
|
});
|
|
@@ -3306,7 +3491,7 @@ var DataSpace = class {
|
|
|
3306
3491
|
if (err instanceof import_protocols7.CancelledError || err instanceof import_context7.ContextDisposedError) {
|
|
3307
3492
|
(0, import_log8.log)("data pipeline initialization cancelled", err, {
|
|
3308
3493
|
F: __dxlog_file11,
|
|
3309
|
-
L:
|
|
3494
|
+
L: 240,
|
|
3310
3495
|
S: this,
|
|
3311
3496
|
C: (f, a) => f(...a)
|
|
3312
3497
|
});
|
|
@@ -3314,16 +3499,16 @@ var DataSpace = class {
|
|
|
3314
3499
|
}
|
|
3315
3500
|
import_log8.log.error("Error initializing data pipeline", err, {
|
|
3316
3501
|
F: __dxlog_file11,
|
|
3317
|
-
L:
|
|
3502
|
+
L: 244,
|
|
3318
3503
|
S: this,
|
|
3319
3504
|
C: (f, a) => f(...a)
|
|
3320
3505
|
});
|
|
3321
|
-
this._state =
|
|
3506
|
+
this._state = import_services8.SpaceState.ERROR;
|
|
3322
3507
|
(0, import_log8.log)("new state", {
|
|
3323
|
-
state:
|
|
3508
|
+
state: import_services8.SpaceState[this._state]
|
|
3324
3509
|
}, {
|
|
3325
3510
|
F: __dxlog_file11,
|
|
3326
|
-
L:
|
|
3511
|
+
L: 246,
|
|
3327
3512
|
S: this,
|
|
3328
3513
|
C: (f, a) => f(...a)
|
|
3329
3514
|
});
|
|
@@ -3335,15 +3520,15 @@ var DataSpace = class {
|
|
|
3335
3520
|
});
|
|
3336
3521
|
}
|
|
3337
3522
|
async initializeDataPipeline() {
|
|
3338
|
-
if (this._state !==
|
|
3523
|
+
if (this._state !== import_services8.SpaceState.CONTROL_ONLY) {
|
|
3339
3524
|
throw new import_protocols7.SystemError("Invalid operation");
|
|
3340
3525
|
}
|
|
3341
|
-
this._state =
|
|
3526
|
+
this._state = import_services8.SpaceState.INITIALIZING;
|
|
3342
3527
|
(0, import_log8.log)("new state", {
|
|
3343
|
-
state:
|
|
3528
|
+
state: import_services8.SpaceState[this._state]
|
|
3344
3529
|
}, {
|
|
3345
3530
|
F: __dxlog_file11,
|
|
3346
|
-
L:
|
|
3531
|
+
L: 262,
|
|
3347
3532
|
S: this,
|
|
3348
3533
|
C: (f, a) => f(...a)
|
|
3349
3534
|
});
|
|
@@ -3353,17 +3538,17 @@ var DataSpace = class {
|
|
|
3353
3538
|
await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3354
3539
|
(0, import_log8.log)("data pipeline ready", void 0, {
|
|
3355
3540
|
F: __dxlog_file11,
|
|
3356
|
-
L:
|
|
3541
|
+
L: 274,
|
|
3357
3542
|
S: this,
|
|
3358
3543
|
C: (f, a) => f(...a)
|
|
3359
3544
|
});
|
|
3360
3545
|
await this._callbacks.beforeReady?.();
|
|
3361
|
-
this._state =
|
|
3546
|
+
this._state = import_services8.SpaceState.READY;
|
|
3362
3547
|
(0, import_log8.log)("new state", {
|
|
3363
|
-
state:
|
|
3548
|
+
state: import_services8.SpaceState[this._state]
|
|
3364
3549
|
}, {
|
|
3365
3550
|
F: __dxlog_file11,
|
|
3366
|
-
L:
|
|
3551
|
+
L: 278,
|
|
3367
3552
|
S: this,
|
|
3368
3553
|
C: (f, a) => f(...a)
|
|
3369
3554
|
});
|
|
@@ -3379,7 +3564,7 @@ var DataSpace = class {
|
|
|
3379
3564
|
await this._createWritableFeeds();
|
|
3380
3565
|
(0, import_log8.log)("writable feeds created", void 0, {
|
|
3381
3566
|
F: __dxlog_file11,
|
|
3382
|
-
L:
|
|
3567
|
+
L: 294,
|
|
3383
3568
|
S: this,
|
|
3384
3569
|
C: (f, a) => f(...a)
|
|
3385
3570
|
});
|
|
@@ -3406,7 +3591,7 @@ var DataSpace = class {
|
|
|
3406
3591
|
spaceKey: this.key,
|
|
3407
3592
|
deviceKey: this._signingContext.deviceKey,
|
|
3408
3593
|
identityKey: this._signingContext.identityKey,
|
|
3409
|
-
designation:
|
|
3594
|
+
designation: import_credentials10.AdmittedFeed.Designation.CONTROL
|
|
3410
3595
|
}
|
|
3411
3596
|
}));
|
|
3412
3597
|
}
|
|
@@ -3423,7 +3608,7 @@ var DataSpace = class {
|
|
|
3423
3608
|
spaceKey: this.key,
|
|
3424
3609
|
deviceKey: this._signingContext.deviceKey,
|
|
3425
3610
|
identityKey: this._signingContext.identityKey,
|
|
3426
|
-
designation:
|
|
3611
|
+
designation: import_credentials10.AdmittedFeed.Designation.DATA
|
|
3427
3612
|
}
|
|
3428
3613
|
}));
|
|
3429
3614
|
}
|
|
@@ -3442,12 +3627,12 @@ var DataSpace = class {
|
|
|
3442
3627
|
rootUrl
|
|
3443
3628
|
}, {
|
|
3444
3629
|
F: __dxlog_file11,
|
|
3445
|
-
L:
|
|
3630
|
+
L: 360,
|
|
3446
3631
|
S: this,
|
|
3447
3632
|
C: (f, a) => f(...a)
|
|
3448
3633
|
});
|
|
3449
|
-
this.
|
|
3450
|
-
const handle = this.
|
|
3634
|
+
this._echoHost.replicateDocument(rootUrl);
|
|
3635
|
+
const handle = this._echoHost.automergeRepo.find(rootUrl);
|
|
3451
3636
|
queueMicrotask(async () => {
|
|
3452
3637
|
try {
|
|
3453
3638
|
await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
@@ -3474,7 +3659,7 @@ var DataSpace = class {
|
|
|
3474
3659
|
err
|
|
3475
3660
|
}, {
|
|
3476
3661
|
F: __dxlog_file11,
|
|
3477
|
-
L:
|
|
3662
|
+
L: 383,
|
|
3478
3663
|
S: this,
|
|
3479
3664
|
C: (f, a) => f(...a)
|
|
3480
3665
|
});
|
|
@@ -3500,7 +3685,7 @@ var DataSpace = class {
|
|
|
3500
3685
|
let epoch;
|
|
3501
3686
|
switch (options?.migration) {
|
|
3502
3687
|
case void 0:
|
|
3503
|
-
case
|
|
3688
|
+
case import_services8.CreateEpochRequest.Migration.NONE:
|
|
3504
3689
|
{
|
|
3505
3690
|
epoch = {
|
|
3506
3691
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
@@ -3510,9 +3695,9 @@ var DataSpace = class {
|
|
|
3510
3695
|
};
|
|
3511
3696
|
}
|
|
3512
3697
|
break;
|
|
3513
|
-
case
|
|
3698
|
+
case import_services8.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
3514
3699
|
{
|
|
3515
|
-
const document = this.
|
|
3700
|
+
const document = this._echoHost.automergeRepo.create();
|
|
3516
3701
|
epoch = {
|
|
3517
3702
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
3518
3703
|
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
@@ -3521,15 +3706,15 @@ var DataSpace = class {
|
|
|
3521
3706
|
};
|
|
3522
3707
|
}
|
|
3523
3708
|
break;
|
|
3524
|
-
case
|
|
3709
|
+
case import_services8.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
|
|
3525
3710
|
{
|
|
3526
3711
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3527
|
-
const rootHandle = this.
|
|
3712
|
+
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
3528
3713
|
await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3529
|
-
const newRoot = this.
|
|
3714
|
+
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
3530
3715
|
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3531
3716
|
F: __dxlog_file11,
|
|
3532
|
-
L:
|
|
3717
|
+
L: 433,
|
|
3533
3718
|
S: this,
|
|
3534
3719
|
A: [
|
|
3535
3720
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -3544,23 +3729,23 @@ var DataSpace = class {
|
|
|
3544
3729
|
};
|
|
3545
3730
|
}
|
|
3546
3731
|
break;
|
|
3547
|
-
case
|
|
3732
|
+
case import_services8.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
|
|
3548
3733
|
{
|
|
3549
3734
|
import_log8.log.info("Fragmenting", void 0, {
|
|
3550
3735
|
F: __dxlog_file11,
|
|
3551
|
-
L:
|
|
3736
|
+
L: 445,
|
|
3552
3737
|
S: this,
|
|
3553
3738
|
C: (f, a) => f(...a)
|
|
3554
3739
|
});
|
|
3555
3740
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3556
|
-
const rootHandle = this.
|
|
3741
|
+
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
3557
3742
|
await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3558
3743
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3559
|
-
const properties = objects.find(([_, value]) => value.system.type?.itemId ===
|
|
3744
|
+
const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES);
|
|
3560
3745
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3561
3746
|
(0, import_invariant9.invariant)(properties, "Properties not found", {
|
|
3562
3747
|
F: __dxlog_file11,
|
|
3563
|
-
L:
|
|
3748
|
+
L: 455,
|
|
3564
3749
|
S: this,
|
|
3565
3750
|
A: [
|
|
3566
3751
|
"properties",
|
|
@@ -3573,17 +3758,17 @@ var DataSpace = class {
|
|
|
3573
3758
|
properties
|
|
3574
3759
|
])
|
|
3575
3760
|
};
|
|
3576
|
-
const newRoot = this.
|
|
3761
|
+
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
3577
3762
|
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3578
3763
|
F: __dxlog_file11,
|
|
3579
|
-
L:
|
|
3764
|
+
L: 460,
|
|
3580
3765
|
S: this,
|
|
3581
3766
|
A: [
|
|
3582
3767
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3583
3768
|
""
|
|
3584
3769
|
]
|
|
3585
3770
|
});
|
|
3586
|
-
const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(this.key, this.
|
|
3771
|
+
const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(this.key, this._echoHost.automergeRepo);
|
|
3587
3772
|
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
3588
3773
|
rootUrl: newRoot.url
|
|
3589
3774
|
});
|
|
@@ -3627,25 +3812,25 @@ var DataSpace = class {
|
|
|
3627
3812
|
]));
|
|
3628
3813
|
}
|
|
3629
3814
|
async activate() {
|
|
3630
|
-
if (this._state !==
|
|
3815
|
+
if (this._state !== import_services8.SpaceState.INACTIVE) {
|
|
3631
3816
|
return;
|
|
3632
3817
|
}
|
|
3633
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3818
|
+
await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.ACTIVE);
|
|
3634
3819
|
await this._open();
|
|
3635
3820
|
this.initializeDataPipelineAsync();
|
|
3636
3821
|
}
|
|
3637
3822
|
async deactivate() {
|
|
3638
|
-
if (this._state ===
|
|
3823
|
+
if (this._state === import_services8.SpaceState.INACTIVE) {
|
|
3639
3824
|
return;
|
|
3640
3825
|
}
|
|
3641
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3826
|
+
await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.INACTIVE);
|
|
3642
3827
|
await this._close();
|
|
3643
|
-
this._state =
|
|
3828
|
+
this._state = import_services8.SpaceState.INACTIVE;
|
|
3644
3829
|
(0, import_log8.log)("new state", {
|
|
3645
|
-
state:
|
|
3830
|
+
state: import_services8.SpaceState[this._state]
|
|
3646
3831
|
}, {
|
|
3647
3832
|
F: __dxlog_file11,
|
|
3648
|
-
L:
|
|
3833
|
+
L: 526,
|
|
3649
3834
|
S: this,
|
|
3650
3835
|
C: (f, a) => f(...a)
|
|
3651
3836
|
});
|
|
@@ -3660,7 +3845,7 @@ _ts_decorate4([
|
|
|
3660
3845
|
], DataSpace.prototype, "key", null);
|
|
3661
3846
|
_ts_decorate4([
|
|
3662
3847
|
import_tracing4.trace.info({
|
|
3663
|
-
enum:
|
|
3848
|
+
enum: import_services8.SpaceState
|
|
3664
3849
|
})
|
|
3665
3850
|
], DataSpace.prototype, "state", null);
|
|
3666
3851
|
_ts_decorate4([
|
|
@@ -3699,7 +3884,7 @@ DataSpace = _ts_decorate4([
|
|
|
3699
3884
|
], DataSpace);
|
|
3700
3885
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
3701
3886
|
const credentials = [
|
|
3702
|
-
await (0,
|
|
3887
|
+
await (0, import_credentials13.createCredential)({
|
|
3703
3888
|
signer: keyring,
|
|
3704
3889
|
issuer: space.key,
|
|
3705
3890
|
subject: space.key,
|
|
@@ -3708,14 +3893,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3708
3893
|
spaceKey: space.key
|
|
3709
3894
|
}
|
|
3710
3895
|
}),
|
|
3711
|
-
await (0,
|
|
3896
|
+
await (0, import_credentials13.createCredential)({
|
|
3712
3897
|
signer: keyring,
|
|
3713
3898
|
issuer: space.key,
|
|
3714
3899
|
subject: signingContext.identityKey,
|
|
3715
3900
|
assertion: {
|
|
3716
3901
|
"@type": "dxos.halo.credentials.SpaceMember",
|
|
3717
3902
|
spaceKey: space.key,
|
|
3718
|
-
role:
|
|
3903
|
+
role: import_credentials14.SpaceMember.Role.ADMIN,
|
|
3719
3904
|
profile: signingContext.getProfile(),
|
|
3720
3905
|
genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
|
|
3721
3906
|
}
|
|
@@ -3727,7 +3912,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3727
3912
|
spaceKey: space.key,
|
|
3728
3913
|
identityKey: signingContext.identityKey,
|
|
3729
3914
|
deviceKey: signingContext.deviceKey,
|
|
3730
|
-
designation:
|
|
3915
|
+
designation: import_credentials14.AdmittedFeed.Designation.CONTROL
|
|
3731
3916
|
}
|
|
3732
3917
|
}),
|
|
3733
3918
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -3737,7 +3922,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3737
3922
|
spaceKey: space.key,
|
|
3738
3923
|
identityKey: signingContext.identityKey,
|
|
3739
3924
|
deviceKey: signingContext.deviceKey,
|
|
3740
|
-
designation:
|
|
3925
|
+
designation: import_credentials14.AdmittedFeed.Designation.DATA
|
|
3741
3926
|
}
|
|
3742
3927
|
}),
|
|
3743
3928
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -3775,18 +3960,19 @@ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
3775
3960
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3776
3961
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3777
3962
|
var DataSpaceManager = class {
|
|
3778
|
-
constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore,
|
|
3963
|
+
constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, params) {
|
|
3779
3964
|
this._spaceManager = _spaceManager;
|
|
3780
3965
|
this._metadataStore = _metadataStore;
|
|
3781
3966
|
this._keyring = _keyring;
|
|
3782
3967
|
this._signingContext = _signingContext;
|
|
3783
3968
|
this._feedStore = _feedStore;
|
|
3784
|
-
this.
|
|
3969
|
+
this._echoHost = _echoHost;
|
|
3970
|
+
this._invitationsManager = _invitationsManager;
|
|
3785
3971
|
this._ctx = new import_context9.Context();
|
|
3786
3972
|
this.updated = new import_async13.Event();
|
|
3787
|
-
this._spaces = new import_util6.ComplexMap(
|
|
3973
|
+
this._spaces = new import_util6.ComplexMap(import_keys10.PublicKey.hash);
|
|
3788
3974
|
this._isOpen = false;
|
|
3789
|
-
this._instanceId =
|
|
3975
|
+
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
3790
3976
|
const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
3791
3977
|
this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
|
|
3792
3978
|
this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
|
|
@@ -3798,7 +3984,7 @@ var DataSpaceManager = class {
|
|
|
3798
3984
|
async open() {
|
|
3799
3985
|
(0, import_log10.log)("open", void 0, {
|
|
3800
3986
|
F: __dxlog_file12,
|
|
3801
|
-
L:
|
|
3987
|
+
L: 102,
|
|
3802
3988
|
S: this,
|
|
3803
3989
|
C: (f, a) => f(...a)
|
|
3804
3990
|
});
|
|
@@ -3806,7 +3992,7 @@ var DataSpaceManager = class {
|
|
|
3806
3992
|
id: this._instanceId
|
|
3807
3993
|
}), {
|
|
3808
3994
|
F: __dxlog_file12,
|
|
3809
|
-
L:
|
|
3995
|
+
L: 103,
|
|
3810
3996
|
S: this,
|
|
3811
3997
|
C: (f, a) => f(...a)
|
|
3812
3998
|
});
|
|
@@ -3814,7 +4000,7 @@ var DataSpaceManager = class {
|
|
|
3814
4000
|
spaces: this._metadataStore.spaces.length
|
|
3815
4001
|
}, {
|
|
3816
4002
|
F: __dxlog_file12,
|
|
3817
|
-
L:
|
|
4003
|
+
L: 104,
|
|
3818
4004
|
S: this,
|
|
3819
4005
|
C: (f, a) => f(...a)
|
|
3820
4006
|
});
|
|
@@ -3824,7 +4010,7 @@ var DataSpaceManager = class {
|
|
|
3824
4010
|
spaceMetadata
|
|
3825
4011
|
}, {
|
|
3826
4012
|
F: __dxlog_file12,
|
|
3827
|
-
L:
|
|
4013
|
+
L: 108,
|
|
3828
4014
|
S: this,
|
|
3829
4015
|
C: (f, a) => f(...a)
|
|
3830
4016
|
});
|
|
@@ -3835,7 +4021,7 @@ var DataSpaceManager = class {
|
|
|
3835
4021
|
err
|
|
3836
4022
|
}, {
|
|
3837
4023
|
F: __dxlog_file12,
|
|
3838
|
-
L:
|
|
4024
|
+
L: 111,
|
|
3839
4025
|
S: this,
|
|
3840
4026
|
C: (f, a) => f(...a)
|
|
3841
4027
|
});
|
|
@@ -3844,7 +4030,7 @@ var DataSpaceManager = class {
|
|
|
3844
4030
|
this._isOpen = true;
|
|
3845
4031
|
this.updated.emit();
|
|
3846
4032
|
for (const space of this._spaces.values()) {
|
|
3847
|
-
if (space.state !==
|
|
4033
|
+
if (space.state !== import_services9.SpaceState.INACTIVE) {
|
|
3848
4034
|
space.initializeDataPipelineAsync();
|
|
3849
4035
|
}
|
|
3850
4036
|
}
|
|
@@ -3852,7 +4038,7 @@ var DataSpaceManager = class {
|
|
|
3852
4038
|
id: this._instanceId
|
|
3853
4039
|
}), {
|
|
3854
4040
|
F: __dxlog_file12,
|
|
3855
|
-
L:
|
|
4041
|
+
L: 124,
|
|
3856
4042
|
S: this,
|
|
3857
4043
|
C: (f, a) => f(...a)
|
|
3858
4044
|
});
|
|
@@ -3860,7 +4046,7 @@ var DataSpaceManager = class {
|
|
|
3860
4046
|
async close() {
|
|
3861
4047
|
(0, import_log10.log)("close", void 0, {
|
|
3862
4048
|
F: __dxlog_file12,
|
|
3863
|
-
L:
|
|
4049
|
+
L: 129,
|
|
3864
4050
|
S: this,
|
|
3865
4051
|
C: (f, a) => f(...a)
|
|
3866
4052
|
});
|
|
@@ -3876,7 +4062,7 @@ var DataSpaceManager = class {
|
|
|
3876
4062
|
async createSpace() {
|
|
3877
4063
|
(0, import_invariant11.invariant)(this._isOpen, "Not open.", {
|
|
3878
4064
|
F: __dxlog_file12,
|
|
3879
|
-
L:
|
|
4065
|
+
L: 142,
|
|
3880
4066
|
S: this,
|
|
3881
4067
|
A: [
|
|
3882
4068
|
"this._isOpen",
|
|
@@ -3891,27 +4077,22 @@ var DataSpaceManager = class {
|
|
|
3891
4077
|
genesisFeedKey: controlFeedKey,
|
|
3892
4078
|
controlFeedKey,
|
|
3893
4079
|
dataFeedKey,
|
|
3894
|
-
state:
|
|
4080
|
+
state: import_services9.SpaceState.ACTIVE
|
|
3895
4081
|
};
|
|
3896
4082
|
(0, import_log10.log)("creating space...", {
|
|
3897
4083
|
spaceKey
|
|
3898
4084
|
}, {
|
|
3899
4085
|
F: __dxlog_file12,
|
|
3900
|
-
L:
|
|
4086
|
+
L: 154,
|
|
3901
4087
|
S: this,
|
|
3902
4088
|
C: (f, a) => f(...a)
|
|
3903
4089
|
});
|
|
3904
|
-
const
|
|
3905
|
-
automergeRoot.change((doc) => {
|
|
3906
|
-
doc.access = {
|
|
3907
|
-
spaceKey: spaceKey.toHex()
|
|
3908
|
-
};
|
|
3909
|
-
});
|
|
4090
|
+
const automergeRootUrl = await this._echoHost.createSpaceRoot(spaceKey);
|
|
3910
4091
|
const space = await this._constructSpace(metadata);
|
|
3911
|
-
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner,
|
|
4092
|
+
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRootUrl);
|
|
3912
4093
|
await this._metadataStore.addSpace(metadata);
|
|
3913
4094
|
const memberCredential = credentials[1];
|
|
3914
|
-
(0, import_invariant11.invariant)((0,
|
|
4095
|
+
(0, import_invariant11.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3915
4096
|
F: __dxlog_file12,
|
|
3916
4097
|
L: 163,
|
|
3917
4098
|
S: this,
|
|
@@ -3973,7 +4154,7 @@ var DataSpaceManager = class {
|
|
|
3973
4154
|
async waitUntilSpaceReady(spaceKey) {
|
|
3974
4155
|
await (0, import_context9.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3975
4156
|
const space = this._spaces.get(spaceKey);
|
|
3976
|
-
return !!space && space.state ===
|
|
4157
|
+
return !!space && space.state === import_services9.SpaceState.READY;
|
|
3977
4158
|
}));
|
|
3978
4159
|
}
|
|
3979
4160
|
async _constructSpace(metadata) {
|
|
@@ -4013,8 +4194,8 @@ var DataSpaceManager = class {
|
|
|
4013
4194
|
remotePeerId: session.remotePeerId
|
|
4014
4195
|
}));
|
|
4015
4196
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
4016
|
-
this.
|
|
4017
|
-
session.addExtension("dxos.mesh.teleport.automerge", this.
|
|
4197
|
+
this._echoHost.authorizeDevice(space.key, session.remotePeerId);
|
|
4198
|
+
session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
|
|
4018
4199
|
},
|
|
4019
4200
|
onAuthFailure: () => {
|
|
4020
4201
|
import_log10.log.warn("auth failure", void 0, {
|
|
@@ -4024,18 +4205,22 @@ var DataSpaceManager = class {
|
|
|
4024
4205
|
C: (f, a) => f(...a)
|
|
4025
4206
|
});
|
|
4026
4207
|
},
|
|
4027
|
-
memberKey: this._signingContext.identityKey
|
|
4208
|
+
memberKey: this._signingContext.identityKey,
|
|
4209
|
+
onDelegatedInvitationStatusChange: (invitation, isActive) => {
|
|
4210
|
+
return this._handleInvitationStatusChange(dataSpace, invitation, isActive);
|
|
4211
|
+
}
|
|
4028
4212
|
});
|
|
4029
4213
|
controlFeed && await space.setControlFeed(controlFeed);
|
|
4030
4214
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
4031
4215
|
const dataSpace = new DataSpace({
|
|
4032
4216
|
inner: space,
|
|
4033
|
-
initialState: metadata.state ===
|
|
4217
|
+
initialState: metadata.state === import_services9.SpaceState.INACTIVE ? import_services9.SpaceState.INACTIVE : import_services9.SpaceState.CLOSED,
|
|
4034
4218
|
metadataStore: this._metadataStore,
|
|
4035
4219
|
gossip,
|
|
4036
4220
|
presence,
|
|
4037
4221
|
keyring: this._keyring,
|
|
4038
4222
|
feedStore: this._feedStore,
|
|
4223
|
+
echoHost: this._echoHost,
|
|
4039
4224
|
signingContext: this._signingContext,
|
|
4040
4225
|
callbacks: {
|
|
4041
4226
|
beforeReady: async () => {
|
|
@@ -4043,7 +4228,7 @@ var DataSpaceManager = class {
|
|
|
4043
4228
|
space: space.key
|
|
4044
4229
|
}, {
|
|
4045
4230
|
F: __dxlog_file12,
|
|
4046
|
-
L:
|
|
4231
|
+
L: 269,
|
|
4047
4232
|
S: this,
|
|
4048
4233
|
C: (f, a) => f(...a)
|
|
4049
4234
|
});
|
|
@@ -4054,11 +4239,14 @@ var DataSpaceManager = class {
|
|
|
4054
4239
|
open: this._isOpen
|
|
4055
4240
|
}, {
|
|
4056
4241
|
F: __dxlog_file12,
|
|
4057
|
-
L:
|
|
4242
|
+
L: 272,
|
|
4058
4243
|
S: this,
|
|
4059
4244
|
C: (f, a) => f(...a)
|
|
4060
4245
|
});
|
|
4061
4246
|
if (this._isOpen) {
|
|
4247
|
+
await this._createDelegatedInvitations(dataSpace, [
|
|
4248
|
+
...space.spaceState.invitations.entries()
|
|
4249
|
+
]);
|
|
4062
4250
|
this.updated.emit();
|
|
4063
4251
|
}
|
|
4064
4252
|
},
|
|
@@ -4067,16 +4255,15 @@ var DataSpaceManager = class {
|
|
|
4067
4255
|
space: space.key
|
|
4068
4256
|
}, {
|
|
4069
4257
|
F: __dxlog_file12,
|
|
4070
|
-
L:
|
|
4258
|
+
L: 279,
|
|
4071
4259
|
S: this,
|
|
4072
4260
|
C: (f, a) => f(...a)
|
|
4073
4261
|
});
|
|
4074
4262
|
}
|
|
4075
4263
|
},
|
|
4076
|
-
cache: metadata.cache
|
|
4077
|
-
automergeHost: this._automergeHost
|
|
4264
|
+
cache: metadata.cache
|
|
4078
4265
|
});
|
|
4079
|
-
if (metadata.state !==
|
|
4266
|
+
if (metadata.state !== import_services9.SpaceState.INACTIVE) {
|
|
4080
4267
|
await dataSpace.open();
|
|
4081
4268
|
}
|
|
4082
4269
|
if (metadata.controlTimeframe) {
|
|
@@ -4085,6 +4272,41 @@ var DataSpaceManager = class {
|
|
|
4085
4272
|
this._spaces.set(metadata.key, dataSpace);
|
|
4086
4273
|
return dataSpace;
|
|
4087
4274
|
}
|
|
4275
|
+
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
4276
|
+
if (dataSpace?.state !== import_services9.SpaceState.READY) {
|
|
4277
|
+
return;
|
|
4278
|
+
}
|
|
4279
|
+
if (isActive) {
|
|
4280
|
+
await this._createDelegatedInvitations(dataSpace, [
|
|
4281
|
+
[
|
|
4282
|
+
delegatedInvitation.credentialId,
|
|
4283
|
+
delegatedInvitation.invitation
|
|
4284
|
+
]
|
|
4285
|
+
]);
|
|
4286
|
+
} else {
|
|
4287
|
+
await this._invitationsManager.cancelInvitation(delegatedInvitation.invitation);
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4290
|
+
async _createDelegatedInvitations(space, invitations) {
|
|
4291
|
+
const tasks = invitations.map(([credentialId, invitation]) => {
|
|
4292
|
+
return this._invitationsManager.createInvitation({
|
|
4293
|
+
type: import_services9.Invitation.Type.DELEGATED,
|
|
4294
|
+
kind: import_services9.Invitation.Kind.SPACE,
|
|
4295
|
+
spaceKey: space.key,
|
|
4296
|
+
authMethod: invitation.authMethod,
|
|
4297
|
+
invitationId: invitation.invitationId,
|
|
4298
|
+
swarmKey: invitation.swarmKey,
|
|
4299
|
+
guestKeypair: invitation.guestKey ? {
|
|
4300
|
+
publicKey: invitation.guestKey
|
|
4301
|
+
} : void 0,
|
|
4302
|
+
lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
|
|
4303
|
+
multiUse: invitation.multiUse,
|
|
4304
|
+
delegationCredentialId: credentialId,
|
|
4305
|
+
persistent: false
|
|
4306
|
+
});
|
|
4307
|
+
});
|
|
4308
|
+
await Promise.all(tasks);
|
|
4309
|
+
}
|
|
4088
4310
|
};
|
|
4089
4311
|
_ts_decorate5([
|
|
4090
4312
|
import_async13.synchronized
|
|
@@ -4121,10 +4343,10 @@ var SpacesServiceImpl = class {
|
|
|
4121
4343
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4122
4344
|
if (state) {
|
|
4123
4345
|
switch (state) {
|
|
4124
|
-
case
|
|
4346
|
+
case import_services10.SpaceState.ACTIVE:
|
|
4125
4347
|
await space.activate();
|
|
4126
4348
|
break;
|
|
4127
|
-
case
|
|
4349
|
+
case import_services10.SpaceState.INACTIVE:
|
|
4128
4350
|
await space.deactivate();
|
|
4129
4351
|
break;
|
|
4130
4352
|
default:
|
|
@@ -4298,7 +4520,7 @@ var SpacesServiceImpl = class {
|
|
|
4298
4520
|
identityKey: member.key,
|
|
4299
4521
|
profile: member.profile ?? {}
|
|
4300
4522
|
},
|
|
4301
|
-
presence: member.removed ?
|
|
4523
|
+
presence: member.removed ? import_services10.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services10.SpaceMember.PresenceState.ONLINE : import_services10.SpaceMember.PresenceState.OFFLINE,
|
|
4302
4524
|
peerStates: peers
|
|
4303
4525
|
};
|
|
4304
4526
|
}),
|
|
@@ -4309,80 +4531,6 @@ var SpacesServiceImpl = class {
|
|
|
4309
4531
|
}
|
|
4310
4532
|
};
|
|
4311
4533
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4312
|
-
var createSelectedDocumentsIterator = (automergeHost) => (
|
|
4313
|
-
/**
|
|
4314
|
-
* Get object data blobs from Automerge Repo by ids.
|
|
4315
|
-
* @param ids
|
|
4316
|
-
*/
|
|
4317
|
-
// TODO(mykola): Unload automerge handles after usage.
|
|
4318
|
-
async function* loadDocuments(ids) {
|
|
4319
|
-
for (const id of ids) {
|
|
4320
|
-
const { documentId, objectId } = import_protocols12.idCodec.decode(id);
|
|
4321
|
-
const handle = automergeHost.repo.find(documentId);
|
|
4322
|
-
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4323
|
-
const doc = handle.docSync();
|
|
4324
|
-
const hash = (0, import_automerge.getHeads)(doc).join("");
|
|
4325
|
-
yield doc.objects?.[objectId] ? [
|
|
4326
|
-
{
|
|
4327
|
-
id,
|
|
4328
|
-
object: doc.objects[objectId],
|
|
4329
|
-
currentHash: hash
|
|
4330
|
-
}
|
|
4331
|
-
] : [];
|
|
4332
|
-
}
|
|
4333
|
-
}
|
|
4334
|
-
);
|
|
4335
|
-
var createDocumentsIterator = (automergeHost) => (
|
|
4336
|
-
/**
|
|
4337
|
-
* Recursively get all object data blobs from Automerge Repo.
|
|
4338
|
-
* @param ids
|
|
4339
|
-
*/
|
|
4340
|
-
// TODO(mykola): Unload automerge handles after usage.
|
|
4341
|
-
async function* getAllDocuments() {
|
|
4342
|
-
const visited = /* @__PURE__ */ new Set();
|
|
4343
|
-
async function* getObjectsFromHandle(handle) {
|
|
4344
|
-
if (visited.has(handle.documentId)) {
|
|
4345
|
-
return;
|
|
4346
|
-
}
|
|
4347
|
-
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4348
|
-
const doc = handle.docSync();
|
|
4349
|
-
const heads = (0, import_automerge.getHeads)(doc);
|
|
4350
|
-
if (doc.objects) {
|
|
4351
|
-
yield Object.entries(doc.objects).map(([objectId, object]) => {
|
|
4352
|
-
return {
|
|
4353
|
-
id: import_protocols12.idCodec.encode({
|
|
4354
|
-
documentId: handle.documentId,
|
|
4355
|
-
objectId
|
|
4356
|
-
}),
|
|
4357
|
-
object,
|
|
4358
|
-
currentHash: heads.join("")
|
|
4359
|
-
};
|
|
4360
|
-
});
|
|
4361
|
-
}
|
|
4362
|
-
if (doc.links) {
|
|
4363
|
-
for (const id of Object.values(doc.links)) {
|
|
4364
|
-
if (visited.has(id)) {
|
|
4365
|
-
continue;
|
|
4366
|
-
}
|
|
4367
|
-
const linkHandle = automergeHost.repo.find(id);
|
|
4368
|
-
for await (const result of getObjectsFromHandle(linkHandle)) {
|
|
4369
|
-
yield result;
|
|
4370
|
-
}
|
|
4371
|
-
}
|
|
4372
|
-
}
|
|
4373
|
-
visited.add(handle.documentId);
|
|
4374
|
-
}
|
|
4375
|
-
for (const handle of Object.values(automergeHost.repo.handles)) {
|
|
4376
|
-
if (visited.has(handle.documentId)) {
|
|
4377
|
-
continue;
|
|
4378
|
-
}
|
|
4379
|
-
for await (const result of getObjectsFromHandle(handle)) {
|
|
4380
|
-
yield result;
|
|
4381
|
-
}
|
|
4382
|
-
visited.add(handle.documentId);
|
|
4383
|
-
}
|
|
4384
|
-
}
|
|
4385
|
-
);
|
|
4386
4534
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
4387
4535
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4388
4536
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -4404,7 +4552,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4404
4552
|
this._runtimeParams = _runtimeParams;
|
|
4405
4553
|
this.initialized = new import_async15.Trigger();
|
|
4406
4554
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4407
|
-
this._instanceId =
|
|
4555
|
+
this._instanceId = import_keys11.PublicKey.random().toHex();
|
|
4408
4556
|
this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
|
|
4409
4557
|
this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4410
4558
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
@@ -4427,30 +4575,19 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4427
4575
|
snapshotStore: this.snapshotStore
|
|
4428
4576
|
});
|
|
4429
4577
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4430
|
-
this.
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
this.automergeHost = new import_echo_pipeline4.AutomergeHost({
|
|
4434
|
-
directory: storage.createDirectory("automerge"),
|
|
4435
|
-
db: level.sublevel("automerge"),
|
|
4436
|
-
metadata: this.indexMetadata
|
|
4437
|
-
});
|
|
4438
|
-
this.indexer = new import_indexing.Indexer({
|
|
4439
|
-
indexStore: new import_indexing.IndexStore({
|
|
4440
|
-
directory: storage.createDirectory("index-store")
|
|
4441
|
-
}),
|
|
4442
|
-
metadataStore: this.indexMetadata,
|
|
4443
|
-
loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
|
|
4444
|
-
getAllDocuments: createDocumentsIterator(this.automergeHost)
|
|
4578
|
+
this.echoHost = new import_echo_db.EchoHost({
|
|
4579
|
+
kv: this.level,
|
|
4580
|
+
storage: this.storage
|
|
4445
4581
|
});
|
|
4446
4582
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4447
|
-
this.
|
|
4583
|
+
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
4584
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4448
4585
|
}
|
|
4449
4586
|
async _open(ctx) {
|
|
4450
4587
|
await this._checkStorageVersion();
|
|
4451
4588
|
(0, import_log12.log)("opening...", void 0, {
|
|
4452
4589
|
F: __dxlog_file14,
|
|
4453
|
-
L:
|
|
4590
|
+
L: 151,
|
|
4454
4591
|
S: this,
|
|
4455
4592
|
C: (f, a) => f(...a)
|
|
4456
4593
|
});
|
|
@@ -4458,56 +4595,64 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4458
4595
|
id: this._instanceId
|
|
4459
4596
|
}), {
|
|
4460
4597
|
F: __dxlog_file14,
|
|
4461
|
-
L:
|
|
4598
|
+
L: 152,
|
|
4462
4599
|
S: this,
|
|
4463
4600
|
C: (f, a) => f(...a)
|
|
4464
4601
|
});
|
|
4465
4602
|
await this.signalManager.open();
|
|
4466
4603
|
await this.networkManager.open();
|
|
4467
|
-
await this.
|
|
4604
|
+
await this.echoHost.open(ctx);
|
|
4468
4605
|
await this.metadataStore.load();
|
|
4469
4606
|
await this.spaceManager.open();
|
|
4470
4607
|
await this.identityManager.open(ctx);
|
|
4471
4608
|
if (this.identityManager.identity) {
|
|
4472
4609
|
await this._initialize(ctx);
|
|
4473
4610
|
}
|
|
4611
|
+
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
4612
|
+
(0, import_log12.log)("loaded persistent invitations", {
|
|
4613
|
+
count: loadedInvitations.invitations?.length
|
|
4614
|
+
}, {
|
|
4615
|
+
F: __dxlog_file14,
|
|
4616
|
+
L: 165,
|
|
4617
|
+
S: this,
|
|
4618
|
+
C: (f, a) => f(...a)
|
|
4619
|
+
});
|
|
4474
4620
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols11.trace.end({
|
|
4475
4621
|
id: this._instanceId
|
|
4476
4622
|
}), {
|
|
4477
4623
|
F: __dxlog_file14,
|
|
4478
|
-
L:
|
|
4624
|
+
L: 167,
|
|
4479
4625
|
S: this,
|
|
4480
4626
|
C: (f, a) => f(...a)
|
|
4481
4627
|
});
|
|
4482
4628
|
(0, import_log12.log)("opened", void 0, {
|
|
4483
4629
|
F: __dxlog_file14,
|
|
4484
|
-
L:
|
|
4630
|
+
L: 168,
|
|
4485
4631
|
S: this,
|
|
4486
4632
|
C: (f, a) => f(...a)
|
|
4487
4633
|
});
|
|
4488
4634
|
}
|
|
4489
|
-
async _close() {
|
|
4635
|
+
async _close(ctx) {
|
|
4490
4636
|
(0, import_log12.log)("closing...", void 0, {
|
|
4491
4637
|
F: __dxlog_file14,
|
|
4492
|
-
L:
|
|
4638
|
+
L: 172,
|
|
4493
4639
|
S: this,
|
|
4494
4640
|
C: (f, a) => f(...a)
|
|
4495
4641
|
});
|
|
4496
4642
|
if (this._deviceSpaceSync && this.identityManager.identity) {
|
|
4497
4643
|
await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
|
|
4498
4644
|
}
|
|
4499
|
-
await this.automergeHost.close();
|
|
4500
4645
|
await this.dataSpaceManager?.close();
|
|
4501
4646
|
await this.identityManager.close();
|
|
4502
4647
|
await this.spaceManager.close();
|
|
4503
4648
|
await this.feedStore.close();
|
|
4649
|
+
await this.metadataStore.close();
|
|
4650
|
+
await this.echoHost.close(ctx);
|
|
4504
4651
|
await this.networkManager.close();
|
|
4505
4652
|
await this.signalManager.close();
|
|
4506
|
-
await this.metadataStore.close();
|
|
4507
|
-
await this.indexer.destroy();
|
|
4508
4653
|
(0, import_log12.log)("closed", void 0, {
|
|
4509
4654
|
F: __dxlog_file14,
|
|
4510
|
-
L:
|
|
4655
|
+
L: 184,
|
|
4511
4656
|
S: this,
|
|
4512
4657
|
C: (f, a) => f(...a)
|
|
4513
4658
|
});
|
|
@@ -4521,7 +4666,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4521
4666
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4522
4667
|
(0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4523
4668
|
F: __dxlog_file14,
|
|
4524
|
-
L:
|
|
4669
|
+
L: 195,
|
|
4525
4670
|
S: this,
|
|
4526
4671
|
A: [
|
|
4527
4672
|
"factory",
|
|
@@ -4553,7 +4698,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4553
4698
|
async _initialize(ctx) {
|
|
4554
4699
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
4555
4700
|
F: __dxlog_file14,
|
|
4556
|
-
L:
|
|
4701
|
+
L: 226,
|
|
4557
4702
|
S: this,
|
|
4558
4703
|
C: (f, a) => f(...a)
|
|
4559
4704
|
});
|
|
@@ -4571,12 +4716,12 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4571
4716
|
});
|
|
4572
4717
|
}
|
|
4573
4718
|
};
|
|
4574
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.
|
|
4719
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.echoHost, this.invitationsManager, this._runtimeParams);
|
|
4575
4720
|
await this.dataSpaceManager.open();
|
|
4576
|
-
this._handlerFactories.set(
|
|
4721
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
|
|
4577
4722
|
(0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4578
4723
|
F: __dxlog_file14,
|
|
4579
|
-
L:
|
|
4724
|
+
L: 251,
|
|
4580
4725
|
S: this,
|
|
4581
4726
|
A: [
|
|
4582
4727
|
"this.dataSpaceManager",
|
|
@@ -4588,7 +4733,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4588
4733
|
this.initialized.wake();
|
|
4589
4734
|
this._deviceSpaceSync = {
|
|
4590
4735
|
processCredential: async (credential) => {
|
|
4591
|
-
const assertion = (0,
|
|
4736
|
+
const assertion = (0, import_credentials15.getCredentialAssertion)(credential);
|
|
4592
4737
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
4593
4738
|
return;
|
|
4594
4739
|
}
|
|
@@ -4600,7 +4745,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4600
4745
|
details: assertion
|
|
4601
4746
|
}, {
|
|
4602
4747
|
F: __dxlog_file14,
|
|
4603
|
-
L:
|
|
4748
|
+
L: 267,
|
|
4604
4749
|
S: this,
|
|
4605
4750
|
C: (f, a) => f(...a)
|
|
4606
4751
|
});
|
|
@@ -4611,7 +4756,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4611
4756
|
details: assertion
|
|
4612
4757
|
}, {
|
|
4613
4758
|
F: __dxlog_file14,
|
|
4614
|
-
L:
|
|
4759
|
+
L: 271,
|
|
4615
4760
|
S: this,
|
|
4616
4761
|
C: (f, a) => f(...a)
|
|
4617
4762
|
});
|
|
@@ -4622,7 +4767,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4622
4767
|
details: assertion
|
|
4623
4768
|
}, {
|
|
4624
4769
|
F: __dxlog_file14,
|
|
4625
|
-
L:
|
|
4770
|
+
L: 276,
|
|
4626
4771
|
S: this,
|
|
4627
4772
|
C: (f, a) => f(...a)
|
|
4628
4773
|
});
|
|
@@ -4633,7 +4778,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4633
4778
|
} catch (err) {
|
|
4634
4779
|
import_log12.log.catch(err, void 0, {
|
|
4635
4780
|
F: __dxlog_file14,
|
|
4636
|
-
L:
|
|
4781
|
+
L: 282,
|
|
4637
4782
|
S: this,
|
|
4638
4783
|
C: (f, a) => f(...a)
|
|
4639
4784
|
});
|
|
@@ -4675,26 +4820,26 @@ var ServiceRegistry = class {
|
|
|
4675
4820
|
delete this._handlers[name];
|
|
4676
4821
|
}
|
|
4677
4822
|
};
|
|
4678
|
-
var DXOS_VERSION = "0.4.10-main.
|
|
4823
|
+
var DXOS_VERSION = "0.4.10-main.3f5e2d2";
|
|
4679
4824
|
var getPlatform = () => {
|
|
4680
4825
|
if (process.browser) {
|
|
4681
4826
|
if (typeof window !== "undefined") {
|
|
4682
4827
|
const { userAgent } = window.navigator;
|
|
4683
4828
|
return {
|
|
4684
|
-
type:
|
|
4829
|
+
type: import_services13.Platform.PLATFORM_TYPE.BROWSER,
|
|
4685
4830
|
userAgent,
|
|
4686
4831
|
uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
|
|
4687
4832
|
};
|
|
4688
4833
|
} else {
|
|
4689
4834
|
return {
|
|
4690
|
-
type:
|
|
4835
|
+
type: import_services13.Platform.PLATFORM_TYPE.SHARED_WORKER,
|
|
4691
4836
|
uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
|
|
4692
4837
|
};
|
|
4693
4838
|
}
|
|
4694
4839
|
} else {
|
|
4695
4840
|
const { platform: platform2, version, arch } = process;
|
|
4696
4841
|
return {
|
|
4697
|
-
type:
|
|
4842
|
+
type: import_services13.Platform.PLATFORM_TYPE.NODE,
|
|
4698
4843
|
platform: platform2,
|
|
4699
4844
|
arch,
|
|
4700
4845
|
runtime: version,
|
|
@@ -4712,7 +4857,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
4712
4857
|
client: {
|
|
4713
4858
|
version: DXOS_VERSION,
|
|
4714
4859
|
storage: {
|
|
4715
|
-
version:
|
|
4860
|
+
version: import_protocols12.STORAGE_VERSION
|
|
4716
4861
|
}
|
|
4717
4862
|
},
|
|
4718
4863
|
trace: import_tracing6.TRACE_PROCESSOR.getDiagnostics()
|
|
@@ -4781,7 +4926,7 @@ var getSpaceStats = async (space) => {
|
|
|
4781
4926
|
const stats = {
|
|
4782
4927
|
key: space.key,
|
|
4783
4928
|
metrics: space.metrics,
|
|
4784
|
-
epochs: space.inner.spaceState.credentials.filter((0,
|
|
4929
|
+
epochs: space.inner.spaceState.credentials.filter((0, import_credentials16.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
|
|
4785
4930
|
...credential.subject.assertion,
|
|
4786
4931
|
id: credential.id
|
|
4787
4932
|
})),
|
|
@@ -4792,7 +4937,7 @@ var getSpaceStats = async (space) => {
|
|
|
4792
4937
|
displayName: member.assertion.profile?.displayName
|
|
4793
4938
|
}
|
|
4794
4939
|
},
|
|
4795
|
-
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ?
|
|
4940
|
+
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services12.SpaceMember.PresenceState.ONLINE : import_services12.SpaceMember.PresenceState.OFFLINE
|
|
4796
4941
|
})),
|
|
4797
4942
|
pipeline: {
|
|
4798
4943
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
@@ -4856,9 +5001,9 @@ var DevicesServiceImpl = class {
|
|
|
4856
5001
|
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
4857
5002
|
return {
|
|
4858
5003
|
deviceKey: key,
|
|
4859
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
5004
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services16.DeviceKind.CURRENT : import_services16.DeviceKind.TRUSTED,
|
|
4860
5005
|
profile,
|
|
4861
|
-
presence: isMe ?
|
|
5006
|
+
presence: isMe ? import_services16.Device.PresenceState.ONLINE : peerState ? import_services16.Device.PresenceState.ONLINE : import_services16.Device.PresenceState.OFFLINE
|
|
4862
5007
|
};
|
|
4863
5008
|
})
|
|
4864
5009
|
});
|
|
@@ -4957,7 +5102,7 @@ var LoggingServiceImpl = class {
|
|
|
4957
5102
|
constructor() {
|
|
4958
5103
|
this._logs = new import_async18.Event();
|
|
4959
5104
|
this._started = Date.now();
|
|
4960
|
-
this._sessionId =
|
|
5105
|
+
this._sessionId = import_keys13.PublicKey.random().toHex();
|
|
4961
5106
|
this._logProcessor = (_config, entry2) => {
|
|
4962
5107
|
this._logs.emit(entry2);
|
|
4963
5108
|
};
|
|
@@ -5054,16 +5199,16 @@ var LoggingServiceImpl = class {
|
|
|
5054
5199
|
};
|
|
5055
5200
|
var matchFilter = (filter, level, path2, options) => {
|
|
5056
5201
|
switch (options) {
|
|
5057
|
-
case
|
|
5202
|
+
case import_services17.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
5058
5203
|
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5059
|
-
case
|
|
5204
|
+
case import_services17.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
5060
5205
|
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5061
5206
|
}
|
|
5062
5207
|
};
|
|
5063
5208
|
var shouldLog = (entry2, request) => {
|
|
5064
|
-
const options = request.options ??
|
|
5209
|
+
const options = request.options ?? import_services17.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
5065
5210
|
if (request.filters === void 0) {
|
|
5066
|
-
return options ===
|
|
5211
|
+
return options === import_services17.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
5067
5212
|
} else {
|
|
5068
5213
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
5069
5214
|
}
|
|
@@ -5100,7 +5245,7 @@ var NetworkServiceImpl = class {
|
|
|
5100
5245
|
}
|
|
5101
5246
|
};
|
|
5102
5247
|
var getRootPath = (config) => {
|
|
5103
|
-
const { dataRoot = (0, import_util11.isNode)() ?
|
|
5248
|
+
const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5104
5249
|
return `${dataRoot}/`;
|
|
5105
5250
|
};
|
|
5106
5251
|
var isPersistent = (config) => {
|
|
@@ -5111,16 +5256,16 @@ var StorageDriver = import_config2.Runtime.Client.Storage.StorageDriver;
|
|
|
5111
5256
|
var createStorageObjects = (config) => {
|
|
5112
5257
|
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
5113
5258
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
5114
|
-
throw new
|
|
5259
|
+
throw new import_protocols14.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
5115
5260
|
}
|
|
5116
5261
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
5117
|
-
throw new
|
|
5262
|
+
throw new import_protocols14.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
5118
5263
|
}
|
|
5119
5264
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
5120
|
-
throw new
|
|
5265
|
+
throw new import_protocols14.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
5121
5266
|
}
|
|
5122
5267
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
5123
|
-
throw new
|
|
5268
|
+
throw new import_protocols14.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
5124
5269
|
}
|
|
5125
5270
|
return {
|
|
5126
5271
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -5151,7 +5296,7 @@ var toStorageType = (type) => {
|
|
|
5151
5296
|
};
|
|
5152
5297
|
var createLevel = async (config) => {
|
|
5153
5298
|
const persistent = isPersistent(config);
|
|
5154
|
-
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${
|
|
5299
|
+
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys14.PublicKey.random().toHex()}`;
|
|
5155
5300
|
const level = new import_level.Level(storagePath);
|
|
5156
5301
|
await level.open();
|
|
5157
5302
|
return level;
|
|
@@ -5176,8 +5321,8 @@ var SystemServiceImpl = class {
|
|
|
5176
5321
|
return {
|
|
5177
5322
|
timestamp: /* @__PURE__ */ new Date(),
|
|
5178
5323
|
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util12.jsonKeyReplacer)({
|
|
5179
|
-
truncate: keys ===
|
|
5180
|
-
humanize: keys ===
|
|
5324
|
+
truncate: keys === import_services18.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
5325
|
+
humanize: keys === import_services18.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
5181
5326
|
})))
|
|
5182
5327
|
};
|
|
5183
5328
|
}
|
|
@@ -5260,14 +5405,14 @@ var ClientServicesHost = class {
|
|
|
5260
5405
|
this._systemService = new SystemServiceImpl({
|
|
5261
5406
|
config: () => this._config,
|
|
5262
5407
|
statusUpdate: this._statusUpdate,
|
|
5263
|
-
getCurrentStatus: () => this.isOpen ?
|
|
5408
|
+
getCurrentStatus: () => this.isOpen ? import_services15.SystemStatus.ACTIVE : import_services15.SystemStatus.INACTIVE,
|
|
5264
5409
|
getDiagnostics: () => {
|
|
5265
5410
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
5266
5411
|
},
|
|
5267
5412
|
onUpdateStatus: async (status) => {
|
|
5268
|
-
if (!this.isOpen && status ===
|
|
5413
|
+
if (!this.isOpen && status === import_services15.SystemStatus.ACTIVE) {
|
|
5269
5414
|
await this._resourceLock?.acquire();
|
|
5270
|
-
} else if (this.isOpen && status ===
|
|
5415
|
+
} else if (this.isOpen && status === import_services15.SystemStatus.INACTIVE) {
|
|
5271
5416
|
await this._resourceLock?.release();
|
|
5272
5417
|
}
|
|
5273
5418
|
},
|
|
@@ -5277,7 +5422,7 @@ var ClientServicesHost = class {
|
|
|
5277
5422
|
});
|
|
5278
5423
|
this.diagnosticsBroadcastHandler = createCollectDiagnosticsBroadcastHandler(this._systemService);
|
|
5279
5424
|
this._loggingService = new LoggingServiceImpl();
|
|
5280
|
-
this._serviceRegistry = new ServiceRegistry(
|
|
5425
|
+
this._serviceRegistry = new ServiceRegistry(import_client_protocol5.clientServiceBundle, {
|
|
5281
5426
|
SystemService: this._systemService,
|
|
5282
5427
|
TracingService: this._tracingService
|
|
5283
5428
|
});
|
|
@@ -5308,7 +5453,7 @@ var ClientServicesHost = class {
|
|
|
5308
5453
|
initialize({ config, ...options }) {
|
|
5309
5454
|
(0, import_invariant15.invariant)(!this._open, "service host is open", {
|
|
5310
5455
|
F: __dxlog_file18,
|
|
5311
|
-
L:
|
|
5456
|
+
L: 190,
|
|
5312
5457
|
S: this,
|
|
5313
5458
|
A: [
|
|
5314
5459
|
"!this._open",
|
|
@@ -5317,14 +5462,14 @@ var ClientServicesHost = class {
|
|
|
5317
5462
|
});
|
|
5318
5463
|
(0, import_log13.log)("initializing...", void 0, {
|
|
5319
5464
|
F: __dxlog_file18,
|
|
5320
|
-
L:
|
|
5465
|
+
L: 191,
|
|
5321
5466
|
S: this,
|
|
5322
5467
|
C: (f, a) => f(...a)
|
|
5323
5468
|
});
|
|
5324
5469
|
if (config) {
|
|
5325
5470
|
(0, import_invariant15.invariant)(!this._config, "config already set", {
|
|
5326
5471
|
F: __dxlog_file18,
|
|
5327
|
-
L:
|
|
5472
|
+
L: 194,
|
|
5328
5473
|
S: this,
|
|
5329
5474
|
A: [
|
|
5330
5475
|
"!this._config",
|
|
@@ -5339,7 +5484,7 @@ var ClientServicesHost = class {
|
|
|
5339
5484
|
if (!options.signalManager) {
|
|
5340
5485
|
import_log13.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
5341
5486
|
F: __dxlog_file18,
|
|
5342
|
-
L:
|
|
5487
|
+
L: 202,
|
|
5343
5488
|
S: this,
|
|
5344
5489
|
C: (f, a) => f(...a)
|
|
5345
5490
|
});
|
|
@@ -5350,7 +5495,7 @@ var ClientServicesHost = class {
|
|
|
5350
5495
|
this._signalManager = signalManager;
|
|
5351
5496
|
(0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
|
|
5352
5497
|
F: __dxlog_file18,
|
|
5353
|
-
L:
|
|
5498
|
+
L: 213,
|
|
5354
5499
|
S: this,
|
|
5355
5500
|
A: [
|
|
5356
5501
|
"!this._networkManager",
|
|
@@ -5364,7 +5509,7 @@ var ClientServicesHost = class {
|
|
|
5364
5509
|
});
|
|
5365
5510
|
(0, import_log13.log)("initialized", void 0, {
|
|
5366
5511
|
F: __dxlog_file18,
|
|
5367
|
-
L:
|
|
5512
|
+
L: 220,
|
|
5368
5513
|
S: this,
|
|
5369
5514
|
C: (f, a) => f(...a)
|
|
5370
5515
|
});
|
|
@@ -5373,18 +5518,18 @@ var ClientServicesHost = class {
|
|
|
5373
5518
|
if (this._open) {
|
|
5374
5519
|
return;
|
|
5375
5520
|
}
|
|
5376
|
-
const traceId =
|
|
5377
|
-
import_log13.log.trace("dxos.client-services.host.open",
|
|
5521
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
5522
|
+
import_log13.log.trace("dxos.client-services.host.open", import_protocols13.trace.begin({
|
|
5378
5523
|
id: traceId
|
|
5379
5524
|
}), {
|
|
5380
5525
|
F: __dxlog_file18,
|
|
5381
|
-
L:
|
|
5526
|
+
L: 231,
|
|
5382
5527
|
S: this,
|
|
5383
5528
|
C: (f, a) => f(...a)
|
|
5384
5529
|
});
|
|
5385
5530
|
(0, import_invariant15.invariant)(this._config, "config not set", {
|
|
5386
5531
|
F: __dxlog_file18,
|
|
5387
|
-
L:
|
|
5532
|
+
L: 233,
|
|
5388
5533
|
S: this,
|
|
5389
5534
|
A: [
|
|
5390
5535
|
"this._config",
|
|
@@ -5393,7 +5538,7 @@ var ClientServicesHost = class {
|
|
|
5393
5538
|
});
|
|
5394
5539
|
(0, import_invariant15.invariant)(this._storage, "storage not set", {
|
|
5395
5540
|
F: __dxlog_file18,
|
|
5396
|
-
L:
|
|
5541
|
+
L: 234,
|
|
5397
5542
|
S: this,
|
|
5398
5543
|
A: [
|
|
5399
5544
|
"this._storage",
|
|
@@ -5402,7 +5547,7 @@ var ClientServicesHost = class {
|
|
|
5402
5547
|
});
|
|
5403
5548
|
(0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
|
|
5404
5549
|
F: __dxlog_file18,
|
|
5405
|
-
L:
|
|
5550
|
+
L: 235,
|
|
5406
5551
|
S: this,
|
|
5407
5552
|
A: [
|
|
5408
5553
|
"this._signalManager",
|
|
@@ -5411,7 +5556,7 @@ var ClientServicesHost = class {
|
|
|
5411
5556
|
});
|
|
5412
5557
|
(0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
|
|
5413
5558
|
F: __dxlog_file18,
|
|
5414
|
-
L:
|
|
5559
|
+
L: 236,
|
|
5415
5560
|
S: this,
|
|
5416
5561
|
A: [
|
|
5417
5562
|
"this._networkManager",
|
|
@@ -5423,7 +5568,7 @@ var ClientServicesHost = class {
|
|
|
5423
5568
|
lockKey: this._resourceLock?.lockKey
|
|
5424
5569
|
}, {
|
|
5425
5570
|
F: __dxlog_file18,
|
|
5426
|
-
L:
|
|
5571
|
+
L: 239,
|
|
5427
5572
|
S: this,
|
|
5428
5573
|
C: (f, a) => f(...a)
|
|
5429
5574
|
});
|
|
@@ -5437,17 +5582,14 @@ var ClientServicesHost = class {
|
|
|
5437
5582
|
this._serviceRegistry.setServices({
|
|
5438
5583
|
SystemService: this._systemService,
|
|
5439
5584
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
5440
|
-
InvitationsService: new InvitationsServiceImpl(this._serviceContext.
|
|
5585
|
+
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
5441
5586
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
5442
5587
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
|
|
5443
5588
|
await this._serviceContext.initialized.wait();
|
|
5444
5589
|
return this._serviceContext.dataSpaceManager;
|
|
5445
5590
|
}),
|
|
5446
|
-
DataService:
|
|
5447
|
-
|
|
5448
|
-
indexer: this._serviceContext.indexer,
|
|
5449
|
-
automergeHost: this._serviceContext.automergeHost
|
|
5450
|
-
}),
|
|
5591
|
+
DataService: this._serviceContext.echoHost.dataService,
|
|
5592
|
+
QueryService: this._serviceContext.echoHost.queryService,
|
|
5451
5593
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
5452
5594
|
LoggingService: this._loggingService,
|
|
5453
5595
|
TracingService: this._tracingService,
|
|
@@ -5459,30 +5601,12 @@ var ClientServicesHost = class {
|
|
|
5459
5601
|
})
|
|
5460
5602
|
});
|
|
5461
5603
|
await this._serviceContext.open(ctx);
|
|
5462
|
-
(0, import_invariant15.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
|
|
5463
|
-
F: __dxlog_file18,
|
|
5464
|
-
L: 314,
|
|
5465
|
-
S: this,
|
|
5466
|
-
A: [
|
|
5467
|
-
"this.serviceRegistry.services.InvitationsService",
|
|
5468
|
-
""
|
|
5469
|
-
]
|
|
5470
|
-
});
|
|
5471
|
-
const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
|
|
5472
|
-
(0, import_log13.log)("loaded persistent invitations", {
|
|
5473
|
-
count: loadedInvitations.invitations?.length
|
|
5474
|
-
}, {
|
|
5475
|
-
F: __dxlog_file18,
|
|
5476
|
-
L: 317,
|
|
5477
|
-
S: this,
|
|
5478
|
-
C: (f, a) => f(...a)
|
|
5479
|
-
});
|
|
5480
5604
|
const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
|
|
5481
5605
|
if (devtoolsProxy) {
|
|
5482
5606
|
this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
|
|
5483
5607
|
url: devtoolsProxy,
|
|
5484
5608
|
requested: {},
|
|
5485
|
-
exposed:
|
|
5609
|
+
exposed: import_client_protocol5.clientServiceBundle,
|
|
5486
5610
|
handlers: this.services
|
|
5487
5611
|
});
|
|
5488
5612
|
void this._devtoolsProxy.open();
|
|
@@ -5496,15 +5620,15 @@ var ClientServicesHost = class {
|
|
|
5496
5620
|
deviceKey
|
|
5497
5621
|
}, {
|
|
5498
5622
|
F: __dxlog_file18,
|
|
5499
|
-
L:
|
|
5623
|
+
L: 315,
|
|
5500
5624
|
S: this,
|
|
5501
5625
|
C: (f, a) => f(...a)
|
|
5502
5626
|
});
|
|
5503
|
-
import_log13.log.trace("dxos.client-services.host.open",
|
|
5627
|
+
import_log13.log.trace("dxos.client-services.host.open", import_protocols13.trace.end({
|
|
5504
5628
|
id: traceId
|
|
5505
5629
|
}), {
|
|
5506
5630
|
F: __dxlog_file18,
|
|
5507
|
-
L:
|
|
5631
|
+
L: 316,
|
|
5508
5632
|
S: this,
|
|
5509
5633
|
C: (f, a) => f(...a)
|
|
5510
5634
|
});
|
|
@@ -5518,7 +5642,7 @@ var ClientServicesHost = class {
|
|
|
5518
5642
|
deviceKey
|
|
5519
5643
|
}, {
|
|
5520
5644
|
F: __dxlog_file18,
|
|
5521
|
-
L:
|
|
5645
|
+
L: 327,
|
|
5522
5646
|
S: this,
|
|
5523
5647
|
C: (f, a) => f(...a)
|
|
5524
5648
|
});
|
|
@@ -5536,24 +5660,24 @@ var ClientServicesHost = class {
|
|
|
5536
5660
|
deviceKey
|
|
5537
5661
|
}, {
|
|
5538
5662
|
F: __dxlog_file18,
|
|
5539
|
-
L:
|
|
5663
|
+
L: 336,
|
|
5540
5664
|
S: this,
|
|
5541
5665
|
C: (f, a) => f(...a)
|
|
5542
5666
|
});
|
|
5543
5667
|
}
|
|
5544
5668
|
async reset() {
|
|
5545
|
-
const traceId =
|
|
5546
|
-
import_log13.log.trace("dxos.sdk.client-services-host.reset",
|
|
5669
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
5670
|
+
import_log13.log.trace("dxos.sdk.client-services-host.reset", import_protocols13.trace.begin({
|
|
5547
5671
|
id: traceId
|
|
5548
5672
|
}), {
|
|
5549
5673
|
F: __dxlog_file18,
|
|
5550
|
-
L:
|
|
5674
|
+
L: 341,
|
|
5551
5675
|
S: this,
|
|
5552
5676
|
C: (f, a) => f(...a)
|
|
5553
5677
|
});
|
|
5554
5678
|
(0, import_log13.log)("resetting...", void 0, {
|
|
5555
5679
|
F: __dxlog_file18,
|
|
5556
|
-
L:
|
|
5680
|
+
L: 343,
|
|
5557
5681
|
S: this,
|
|
5558
5682
|
C: (f, a) => f(...a)
|
|
5559
5683
|
});
|
|
@@ -5561,15 +5685,15 @@ var ClientServicesHost = class {
|
|
|
5561
5685
|
await this._storage.reset();
|
|
5562
5686
|
(0, import_log13.log)("reset", void 0, {
|
|
5563
5687
|
F: __dxlog_file18,
|
|
5564
|
-
L:
|
|
5688
|
+
L: 346,
|
|
5565
5689
|
S: this,
|
|
5566
5690
|
C: (f, a) => f(...a)
|
|
5567
5691
|
});
|
|
5568
|
-
import_log13.log.trace("dxos.sdk.client-services-host.reset",
|
|
5692
|
+
import_log13.log.trace("dxos.sdk.client-services-host.reset", import_protocols13.trace.end({
|
|
5569
5693
|
id: traceId
|
|
5570
5694
|
}), {
|
|
5571
5695
|
F: __dxlog_file18,
|
|
5572
|
-
L:
|
|
5696
|
+
L: 347,
|
|
5573
5697
|
S: this,
|
|
5574
5698
|
C: (f, a) => f(...a)
|
|
5575
5699
|
});
|
|
@@ -5582,34 +5706,34 @@ var ClientServicesHost = class {
|
|
|
5582
5706
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5583
5707
|
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5584
5708
|
F: __dxlog_file18,
|
|
5585
|
-
L:
|
|
5709
|
+
L: 359,
|
|
5586
5710
|
S: this,
|
|
5587
5711
|
A: [
|
|
5588
5712
|
"automergeIndex",
|
|
5589
5713
|
""
|
|
5590
5714
|
]
|
|
5591
5715
|
});
|
|
5592
|
-
const document = await this._serviceContext.
|
|
5716
|
+
const document = await this._serviceContext.echoHost.automergeRepo.find(automergeIndex);
|
|
5593
5717
|
await document.whenReady();
|
|
5594
5718
|
const properties = {
|
|
5595
5719
|
system: {
|
|
5596
|
-
type: (0, import_echo_pipeline5.encodeReference)(
|
|
5720
|
+
type: (0, import_echo_pipeline5.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.Properties))
|
|
5597
5721
|
},
|
|
5598
5722
|
data: {
|
|
5599
|
-
[
|
|
5723
|
+
[import_client_protocol5.defaultKey]: identity.identityKey.toHex()
|
|
5600
5724
|
},
|
|
5601
5725
|
meta: {
|
|
5602
5726
|
keys: []
|
|
5603
5727
|
}
|
|
5604
5728
|
};
|
|
5605
|
-
const propertiesId =
|
|
5729
|
+
const propertiesId = import_keys12.PublicKey.random().toHex();
|
|
5606
5730
|
document.change((doc) => {
|
|
5607
5731
|
(0, import_util9.assignDeep)(doc, [
|
|
5608
5732
|
"objects",
|
|
5609
5733
|
propertiesId
|
|
5610
5734
|
], properties);
|
|
5611
5735
|
});
|
|
5612
|
-
await this._serviceContext.
|
|
5736
|
+
await this._serviceContext.echoHost.flush();
|
|
5613
5737
|
return identity;
|
|
5614
5738
|
}
|
|
5615
5739
|
};
|
|
@@ -5637,7 +5761,7 @@ var DiagnosticsCollector = class {
|
|
|
5637
5761
|
}
|
|
5638
5762
|
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
5639
5763
|
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
5640
|
-
keys: options.humanize ?
|
|
5764
|
+
keys: options.humanize ? import_services14.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services14.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
5641
5765
|
});
|
|
5642
5766
|
const clientDiagnostics = {
|
|
5643
5767
|
config,
|
|
@@ -5677,6 +5801,7 @@ var findConfigs = () => {
|
|
|
5677
5801
|
IdentityManager,
|
|
5678
5802
|
IdentityServiceImpl,
|
|
5679
5803
|
InvitationsHandler,
|
|
5804
|
+
InvitationsManager,
|
|
5680
5805
|
InvitationsServiceImpl,
|
|
5681
5806
|
Lock,
|
|
5682
5807
|
ServiceContext,
|
|
@@ -5684,6 +5809,7 @@ var findConfigs = () => {
|
|
|
5684
5809
|
SpaceInvitationProtocol,
|
|
5685
5810
|
SpacesServiceImpl,
|
|
5686
5811
|
TrustedKeySetAuthVerifier,
|
|
5812
|
+
createAdmissionKeypair,
|
|
5687
5813
|
createAuthProvider,
|
|
5688
5814
|
createCollectDiagnosticsBroadcastHandler,
|
|
5689
5815
|
createCollectDiagnosticsBroadcastSender,
|
|
@@ -5700,4 +5826,4 @@ var findConfigs = () => {
|
|
|
5700
5826
|
subscribeToSpaces,
|
|
5701
5827
|
subscribeToSwarmInfo
|
|
5702
5828
|
});
|
|
5703
|
-
//# sourceMappingURL=chunk-
|
|
5829
|
+
//# sourceMappingURL=chunk-JGUWA36I.cjs.map
|