@dxos/client-services 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8
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-27A4ATQX.mjs → chunk-Z6PWUKRZ.mjs} +364 -248
- package/dist/lib/browser/chunk-Z6PWUKRZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-7FKXMJDD.cjs → chunk-PK4NC3T7.cjs} +389 -273
- package/dist/lib/node/chunk-PK4NC3T7.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-HGN7FHFK.mjs → chunk-2FL5LYPQ.mjs} +364 -248
- package/dist/lib/node-esm/chunk-2FL5LYPQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +0 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +12 -4
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +9 -4
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +3 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts +1 -0
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +9 -2
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +3 -0
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -38
- package/src/packlets/agents/edge-agent-manager.ts +6 -0
- package/src/packlets/agents/edge-agent-service.ts +1 -1
- package/src/packlets/devices/devices-service.ts +1 -1
- package/src/packlets/devtools/devtools.ts +1 -1
- package/src/packlets/devtools/feeds.ts +1 -1
- package/src/packlets/devtools/keys.ts +1 -1
- package/src/packlets/devtools/metadata.ts +1 -1
- package/src/packlets/devtools/network.ts +1 -1
- package/src/packlets/devtools/spaces.ts +1 -1
- package/src/packlets/diagnostics/diagnostics-collector.ts +2 -2
- package/src/packlets/diagnostics/diagnostics.ts +17 -13
- package/src/packlets/identity/contacts-service.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +3 -29
- package/src/packlets/identity/identity-recovery-manager.ts +86 -9
- package/src/packlets/identity/identity-service.ts +17 -4
- package/src/packlets/identity/identity.test.ts +2 -1
- package/src/packlets/identity/identity.ts +4 -1
- package/src/packlets/invitations/invitations-handler.ts +15 -6
- package/src/packlets/invitations/invitations-manager.ts +1 -1
- package/src/packlets/invitations/invitations-service.ts +1 -1
- package/src/packlets/invitations/space-invitation-protocol.ts +2 -3
- package/src/packlets/invitations/utils.ts +7 -0
- package/src/packlets/logging/logging-service.ts +1 -1
- package/src/packlets/network/network-service.ts +39 -1
- package/src/packlets/services/service-context.ts +1 -0
- package/src/packlets/spaces/data-space-manager.ts +3 -3
- package/src/packlets/spaces/data-space.ts +2 -2
- package/src/packlets/spaces/edge-feed-replicator.ts +8 -8
- package/src/packlets/spaces/notarization-plugin.ts +32 -17
- package/src/packlets/spaces/spaces-service.ts +31 -21
- package/src/packlets/system/system-service.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-27A4ATQX.mjs.map +0 -7
- package/dist/lib/node/chunk-7FKXMJDD.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-HGN7FHFK.mjs.map +0 -7
|
@@ -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_PK4NC3T7_exports = {};
|
|
30
|
+
__export(chunk_PK4NC3T7_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,24 +72,24 @@ __export(chunk_7FKXMJDD_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_PK4NC3T7_exports);
|
|
76
76
|
var import_async = require("@dxos/async");
|
|
77
|
-
var
|
|
77
|
+
var import_stream = require("@dxos/codec-protobuf/stream");
|
|
78
78
|
var import_feed_store = require("@dxos/feed-store");
|
|
79
79
|
var import_keys = require("@dxos/keys");
|
|
80
80
|
var import_log = require("@dxos/log");
|
|
81
81
|
var import_util = require("@dxos/util");
|
|
82
|
-
var
|
|
82
|
+
var import_stream2 = require("@dxos/codec-protobuf/stream");
|
|
83
83
|
var import_context = require("@dxos/context");
|
|
84
84
|
var import_keys2 = require("@dxos/keys");
|
|
85
|
-
var
|
|
85
|
+
var import_stream3 = require("@dxos/codec-protobuf/stream");
|
|
86
86
|
var import_async2 = require("@dxos/async");
|
|
87
|
-
var
|
|
87
|
+
var import_stream4 = require("@dxos/codec-protobuf/stream");
|
|
88
88
|
var import_async3 = require("@dxos/async");
|
|
89
|
-
var
|
|
90
|
-
var
|
|
89
|
+
var import_stream5 = require("@dxos/codec-protobuf/stream");
|
|
90
|
+
var import_stream6 = require("@dxos/codec-protobuf/stream");
|
|
91
91
|
var import_async4 = require("@dxos/async");
|
|
92
|
-
var
|
|
92
|
+
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
93
93
|
var import_credentials = require("@dxos/credentials");
|
|
94
94
|
var import_invariant = require("@dxos/invariant");
|
|
95
95
|
var import_protocols = require("@dxos/protocols");
|
|
@@ -184,7 +184,7 @@ var import_debug2 = require("@dxos/debug");
|
|
|
184
184
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
185
185
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
186
186
|
var import_async12 = require("@dxos/async");
|
|
187
|
-
var
|
|
187
|
+
var import_stream7 = require("@dxos/codec-protobuf/stream");
|
|
188
188
|
var import_credentials13 = require("@dxos/credentials");
|
|
189
189
|
var import_debug3 = require("@dxos/debug");
|
|
190
190
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
@@ -208,7 +208,7 @@ var import_timeframe4 = require("@dxos/timeframe");
|
|
|
208
208
|
var import_tracing7 = require("@dxos/tracing");
|
|
209
209
|
var import_util8 = require("@dxos/util");
|
|
210
210
|
var import_async14 = require("@dxos/async");
|
|
211
|
-
var
|
|
211
|
+
var import_stream8 = require("@dxos/codec-protobuf/stream");
|
|
212
212
|
var import_context9 = require("@dxos/context");
|
|
213
213
|
var import_credentials16 = require("@dxos/credentials");
|
|
214
214
|
var import_invariant10 = require("@dxos/invariant");
|
|
@@ -270,7 +270,7 @@ var import_keys13 = require("@dxos/keys");
|
|
|
270
270
|
var import_log17 = require("@dxos/log");
|
|
271
271
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
272
272
|
var import_util11 = require("@dxos/util");
|
|
273
|
-
var
|
|
273
|
+
var import_stream9 = require("@dxos/codec-protobuf/stream");
|
|
274
274
|
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
275
275
|
var import_tracing9 = require("@dxos/tracing");
|
|
276
276
|
var import_credentials18 = require("@dxos/credentials");
|
|
@@ -293,7 +293,7 @@ var import_credentials21 = require("@dxos/protocols/proto/dxos/halo/credentials"
|
|
|
293
293
|
var import_invariant19 = require("@dxos/invariant");
|
|
294
294
|
var import_lock_file = require("@dxos/lock-file");
|
|
295
295
|
var import_log20 = require("@dxos/log");
|
|
296
|
-
var
|
|
296
|
+
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
297
297
|
var import_debug4 = require("@dxos/debug");
|
|
298
298
|
var import_rpc = require("@dxos/rpc");
|
|
299
299
|
var import_tracing10 = require("@dxos/tracing");
|
|
@@ -305,7 +305,7 @@ var import_log21 = require("@dxos/log");
|
|
|
305
305
|
var import_protocols14 = require("@dxos/protocols");
|
|
306
306
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
307
307
|
var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
308
|
-
var
|
|
308
|
+
var import_stream10 = require("@dxos/codec-protobuf/stream");
|
|
309
309
|
var import_protocols15 = require("@dxos/protocols");
|
|
310
310
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
311
311
|
var import_async22 = require("@dxos/async");
|
|
@@ -360,26 +360,26 @@ var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
360
360
|
var import_tracing12 = require("@dxos/tracing");
|
|
361
361
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
362
362
|
var import_async24 = require("@dxos/async");
|
|
363
|
-
var
|
|
363
|
+
var import_stream11 = require("@dxos/codec-protobuf/stream");
|
|
364
364
|
var import_invariant25 = require("@dxos/invariant");
|
|
365
365
|
var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
|
|
366
366
|
var import_async25 = require("@dxos/async");
|
|
367
|
-
var
|
|
367
|
+
var import_stream12 = require("@dxos/codec-protobuf/stream");
|
|
368
368
|
var import_keys20 = require("@dxos/keys");
|
|
369
369
|
var import_util15 = require("@dxos/util");
|
|
370
370
|
var import_async26 = require("@dxos/async");
|
|
371
|
-
var
|
|
371
|
+
var import_stream13 = require("@dxos/codec-protobuf/stream");
|
|
372
372
|
var import_keys21 = require("@dxos/keys");
|
|
373
373
|
var import_log26 = require("@dxos/log");
|
|
374
374
|
var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
|
|
375
375
|
var import_util16 = require("@dxos/util");
|
|
376
|
-
var
|
|
377
|
-
var
|
|
376
|
+
var import_stream14 = require("@dxos/codec-protobuf/stream");
|
|
377
|
+
var import_stream15 = require("@dxos/codec-protobuf/stream");
|
|
378
378
|
var import_services25 = require("@dxos/protocols/proto/dxos/client/services");
|
|
379
379
|
var import_util17 = require("@dxos/util");
|
|
380
380
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
|
|
381
381
|
var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
|
|
382
|
-
return new
|
|
382
|
+
return new import_stream.Stream(({ next }) => {
|
|
383
383
|
const subscriptions = new import_async.EventSubscriptions();
|
|
384
384
|
const feedMap = new import_util.ComplexMap(import_keys.PublicKey.hash);
|
|
385
385
|
const update = () => {
|
|
@@ -438,7 +438,7 @@ var findFeedOwner = (spaceManager, feedKey) => {
|
|
|
438
438
|
};
|
|
439
439
|
};
|
|
440
440
|
var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
441
|
-
return new
|
|
441
|
+
return new import_stream.Stream(({ next }) => {
|
|
442
442
|
if (!feedKey) {
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
@@ -482,7 +482,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
482
482
|
});
|
|
483
483
|
};
|
|
484
484
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
485
|
-
var subscribeToNetworkStatus = ({ signalManager }) => new
|
|
485
|
+
var subscribeToNetworkStatus = ({ signalManager }) => new import_stream2.Stream(({ next, close }) => {
|
|
486
486
|
const update = () => {
|
|
487
487
|
try {
|
|
488
488
|
const status = signalManager.getStatus?.();
|
|
@@ -496,7 +496,7 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
496
496
|
signalManager.statusChanged?.on(() => update());
|
|
497
497
|
update();
|
|
498
498
|
});
|
|
499
|
-
var subscribeToSignal = ({ signalManager }) => new
|
|
499
|
+
var subscribeToSignal = ({ signalManager }) => new import_stream2.Stream(({ next }) => {
|
|
500
500
|
const ctx = new import_context.Context(void 0, {
|
|
501
501
|
F: __dxlog_file2,
|
|
502
502
|
L: 36
|
|
@@ -531,7 +531,7 @@ var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream
|
|
|
531
531
|
return ctx.dispose();
|
|
532
532
|
};
|
|
533
533
|
});
|
|
534
|
-
var subscribeToNetworkTopics = ({ networkManager }) => new
|
|
534
|
+
var subscribeToNetworkTopics = ({ networkManager }) => new import_stream2.Stream(({ next, close }) => {
|
|
535
535
|
const update = () => {
|
|
536
536
|
try {
|
|
537
537
|
const topics = networkManager.topics;
|
|
@@ -549,7 +549,7 @@ var subscribeToNetworkTopics = ({ networkManager }) => new import_codec_protobuf
|
|
|
549
549
|
networkManager.topicsUpdated.on(update);
|
|
550
550
|
update();
|
|
551
551
|
});
|
|
552
|
-
var subscribeToSwarmInfo = ({ networkManager }) => new
|
|
552
|
+
var subscribeToSwarmInfo = ({ networkManager }) => new import_stream2.Stream(({ next }) => {
|
|
553
553
|
const update = () => {
|
|
554
554
|
const info = networkManager.connectionLog?.swarms;
|
|
555
555
|
if (info) {
|
|
@@ -574,7 +574,7 @@ var getNetworkPeers = ({ networkManager }, request) => {
|
|
|
574
574
|
};
|
|
575
575
|
};
|
|
576
576
|
var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
577
|
-
return new
|
|
577
|
+
return new import_stream3.Stream(({ next }) => {
|
|
578
578
|
let unsubscribe;
|
|
579
579
|
const update = async () => {
|
|
580
580
|
const spaces = [
|
|
@@ -606,7 +606,7 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
|
606
606
|
};
|
|
607
607
|
});
|
|
608
608
|
};
|
|
609
|
-
var subscribeToKeyringKeys = ({ keyring }) => new
|
|
609
|
+
var subscribeToKeyringKeys = ({ keyring }) => new import_stream5.Stream(({ next, ctx }) => {
|
|
610
610
|
const update = async () => {
|
|
611
611
|
next({
|
|
612
612
|
keys: await keyring.list()
|
|
@@ -615,7 +615,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf5.Stream(
|
|
|
615
615
|
keyring.keysUpdate.on(ctx, update);
|
|
616
616
|
(0, import_async3.scheduleTask)(ctx, update);
|
|
617
617
|
});
|
|
618
|
-
var subscribeToMetadata = ({ context }) => new
|
|
618
|
+
var subscribeToMetadata = ({ context }) => new import_stream6.Stream(({ next, ctx }) => {
|
|
619
619
|
context.metadataStore.update.on(ctx, (data) => next({
|
|
620
620
|
metadata: data
|
|
621
621
|
}));
|
|
@@ -633,7 +633,7 @@ var DevtoolsServiceImpl = class {
|
|
|
633
633
|
this.params = params;
|
|
634
634
|
}
|
|
635
635
|
events(request) {
|
|
636
|
-
return new
|
|
636
|
+
return new import_stream4.Stream(({ next }) => {
|
|
637
637
|
this.params.events.ready.on(() => {
|
|
638
638
|
next({
|
|
639
639
|
ready: {}
|
|
@@ -735,7 +735,7 @@ var DevtoolsServiceImpl = class {
|
|
|
735
735
|
});
|
|
736
736
|
}
|
|
737
737
|
};
|
|
738
|
-
var DXOS_VERSION = "0.7.5-main.
|
|
738
|
+
var DXOS_VERSION = "0.7.5-main.b19bfc8";
|
|
739
739
|
var getPlatform = () => {
|
|
740
740
|
if (process.browser) {
|
|
741
741
|
if (typeof window !== "undefined") {
|
|
@@ -788,7 +788,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
788
788
|
"'SystemService is not available.'"
|
|
789
789
|
]
|
|
790
790
|
});
|
|
791
|
-
diagnostics.metrics = await (0,
|
|
791
|
+
diagnostics.metrics = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
|
|
792
792
|
timeout: DEFAULT_TIMEOUT
|
|
793
793
|
}).catch(() => void 0);
|
|
794
794
|
})(),
|
|
@@ -799,18 +799,19 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
799
799
|
const identity = serviceContext.identityManager.identity;
|
|
800
800
|
if (identity) {
|
|
801
801
|
diagnostics.identity = {
|
|
802
|
+
did: identity.did,
|
|
802
803
|
identityKey: identity.identityKey,
|
|
803
804
|
spaceKey: identity.space.key,
|
|
804
805
|
profile: identity.profileDocument
|
|
805
806
|
};
|
|
806
|
-
const { devices } = await (0,
|
|
807
|
+
const { devices } = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
|
|
807
808
|
timeout: DEFAULT_TIMEOUT
|
|
808
809
|
}).catch(() => void 0) ?? {};
|
|
809
810
|
diagnostics.devices = devices;
|
|
810
811
|
if (serviceContext.dataSpaceManager) {
|
|
811
812
|
diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
|
|
812
813
|
}
|
|
813
|
-
const { feeds = [] } = await (0,
|
|
814
|
+
const { feeds = [] } = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
|
|
814
815
|
timeout: DEFAULT_TIMEOUT
|
|
815
816
|
}).catch(() => void 0) ?? {};
|
|
816
817
|
diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
|
|
@@ -818,7 +819,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
818
819
|
bytes,
|
|
819
820
|
length
|
|
820
821
|
}));
|
|
821
|
-
const status = await (0,
|
|
822
|
+
const status = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
822
823
|
timeout: DEFAULT_TIMEOUT
|
|
823
824
|
}).catch(() => void 0);
|
|
824
825
|
diagnostics.networkStatus = status;
|
|
@@ -837,16 +838,17 @@ var getSpaceStats = async (space) => {
|
|
|
837
838
|
...credential.subject.assertion,
|
|
838
839
|
id: credential.id
|
|
839
840
|
})),
|
|
840
|
-
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
841
|
+
members: await Promise.all(Array.from(space.inner.spaceState.members.values()).map(async (member) => ({
|
|
841
842
|
role: member.role,
|
|
842
843
|
identity: {
|
|
844
|
+
did: await (0, import_credentials.createDidFromIdentityKey)(member.key),
|
|
843
845
|
identityKey: member.key,
|
|
844
846
|
profile: {
|
|
845
847
|
displayName: member.assertion.profile?.displayName
|
|
846
848
|
}
|
|
847
849
|
},
|
|
848
850
|
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services.SpaceMember.PresenceState.ONLINE : import_services.SpaceMember.PresenceState.OFFLINE
|
|
849
|
-
})),
|
|
851
|
+
}))),
|
|
850
852
|
pipeline: {
|
|
851
853
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
852
854
|
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
@@ -926,7 +928,7 @@ var findSystemServiceProvider = () => {
|
|
|
926
928
|
};
|
|
927
929
|
var findConfigs = () => {
|
|
928
930
|
const configs = import_tracing2.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
|
|
929
|
-
return configs.map((r) => r.instance.deref()).filter(import_util2.
|
|
931
|
+
return configs.map((r) => r.instance.deref()).filter(import_util2.isNonNullable);
|
|
930
932
|
};
|
|
931
933
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
932
934
|
var Credential = import_proto.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
@@ -1211,7 +1213,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1211
1213
|
this._remoteLength.clear();
|
|
1212
1214
|
}
|
|
1213
1215
|
async addFeed(feed) {
|
|
1214
|
-
import_log3.log
|
|
1216
|
+
(0, import_log3.log)("addFeed", {
|
|
1215
1217
|
key: feed.key,
|
|
1216
1218
|
connected: this._connected,
|
|
1217
1219
|
hasConnectionCtx: !!this._connectionCtx
|
|
@@ -1248,7 +1250,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1248
1250
|
}
|
|
1249
1251
|
async _sendMessage(message) {
|
|
1250
1252
|
if (!this._connectionCtx) {
|
|
1251
|
-
import_log3.log
|
|
1253
|
+
(0, import_log3.log)("message dropped because connection was disposed", void 0, {
|
|
1252
1254
|
F: __dxlog_file5,
|
|
1253
1255
|
L: 146,
|
|
1254
1256
|
S: this,
|
|
@@ -1257,7 +1259,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1257
1259
|
return;
|
|
1258
1260
|
}
|
|
1259
1261
|
if (message.type === "data") {
|
|
1260
|
-
import_log3.log
|
|
1262
|
+
(0, import_log3.log)("sending blocks", {
|
|
1261
1263
|
feedKey: message.feedKey,
|
|
1262
1264
|
blocks: message.blocks.map((b) => b.index)
|
|
1263
1265
|
}, {
|
|
@@ -1332,7 +1334,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1332
1334
|
feedKey
|
|
1333
1335
|
};
|
|
1334
1336
|
if (message.length > feed.length) {
|
|
1335
|
-
import_log3.log
|
|
1337
|
+
(0, import_log3.log)("requesting missing blocks", logMeta, {
|
|
1336
1338
|
F: __dxlog_file5,
|
|
1337
1339
|
L: 194,
|
|
1338
1340
|
S: this,
|
|
@@ -1347,7 +1349,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1347
1349
|
}
|
|
1348
1350
|
});
|
|
1349
1351
|
} else if (message.length < feed.length) {
|
|
1350
|
-
import_log3.log
|
|
1352
|
+
(0, import_log3.log)("pushing blocks to remote", logMeta, {
|
|
1351
1353
|
F: __dxlog_file5,
|
|
1352
1354
|
L: 202,
|
|
1353
1355
|
S: this,
|
|
@@ -1363,7 +1365,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1363
1365
|
}
|
|
1364
1366
|
}
|
|
1365
1367
|
case "data": {
|
|
1366
|
-
import_log3.log
|
|
1368
|
+
(0, import_log3.log)("received data", {
|
|
1367
1369
|
feed: message.feedKey,
|
|
1368
1370
|
blocks: message.blocks.map((b) => b.index)
|
|
1369
1371
|
}, {
|
|
@@ -1402,7 +1404,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1402
1404
|
});
|
|
1403
1405
|
}
|
|
1404
1406
|
async _pushBlocks(feed, from, to) {
|
|
1405
|
-
import_log3.log
|
|
1407
|
+
(0, import_log3.log)("pushing blocks", {
|
|
1406
1408
|
feed: feed.key.toHex(),
|
|
1407
1409
|
from,
|
|
1408
1410
|
to
|
|
@@ -1441,7 +1443,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1441
1443
|
this._remoteLength.set(feed.key, to);
|
|
1442
1444
|
}
|
|
1443
1445
|
async _integrateBlocks(feed, blocks) {
|
|
1444
|
-
import_log3.log
|
|
1446
|
+
(0, import_log3.log)("integrating blocks", {
|
|
1445
1447
|
feed: feed.key.toHex(),
|
|
1446
1448
|
blocks: blocks.length
|
|
1447
1449
|
}, {
|
|
@@ -1633,6 +1635,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1633
1635
|
this._processedCredentials = new import_util5.ComplexSet(import_keys5.PublicKey.hash);
|
|
1634
1636
|
this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys5.PublicKey.hash);
|
|
1635
1637
|
this._activeEdgePollingIntervalHandle = void 0;
|
|
1638
|
+
this._activeEdgePollingEnabled = false;
|
|
1636
1639
|
this._spaceId = params.spaceId;
|
|
1637
1640
|
this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
|
|
1638
1641
|
if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
|
|
@@ -1640,15 +1643,6 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1640
1643
|
}
|
|
1641
1644
|
}
|
|
1642
1645
|
setActiveEdgePollingEnabled(enabled) {
|
|
1643
|
-
(0, import_invariant5.invariant)(this.isOpen, void 0, {
|
|
1644
|
-
F: __dxlog_file7,
|
|
1645
|
-
L: 109,
|
|
1646
|
-
S: this,
|
|
1647
|
-
A: [
|
|
1648
|
-
"this.isOpen",
|
|
1649
|
-
""
|
|
1650
|
-
]
|
|
1651
|
-
});
|
|
1652
1646
|
const client = this._edgeClient;
|
|
1653
1647
|
(0, import_invariant5.invariant)(client, void 0, {
|
|
1654
1648
|
F: __dxlog_file7,
|
|
@@ -1659,30 +1653,30 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1659
1653
|
""
|
|
1660
1654
|
]
|
|
1661
1655
|
});
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1670
|
-
this._activeEdgePollingIntervalHandle = void 0;
|
|
1656
|
+
this._activeEdgePollingEnabled = enabled;
|
|
1657
|
+
if (this.isOpen) {
|
|
1658
|
+
if (enabled && !this._activeEdgePollingIntervalHandle) {
|
|
1659
|
+
this._startPeriodicEdgePolling(client);
|
|
1660
|
+
} else if (!enabled && this._activeEdgePollingIntervalHandle) {
|
|
1661
|
+
this._stopPeriodicEdgePolling();
|
|
1662
|
+
}
|
|
1671
1663
|
}
|
|
1672
1664
|
}
|
|
1673
1665
|
get hasWriter() {
|
|
1674
1666
|
return !!this._writer;
|
|
1675
1667
|
}
|
|
1676
1668
|
async _open() {
|
|
1677
|
-
if (this._edgeClient
|
|
1678
|
-
|
|
1669
|
+
if (this._edgeClient) {
|
|
1670
|
+
if (this._activeEdgePollingEnabled) {
|
|
1671
|
+
this._startPeriodicEdgePolling(this._edgeClient);
|
|
1672
|
+
}
|
|
1673
|
+
if (this._writer) {
|
|
1674
|
+
this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
|
|
1675
|
+
}
|
|
1679
1676
|
}
|
|
1680
1677
|
}
|
|
1681
1678
|
async _close() {
|
|
1682
|
-
|
|
1683
|
-
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1684
|
-
this._activeEdgePollingIntervalHandle = void 0;
|
|
1685
|
-
}
|
|
1679
|
+
this._stopPeriodicEdgePolling();
|
|
1686
1680
|
await this._ctx.dispose();
|
|
1687
1681
|
}
|
|
1688
1682
|
/**
|
|
@@ -1860,10 +1854,23 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1860
1854
|
]
|
|
1861
1855
|
});
|
|
1862
1856
|
this._writer = writer;
|
|
1863
|
-
if (this._edgeClient) {
|
|
1857
|
+
if (this._edgeClient && this.isOpen) {
|
|
1864
1858
|
this._notarizePendingEdgeCredentials(this._edgeClient, writer);
|
|
1865
1859
|
}
|
|
1866
1860
|
}
|
|
1861
|
+
_startPeriodicEdgePolling(client) {
|
|
1862
|
+
this._activeEdgePollingIntervalHandle = setInterval(() => {
|
|
1863
|
+
if (this._writer) {
|
|
1864
|
+
this._notarizePendingEdgeCredentials(client, this._writer);
|
|
1865
|
+
}
|
|
1866
|
+
}, this._activeEdgePollingInterval);
|
|
1867
|
+
}
|
|
1868
|
+
_stopPeriodicEdgePolling() {
|
|
1869
|
+
if (this._activeEdgePollingIntervalHandle) {
|
|
1870
|
+
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1871
|
+
this._activeEdgePollingIntervalHandle = void 0;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1867
1874
|
/**
|
|
1868
1875
|
* The method is used only for adding agent feeds to spaces.
|
|
1869
1876
|
* When an agent is created we can admit them into all the existing spaces. In case the operation fails
|
|
@@ -1882,7 +1889,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1882
1889
|
if (!credentials.length) {
|
|
1883
1890
|
(0, import_log5.log)("edge did not return credentials for notarization", void 0, {
|
|
1884
1891
|
F: __dxlog_file7,
|
|
1885
|
-
L:
|
|
1892
|
+
L: 311,
|
|
1886
1893
|
S: this,
|
|
1887
1894
|
C: (f, a) => f(...a)
|
|
1888
1895
|
});
|
|
@@ -1892,7 +1899,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1892
1899
|
count: credentials.length
|
|
1893
1900
|
}, {
|
|
1894
1901
|
F: __dxlog_file7,
|
|
1895
|
-
L:
|
|
1902
|
+
L: 315,
|
|
1896
1903
|
S: this,
|
|
1897
1904
|
C: (f, a) => f(...a)
|
|
1898
1905
|
});
|
|
@@ -1905,7 +1912,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1905
1912
|
count: decodedCredentials.length
|
|
1906
1913
|
}, {
|
|
1907
1914
|
F: __dxlog_file7,
|
|
1908
|
-
L:
|
|
1915
|
+
L: 324,
|
|
1909
1916
|
S: this,
|
|
1910
1917
|
C: (f, a) => f(...a)
|
|
1911
1918
|
});
|
|
@@ -1933,7 +1940,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1933
1940
|
for (const credential of credentials) {
|
|
1934
1941
|
(0, import_invariant5.invariant)(credential.id, "Credential must have an id", {
|
|
1935
1942
|
F: __dxlog_file7,
|
|
1936
|
-
L:
|
|
1943
|
+
L: 350,
|
|
1937
1944
|
S: this,
|
|
1938
1945
|
A: [
|
|
1939
1946
|
"credential.id",
|
|
@@ -1957,7 +1964,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1957
1964
|
peer: extension.localPeerId
|
|
1958
1965
|
}, {
|
|
1959
1966
|
F: __dxlog_file7,
|
|
1960
|
-
L:
|
|
1967
|
+
L: 365,
|
|
1961
1968
|
S: this,
|
|
1962
1969
|
C: (f, a) => f(...a)
|
|
1963
1970
|
});
|
|
@@ -1969,7 +1976,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1969
1976
|
peer: extension.localPeerId
|
|
1970
1977
|
}, {
|
|
1971
1978
|
F: __dxlog_file7,
|
|
1972
|
-
L:
|
|
1979
|
+
L: 370,
|
|
1973
1980
|
S: this,
|
|
1974
1981
|
C: (f, a) => f(...a)
|
|
1975
1982
|
});
|
|
@@ -1986,7 +1993,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1986
1993
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1987
1994
|
}, {
|
|
1988
1995
|
F: __dxlog_file7,
|
|
1989
|
-
L:
|
|
1996
|
+
L: 382,
|
|
1990
1997
|
S: this,
|
|
1991
1998
|
C: (f, a) => f(...a)
|
|
1992
1999
|
});
|
|
@@ -2002,7 +2009,7 @@ var handleEdgeError = (error) => {
|
|
|
2002
2009
|
if (!(error instanceof import_protocols4.EdgeCallFailedError) || error.errorData) {
|
|
2003
2010
|
import_log5.log.catch(error, void 0, {
|
|
2004
2011
|
F: __dxlog_file7,
|
|
2005
|
-
L:
|
|
2012
|
+
L: 396,
|
|
2006
2013
|
S: void 0,
|
|
2007
2014
|
C: (f, a) => f(...a)
|
|
2008
2015
|
});
|
|
@@ -2011,7 +2018,7 @@ var handleEdgeError = (error) => {
|
|
|
2011
2018
|
reason: error.reason
|
|
2012
2019
|
}, {
|
|
2013
2020
|
F: __dxlog_file7,
|
|
2014
|
-
L:
|
|
2021
|
+
L: 398,
|
|
2015
2022
|
S: void 0,
|
|
2016
2023
|
C: (f, a) => f(...a)
|
|
2017
2024
|
});
|
|
@@ -2659,7 +2666,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2659
2666
|
});
|
|
2660
2667
|
dataSpace.postOpen.append(async () => {
|
|
2661
2668
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2662
|
-
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2669
|
+
if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2663
2670
|
await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
|
|
2664
2671
|
} else if (this._echoEdgeReplicator) {
|
|
2665
2672
|
(0, import_log8.log)("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
|
|
@@ -2674,7 +2681,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2674
2681
|
});
|
|
2675
2682
|
dataSpace.preClose.append(async () => {
|
|
2676
2683
|
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2677
|
-
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2684
|
+
if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2678
2685
|
await this._echoEdgeReplicator?.disconnectFromSpace(dataSpace.id);
|
|
2679
2686
|
}
|
|
2680
2687
|
});
|
|
@@ -2779,7 +2786,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2779
2786
|
guestKeypair: invitation.guestKey ? {
|
|
2780
2787
|
publicKey: invitation.guestKey
|
|
2781
2788
|
} : void 0,
|
|
2782
|
-
lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
|
|
2789
|
+
lifetime: invitation.expiresOn ? (invitation.expiresOn.getTime() - Date.now()) / 1e3 : void 0,
|
|
2783
2790
|
multiUse: invitation.multiUse,
|
|
2784
2791
|
delegationCredentialId: credentialId,
|
|
2785
2792
|
persistent: false
|
|
@@ -2851,7 +2858,7 @@ var SpacesServiceImpl = class {
|
|
|
2851
2858
|
const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2852
2859
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2853
2860
|
F: __dxlog_file10,
|
|
2854
|
-
L:
|
|
2861
|
+
L: 111,
|
|
2855
2862
|
S: this,
|
|
2856
2863
|
A: [
|
|
2857
2864
|
"credentials[0].credential",
|
|
@@ -2861,7 +2868,7 @@ var SpacesServiceImpl = class {
|
|
|
2861
2868
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2862
2869
|
(0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2863
2870
|
F: __dxlog_file10,
|
|
2864
|
-
L:
|
|
2871
|
+
L: 113,
|
|
2865
2872
|
S: this,
|
|
2866
2873
|
A: [
|
|
2867
2874
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2871,15 +2878,15 @@ var SpacesServiceImpl = class {
|
|
|
2871
2878
|
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
2872
2879
|
}
|
|
2873
2880
|
querySpaces() {
|
|
2874
|
-
return new
|
|
2881
|
+
return new import_stream7.Stream(({ next, ctx }) => {
|
|
2875
2882
|
const scheduler = new import_async12.UpdateScheduler(ctx, async () => {
|
|
2876
2883
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2877
|
-
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
2884
|
+
const spaces = await Promise.all(Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space)));
|
|
2878
2885
|
(0, import_log9.log)("update", () => ({
|
|
2879
2886
|
ids: spaces.map((space) => space.id)
|
|
2880
2887
|
}), {
|
|
2881
2888
|
F: __dxlog_file10,
|
|
2882
|
-
L:
|
|
2889
|
+
L: 126,
|
|
2883
2890
|
S: this,
|
|
2884
2891
|
C: (f, a) => f(...a)
|
|
2885
2892
|
});
|
|
@@ -2931,7 +2938,7 @@ var SpacesServiceImpl = class {
|
|
|
2931
2938
|
await space.postMessage(getChannelId(channel), message);
|
|
2932
2939
|
}
|
|
2933
2940
|
subscribeMessages({ spaceKey, channel }) {
|
|
2934
|
-
return new
|
|
2941
|
+
return new import_stream7.Stream(({ ctx, next }) => {
|
|
2935
2942
|
(0, import_async12.scheduleTask)(ctx, async () => {
|
|
2936
2943
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2937
2944
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
@@ -2943,7 +2950,7 @@ var SpacesServiceImpl = class {
|
|
|
2943
2950
|
});
|
|
2944
2951
|
}
|
|
2945
2952
|
queryCredentials({ spaceKey, noTail }) {
|
|
2946
|
-
return new
|
|
2953
|
+
return new import_stream7.Stream(({ ctx, next, close }) => {
|
|
2947
2954
|
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
2948
2955
|
const processor = {
|
|
2949
2956
|
processCredential: async (credential) => {
|
|
@@ -2971,7 +2978,7 @@ var SpacesServiceImpl = class {
|
|
|
2971
2978
|
} else {
|
|
2972
2979
|
(0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2973
2980
|
F: __dxlog_file10,
|
|
2974
|
-
L:
|
|
2981
|
+
L: 224,
|
|
2975
2982
|
S: this,
|
|
2976
2983
|
A: [
|
|
2977
2984
|
"!credential.id",
|
|
@@ -2980,7 +2987,7 @@ var SpacesServiceImpl = class {
|
|
|
2980
2987
|
});
|
|
2981
2988
|
(0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
2982
2989
|
F: __dxlog_file10,
|
|
2983
|
-
L:
|
|
2990
|
+
L: 225,
|
|
2984
2991
|
S: this,
|
|
2985
2992
|
A: [
|
|
2986
2993
|
"this._identityManager.identity",
|
|
@@ -2990,7 +2997,7 @@ var SpacesServiceImpl = class {
|
|
|
2990
2997
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2991
2998
|
(0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2992
2999
|
F: __dxlog_file10,
|
|
2993
|
-
L:
|
|
3000
|
+
L: 227,
|
|
2994
3001
|
S: this,
|
|
2995
3002
|
A: [
|
|
2996
3003
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -3040,7 +3047,7 @@ var SpacesServiceImpl = class {
|
|
|
3040
3047
|
const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
|
|
3041
3048
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3042
3049
|
F: __dxlog_file10,
|
|
3043
|
-
L:
|
|
3050
|
+
L: 261,
|
|
3044
3051
|
S: this,
|
|
3045
3052
|
A: [
|
|
3046
3053
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3050,7 +3057,7 @@ var SpacesServiceImpl = class {
|
|
|
3050
3057
|
const myIdentity = this._identityManager.identity;
|
|
3051
3058
|
(0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
3052
3059
|
F: __dxlog_file10,
|
|
3053
|
-
L:
|
|
3060
|
+
L: 263,
|
|
3054
3061
|
S: this,
|
|
3055
3062
|
A: [
|
|
3056
3063
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -3071,10 +3078,10 @@ var SpacesServiceImpl = class {
|
|
|
3071
3078
|
});
|
|
3072
3079
|
}
|
|
3073
3080
|
return {
|
|
3074
|
-
space: this._serializeSpace(dataSpace)
|
|
3081
|
+
space: await this._serializeSpace(dataSpace)
|
|
3075
3082
|
};
|
|
3076
3083
|
}
|
|
3077
|
-
_serializeSpace(space) {
|
|
3084
|
+
async _serializeSpace(space) {
|
|
3078
3085
|
return {
|
|
3079
3086
|
id: space.id,
|
|
3080
3087
|
spaceKey: space.key,
|
|
@@ -3094,7 +3101,7 @@ var SpacesServiceImpl = class {
|
|
|
3094
3101
|
totalDataTimeframe: void 0,
|
|
3095
3102
|
spaceRootUrl: space.databaseRoot?.url
|
|
3096
3103
|
},
|
|
3097
|
-
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3104
|
+
members: await Promise.all(Array.from(space.inner.spaceState.members.values()).map(async (member) => {
|
|
3098
3105
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
3099
3106
|
const isMe = this._identityManager.identity?.identityKey.equals(member.key);
|
|
3100
3107
|
if (isMe) {
|
|
@@ -3102,6 +3109,7 @@ var SpacesServiceImpl = class {
|
|
|
3102
3109
|
}
|
|
3103
3110
|
return {
|
|
3104
3111
|
identity: {
|
|
3112
|
+
did: await (0, import_credentials13.createDidFromIdentityKey)(member.key),
|
|
3105
3113
|
identityKey: member.key,
|
|
3106
3114
|
profile: member.profile ?? {}
|
|
3107
3115
|
},
|
|
@@ -3109,7 +3117,7 @@ var SpacesServiceImpl = class {
|
|
|
3109
3117
|
presence: peers.length > 0 ? import_services7.SpaceMember.PresenceState.ONLINE : import_services7.SpaceMember.PresenceState.OFFLINE,
|
|
3110
3118
|
peerStates: peers
|
|
3111
3119
|
};
|
|
3112
|
-
}),
|
|
3120
|
+
})),
|
|
3113
3121
|
creator: space.inner.spaceState.creator?.key,
|
|
3114
3122
|
cache: space.cache,
|
|
3115
3123
|
metrics: space.metrics,
|
|
@@ -3152,13 +3160,14 @@ var Identity = class {
|
|
|
3152
3160
|
this.space = params.space;
|
|
3153
3161
|
this._signer = params.signer;
|
|
3154
3162
|
this._presence = params.presence;
|
|
3163
|
+
this.did = params.did;
|
|
3155
3164
|
this.identityKey = params.identityKey;
|
|
3156
3165
|
this.deviceKey = params.deviceKey;
|
|
3157
3166
|
import_log6.log.trace("dxos.halo.device", {
|
|
3158
3167
|
deviceKey: params.deviceKey
|
|
3159
3168
|
}, {
|
|
3160
3169
|
F: __dxlog_file11,
|
|
3161
|
-
L:
|
|
3170
|
+
L: 82,
|
|
3162
3171
|
S: this,
|
|
3163
3172
|
C: (f, a) => f(...a)
|
|
3164
3173
|
});
|
|
@@ -3260,7 +3269,7 @@ var Identity = class {
|
|
|
3260
3269
|
getIdentityCredentialSigner() {
|
|
3261
3270
|
(0, import_invariant6.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
3262
3271
|
F: __dxlog_file11,
|
|
3263
|
-
L:
|
|
3272
|
+
L: 198,
|
|
3264
3273
|
S: this,
|
|
3265
3274
|
A: [
|
|
3266
3275
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -3304,7 +3313,7 @@ var Identity = class {
|
|
|
3304
3313
|
dataFeedKey
|
|
3305
3314
|
}, {
|
|
3306
3315
|
F: __dxlog_file11,
|
|
3307
|
-
L:
|
|
3316
|
+
L: 223,
|
|
3308
3317
|
S: this,
|
|
3309
3318
|
C: (f, a) => f(...a)
|
|
3310
3319
|
});
|
|
@@ -3387,7 +3396,7 @@ var IdentityManager = class {
|
|
|
3387
3396
|
id: traceId
|
|
3388
3397
|
}), {
|
|
3389
3398
|
F: __dxlog_file12,
|
|
3390
|
-
L:
|
|
3399
|
+
L: 116,
|
|
3391
3400
|
S: this,
|
|
3392
3401
|
C: (f, a) => f(...a)
|
|
3393
3402
|
});
|
|
@@ -3396,7 +3405,7 @@ var IdentityManager = class {
|
|
|
3396
3405
|
identityRecord
|
|
3397
3406
|
}, {
|
|
3398
3407
|
F: __dxlog_file12,
|
|
3399
|
-
L:
|
|
3408
|
+
L: 119,
|
|
3400
3409
|
S: this,
|
|
3401
3410
|
C: (f, a) => f(...a)
|
|
3402
3411
|
});
|
|
@@ -3409,7 +3418,7 @@ var IdentityManager = class {
|
|
|
3409
3418
|
displayName: this._identity.profileDocument?.displayName
|
|
3410
3419
|
}, {
|
|
3411
3420
|
F: __dxlog_file12,
|
|
3412
|
-
L:
|
|
3421
|
+
L: 124,
|
|
3413
3422
|
S: this,
|
|
3414
3423
|
C: (f, a) => f(...a)
|
|
3415
3424
|
});
|
|
@@ -3419,7 +3428,7 @@ var IdentityManager = class {
|
|
|
3419
3428
|
id: traceId
|
|
3420
3429
|
}), {
|
|
3421
3430
|
F: __dxlog_file12,
|
|
3422
|
-
L:
|
|
3431
|
+
L: 131,
|
|
3423
3432
|
S: this,
|
|
3424
3433
|
C: (f, a) => f(...a)
|
|
3425
3434
|
});
|
|
@@ -3427,13 +3436,13 @@ var IdentityManager = class {
|
|
|
3427
3436
|
async close() {
|
|
3428
3437
|
await this._identity?.close(new import_context8.Context(void 0, {
|
|
3429
3438
|
F: __dxlog_file12,
|
|
3430
|
-
L:
|
|
3439
|
+
L: 135
|
|
3431
3440
|
}));
|
|
3432
3441
|
}
|
|
3433
3442
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
3434
3443
|
(0, import_invariant9.invariant)(!this._identity, "Identity already exists.", {
|
|
3435
3444
|
F: __dxlog_file12,
|
|
3436
|
-
L:
|
|
3445
|
+
L: 140,
|
|
3437
3446
|
S: this,
|
|
3438
3447
|
A: [
|
|
3439
3448
|
"!this._identity",
|
|
@@ -3442,7 +3451,7 @@ var IdentityManager = class {
|
|
|
3442
3451
|
});
|
|
3443
3452
|
(0, import_log10.log)("creating identity...", void 0, {
|
|
3444
3453
|
F: __dxlog_file12,
|
|
3445
|
-
L:
|
|
3454
|
+
L: 141,
|
|
3446
3455
|
S: this,
|
|
3447
3456
|
C: (f, a) => f(...a)
|
|
3448
3457
|
});
|
|
@@ -3460,13 +3469,13 @@ var IdentityManager = class {
|
|
|
3460
3469
|
const identity = await this._constructIdentity(identityRecord);
|
|
3461
3470
|
await identity.open(new import_context8.Context(void 0, {
|
|
3462
3471
|
F: __dxlog_file12,
|
|
3463
|
-
L:
|
|
3472
|
+
L: 156
|
|
3464
3473
|
}));
|
|
3465
3474
|
{
|
|
3466
3475
|
const generator = new import_credentials14.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
3467
3476
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
3468
3477
|
F: __dxlog_file12,
|
|
3469
|
-
L:
|
|
3478
|
+
L: 160,
|
|
3470
3479
|
S: this,
|
|
3471
3480
|
A: [
|
|
3472
3481
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -3475,7 +3484,7 @@ var IdentityManager = class {
|
|
|
3475
3484
|
});
|
|
3476
3485
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
3477
3486
|
F: __dxlog_file12,
|
|
3478
|
-
L:
|
|
3487
|
+
L: 161,
|
|
3479
3488
|
S: this,
|
|
3480
3489
|
A: [
|
|
3481
3490
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3514,7 +3523,7 @@ var IdentityManager = class {
|
|
|
3514
3523
|
displayName: this._identity.profileDocument?.displayName
|
|
3515
3524
|
}, {
|
|
3516
3525
|
F: __dxlog_file12,
|
|
3517
|
-
L:
|
|
3526
|
+
L: 199,
|
|
3518
3527
|
S: this,
|
|
3519
3528
|
C: (f, a) => f(...a)
|
|
3520
3529
|
});
|
|
@@ -3525,7 +3534,7 @@ var IdentityManager = class {
|
|
|
3525
3534
|
profile: identity.profileDocument
|
|
3526
3535
|
}, {
|
|
3527
3536
|
F: __dxlog_file12,
|
|
3528
|
-
L:
|
|
3537
|
+
L: 205,
|
|
3529
3538
|
S: this,
|
|
3530
3539
|
C: (f, a) => f(...a)
|
|
3531
3540
|
});
|
|
@@ -3562,13 +3571,13 @@ var IdentityManager = class {
|
|
|
3562
3571
|
params
|
|
3563
3572
|
}, {
|
|
3564
3573
|
F: __dxlog_file12,
|
|
3565
|
-
L:
|
|
3574
|
+
L: 244,
|
|
3566
3575
|
S: this,
|
|
3567
3576
|
C: (f, a) => f(...a)
|
|
3568
3577
|
});
|
|
3569
3578
|
(0, import_invariant9.invariant)(!this._identity, "Identity already exists.", {
|
|
3570
3579
|
F: __dxlog_file12,
|
|
3571
|
-
L:
|
|
3580
|
+
L: 245,
|
|
3572
3581
|
S: this,
|
|
3573
3582
|
A: [
|
|
3574
3583
|
"!this._identity",
|
|
@@ -3589,7 +3598,7 @@ var IdentityManager = class {
|
|
|
3589
3598
|
const identity = await this._constructIdentity(identityRecord);
|
|
3590
3599
|
await identity.open(new import_context8.Context(void 0, {
|
|
3591
3600
|
F: __dxlog_file12,
|
|
3592
|
-
L:
|
|
3601
|
+
L: 259
|
|
3593
3602
|
}));
|
|
3594
3603
|
return {
|
|
3595
3604
|
identity,
|
|
@@ -3608,7 +3617,7 @@ var IdentityManager = class {
|
|
|
3608
3617
|
displayName: this._identity.profileDocument?.displayName
|
|
3609
3618
|
}, {
|
|
3610
3619
|
F: __dxlog_file12,
|
|
3611
|
-
L:
|
|
3620
|
+
L: 273,
|
|
3612
3621
|
S: this,
|
|
3613
3622
|
C: (f, a) => f(...a)
|
|
3614
3623
|
});
|
|
@@ -3622,7 +3631,7 @@ var IdentityManager = class {
|
|
|
3622
3631
|
deviceKey: identity.deviceKey
|
|
3623
3632
|
}, {
|
|
3624
3633
|
F: __dxlog_file12,
|
|
3625
|
-
L:
|
|
3634
|
+
L: 284,
|
|
3626
3635
|
S: this,
|
|
3627
3636
|
C: (f, a) => f(...a)
|
|
3628
3637
|
});
|
|
@@ -3633,7 +3642,7 @@ var IdentityManager = class {
|
|
|
3633
3642
|
async updateProfile(profile) {
|
|
3634
3643
|
(0, import_invariant9.invariant)(this._identity, "Identity not initialized.", {
|
|
3635
3644
|
F: __dxlog_file12,
|
|
3636
|
-
L:
|
|
3645
|
+
L: 291,
|
|
3637
3646
|
S: this,
|
|
3638
3647
|
A: [
|
|
3639
3648
|
"this._identity",
|
|
@@ -3664,7 +3673,7 @@ var IdentityManager = class {
|
|
|
3664
3673
|
async updateDeviceProfile(profile) {
|
|
3665
3674
|
(0, import_invariant9.invariant)(this._identity, "Identity not initialized.", {
|
|
3666
3675
|
F: __dxlog_file12,
|
|
3667
|
-
L:
|
|
3676
|
+
L: 308,
|
|
3668
3677
|
S: this,
|
|
3669
3678
|
A: [
|
|
3670
3679
|
"this._identity",
|
|
@@ -3697,48 +3706,10 @@ var IdentityManager = class {
|
|
|
3697
3706
|
profile
|
|
3698
3707
|
};
|
|
3699
3708
|
}
|
|
3700
|
-
async createRecoveryPhrase() {
|
|
3701
|
-
const identity = this._identity;
|
|
3702
|
-
(0, import_invariant9.invariant)(identity, void 0, {
|
|
3703
|
-
F: __dxlog_file12,
|
|
3704
|
-
L: 340,
|
|
3705
|
-
S: this,
|
|
3706
|
-
A: [
|
|
3707
|
-
"identity",
|
|
3708
|
-
""
|
|
3709
|
-
]
|
|
3710
|
-
});
|
|
3711
|
-
const seedphrase = (0, import_credentials14.generateSeedPhrase)();
|
|
3712
|
-
const keypair = (0, import_credentials14.keyPairFromSeedPhrase)(seedphrase);
|
|
3713
|
-
const recoveryKey = import_keys9.PublicKey.from(keypair.publicKey);
|
|
3714
|
-
const identityKey = identity.identityKey;
|
|
3715
|
-
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
3716
|
-
subject: identityKey,
|
|
3717
|
-
assertion: {
|
|
3718
|
-
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
3719
|
-
recoveryKey,
|
|
3720
|
-
identityKey
|
|
3721
|
-
}
|
|
3722
|
-
});
|
|
3723
|
-
const receipt = await identity.controlPipeline.writer.write({
|
|
3724
|
-
credential: {
|
|
3725
|
-
credential
|
|
3726
|
-
}
|
|
3727
|
-
});
|
|
3728
|
-
await identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe4.Timeframe([
|
|
3729
|
-
[
|
|
3730
|
-
receipt.feedKey,
|
|
3731
|
-
receipt.seq
|
|
3732
|
-
]
|
|
3733
|
-
]));
|
|
3734
|
-
return {
|
|
3735
|
-
seedphrase
|
|
3736
|
-
};
|
|
3737
|
-
}
|
|
3738
3709
|
async _constructIdentity(identityRecord) {
|
|
3739
3710
|
(0, import_invariant9.invariant)(!this._identity, void 0, {
|
|
3740
3711
|
F: __dxlog_file12,
|
|
3741
|
-
L:
|
|
3712
|
+
L: 334,
|
|
3742
3713
|
S: this,
|
|
3743
3714
|
A: [
|
|
3744
3715
|
"!this._identity",
|
|
@@ -3749,7 +3720,7 @@ var IdentityManager = class {
|
|
|
3749
3720
|
identityRecord
|
|
3750
3721
|
}, {
|
|
3751
3722
|
F: __dxlog_file12,
|
|
3752
|
-
L:
|
|
3723
|
+
L: 335,
|
|
3753
3724
|
S: this,
|
|
3754
3725
|
C: (f, a) => f(...a)
|
|
3755
3726
|
});
|
|
@@ -3764,7 +3735,7 @@ var IdentityManager = class {
|
|
|
3764
3735
|
});
|
|
3765
3736
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
3766
3737
|
F: __dxlog_file12,
|
|
3767
|
-
L:
|
|
3738
|
+
L: 348,
|
|
3768
3739
|
S: this,
|
|
3769
3740
|
A: [
|
|
3770
3741
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -3776,7 +3747,7 @@ var IdentityManager = class {
|
|
|
3776
3747
|
});
|
|
3777
3748
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
3778
3749
|
F: __dxlog_file12,
|
|
3779
|
-
L:
|
|
3750
|
+
L: 352,
|
|
3780
3751
|
S: this,
|
|
3781
3752
|
A: [
|
|
3782
3753
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3800,10 +3771,12 @@ var IdentityManager = class {
|
|
|
3800
3771
|
});
|
|
3801
3772
|
await space.setControlFeed(controlFeed);
|
|
3802
3773
|
await space.setDataFeed(dataFeed);
|
|
3774
|
+
const did = await (0, import_credentials14.createDidFromIdentityKey)(identityRecord.identityKey);
|
|
3803
3775
|
const identity = new Identity({
|
|
3804
3776
|
space,
|
|
3805
3777
|
presence,
|
|
3806
3778
|
signer: this._keyring,
|
|
3779
|
+
did,
|
|
3807
3780
|
identityKey: identityRecord.identityKey,
|
|
3808
3781
|
deviceKey: identityRecord.deviceKey,
|
|
3809
3782
|
edgeConnection: this._edgeConnection,
|
|
@@ -3813,7 +3786,7 @@ var IdentityManager = class {
|
|
|
3813
3786
|
identityKey: identityRecord.identityKey
|
|
3814
3787
|
}, {
|
|
3815
3788
|
F: __dxlog_file12,
|
|
3816
|
-
L:
|
|
3789
|
+
L: 383,
|
|
3817
3790
|
S: this,
|
|
3818
3791
|
C: (f, a) => f(...a)
|
|
3819
3792
|
});
|
|
@@ -3838,7 +3811,7 @@ var IdentityManager = class {
|
|
|
3838
3811
|
onAuthFailure: () => {
|
|
3839
3812
|
import_log10.log.warn("auth failure", void 0, {
|
|
3840
3813
|
F: __dxlog_file12,
|
|
3841
|
-
L:
|
|
3814
|
+
L: 408,
|
|
3842
3815
|
S: this,
|
|
3843
3816
|
C: (f, a) => f(...a)
|
|
3844
3817
|
});
|
|
@@ -3891,7 +3864,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3891
3864
|
const identity = this._identityManager.identity;
|
|
3892
3865
|
(0, import_invariant10.invariant)(identity, void 0, {
|
|
3893
3866
|
F: __dxlog_file13,
|
|
3894
|
-
L:
|
|
3867
|
+
L: 61,
|
|
3895
3868
|
S: this,
|
|
3896
3869
|
A: [
|
|
3897
3870
|
"identity",
|
|
@@ -3901,7 +3874,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3901
3874
|
await identity.updateDefaultSpace(space.id);
|
|
3902
3875
|
}
|
|
3903
3876
|
queryIdentity() {
|
|
3904
|
-
return new
|
|
3877
|
+
return new import_stream8.Stream(({ next }) => {
|
|
3905
3878
|
const emitNext = () => next({
|
|
3906
3879
|
identity: this._getIdentity()
|
|
3907
3880
|
});
|
|
@@ -3914,6 +3887,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3914
3887
|
return void 0;
|
|
3915
3888
|
}
|
|
3916
3889
|
return {
|
|
3890
|
+
did: this._identityManager.identity.did,
|
|
3917
3891
|
identityKey: this._identityManager.identity.identityKey,
|
|
3918
3892
|
spaceKey: this._identityManager.identity.space.key,
|
|
3919
3893
|
profile: this._identityManager.identity.profileDocument
|
|
@@ -3922,7 +3896,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3922
3896
|
async updateProfile(profile) {
|
|
3923
3897
|
(0, import_invariant10.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
3924
3898
|
F: __dxlog_file13,
|
|
3925
|
-
L:
|
|
3899
|
+
L: 88,
|
|
3926
3900
|
S: this,
|
|
3927
3901
|
A: [
|
|
3928
3902
|
"this._identityManager.identity",
|
|
@@ -3933,18 +3907,29 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3933
3907
|
await this._onProfileUpdate?.(this._identityManager.identity.profileDocument);
|
|
3934
3908
|
return this._getIdentity();
|
|
3935
3909
|
}
|
|
3936
|
-
async
|
|
3937
|
-
return this._recoveryManager.
|
|
3910
|
+
async createRecoveryCredential(request) {
|
|
3911
|
+
return this._recoveryManager.createRecoveryCredential(request);
|
|
3912
|
+
}
|
|
3913
|
+
async requestRecoveryChallenge() {
|
|
3914
|
+
return this._recoveryManager.requestRecoveryChallenge();
|
|
3938
3915
|
}
|
|
3939
3916
|
async recoverIdentity(request) {
|
|
3940
|
-
|
|
3917
|
+
if (request.recoveryCode) {
|
|
3918
|
+
await this._recoveryManager.recoverIdentity({
|
|
3919
|
+
recoveryCode: request.recoveryCode
|
|
3920
|
+
});
|
|
3921
|
+
} else if (request.external) {
|
|
3922
|
+
await this._recoveryManager.recoverIdentityWithExternalSignature(request.external);
|
|
3923
|
+
} else {
|
|
3924
|
+
throw new Error("Invalid request.");
|
|
3925
|
+
}
|
|
3941
3926
|
return this._getIdentity();
|
|
3942
3927
|
}
|
|
3943
3928
|
// TODO(burdon): Rename createPresentation?
|
|
3944
3929
|
async signPresentation({ presentation, nonce }) {
|
|
3945
3930
|
(0, import_invariant10.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
3946
3931
|
F: __dxlog_file13,
|
|
3947
|
-
L:
|
|
3932
|
+
L: 116,
|
|
3948
3933
|
S: this,
|
|
3949
3934
|
A: [
|
|
3950
3935
|
"this._identityManager.identity",
|
|
@@ -3963,7 +3948,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3963
3948
|
const identity = this._identityManager.identity;
|
|
3964
3949
|
(0, import_invariant10.invariant)(identity, "Identity not initialized.", {
|
|
3965
3950
|
F: __dxlog_file13,
|
|
3966
|
-
L:
|
|
3951
|
+
L: 130,
|
|
3967
3952
|
S: this,
|
|
3968
3953
|
A: [
|
|
3969
3954
|
"identity",
|
|
@@ -4001,7 +3986,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
4001
3986
|
duplicate: space.id
|
|
4002
3987
|
}, {
|
|
4003
3988
|
F: __dxlog_file13,
|
|
4004
|
-
L:
|
|
3989
|
+
L: 164,
|
|
4005
3990
|
S: this,
|
|
4006
3991
|
C: (f, a) => f(...a)
|
|
4007
3992
|
});
|
|
@@ -4015,7 +4000,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
4015
4000
|
}, (err) => {
|
|
4016
4001
|
import_log11.log.catch(err, void 0, {
|
|
4017
4002
|
F: __dxlog_file13,
|
|
4018
|
-
L:
|
|
4003
|
+
L: 175,
|
|
4019
4004
|
S: this,
|
|
4020
4005
|
C: (f, a) => f(...a)
|
|
4021
4006
|
});
|
|
@@ -4784,6 +4769,12 @@ var DeviceInvitationProtocol = class {
|
|
|
4784
4769
|
var stateToString = (state) => {
|
|
4785
4770
|
return Object.entries(import_services13.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
4786
4771
|
};
|
|
4772
|
+
var computeExpirationTime = (invitation) => {
|
|
4773
|
+
if (!invitation.lifetime) {
|
|
4774
|
+
return;
|
|
4775
|
+
}
|
|
4776
|
+
return new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime * 1e3);
|
|
4777
|
+
};
|
|
4787
4778
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
4788
4779
|
let guard;
|
|
4789
4780
|
return (0, import_context11.cancelWithContext)(ctx, (async () => {
|
|
@@ -5760,18 +5751,19 @@ var InvitationsHandler = class {
|
|
|
5760
5751
|
});
|
|
5761
5752
|
return extension;
|
|
5762
5753
|
};
|
|
5763
|
-
|
|
5764
|
-
|
|
5754
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
5755
|
+
if (expiresOn) {
|
|
5756
|
+
if (expiresOn.getTime() < Date.now()) {
|
|
5765
5757
|
import_log12.log.warn("invitation has already expired", void 0, {
|
|
5766
5758
|
F: __dxlog_file21,
|
|
5767
|
-
L:
|
|
5759
|
+
L: 194,
|
|
5768
5760
|
S: this,
|
|
5769
5761
|
C: (f, a) => f(...a)
|
|
5770
5762
|
});
|
|
5771
5763
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5772
5764
|
void ctx.dispose().catch((err) => import_log12.log.catch(err, void 0, {
|
|
5773
5765
|
F: __dxlog_file21,
|
|
5774
|
-
L:
|
|
5766
|
+
L: 196,
|
|
5775
5767
|
S: this,
|
|
5776
5768
|
C: (f, a) => f(...a)
|
|
5777
5769
|
}));
|
|
@@ -5782,7 +5774,7 @@ var InvitationsHandler = class {
|
|
|
5782
5774
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5783
5775
|
metrics.increment("dxos.invitation.expired");
|
|
5784
5776
|
await ctx.dispose();
|
|
5785
|
-
},
|
|
5777
|
+
}, expiresOn.getTime() - Date.now());
|
|
5786
5778
|
}
|
|
5787
5779
|
let swarmConnection;
|
|
5788
5780
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
@@ -5798,7 +5790,7 @@ var InvitationsHandler = class {
|
|
|
5798
5790
|
type: invitation.type
|
|
5799
5791
|
}, {
|
|
5800
5792
|
F: __dxlog_file21,
|
|
5801
|
-
L:
|
|
5793
|
+
L: 227,
|
|
5802
5794
|
S: this,
|
|
5803
5795
|
C: (f, a) => f(...a)
|
|
5804
5796
|
});
|
|
@@ -5806,7 +5798,7 @@ var InvitationsHandler = class {
|
|
|
5806
5798
|
if (deviceProfile) {
|
|
5807
5799
|
(0, import_invariant12.invariant)(invitation.kind === import_services11.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5808
5800
|
F: __dxlog_file21,
|
|
5809
|
-
L:
|
|
5801
|
+
L: 236,
|
|
5810
5802
|
S: this,
|
|
5811
5803
|
A: [
|
|
5812
5804
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5824,7 +5816,7 @@ var InvitationsHandler = class {
|
|
|
5824
5816
|
triedPeers: triedPeersIds.size
|
|
5825
5817
|
}, {
|
|
5826
5818
|
F: __dxlog_file21,
|
|
5827
|
-
L:
|
|
5819
|
+
L: 244,
|
|
5828
5820
|
S: this,
|
|
5829
5821
|
C: (f, a) => f(...a)
|
|
5830
5822
|
});
|
|
@@ -5851,7 +5843,7 @@ var InvitationsHandler = class {
|
|
|
5851
5843
|
currentState: guardedState.current.state
|
|
5852
5844
|
}, {
|
|
5853
5845
|
F: __dxlog_file21,
|
|
5854
|
-
L:
|
|
5846
|
+
L: 272,
|
|
5855
5847
|
S: this,
|
|
5856
5848
|
C: (f, a) => f(...a)
|
|
5857
5849
|
});
|
|
@@ -5869,7 +5861,7 @@ var InvitationsHandler = class {
|
|
|
5869
5861
|
id: traceId
|
|
5870
5862
|
}), {
|
|
5871
5863
|
F: __dxlog_file21,
|
|
5872
|
-
L:
|
|
5864
|
+
L: 284,
|
|
5873
5865
|
S: this,
|
|
5874
5866
|
C: (f, a) => f(...a)
|
|
5875
5867
|
});
|
|
@@ -5881,7 +5873,7 @@ var InvitationsHandler = class {
|
|
|
5881
5873
|
...protocol.toJSON()
|
|
5882
5874
|
}, {
|
|
5883
5875
|
F: __dxlog_file21,
|
|
5884
|
-
L:
|
|
5876
|
+
L: 295,
|
|
5885
5877
|
S: this,
|
|
5886
5878
|
C: (f, a) => f(...a)
|
|
5887
5879
|
});
|
|
@@ -5891,7 +5883,7 @@ var InvitationsHandler = class {
|
|
|
5891
5883
|
...protocol.toJSON()
|
|
5892
5884
|
}, {
|
|
5893
5885
|
F: __dxlog_file21,
|
|
5894
|
-
L:
|
|
5886
|
+
L: 299,
|
|
5895
5887
|
S: this,
|
|
5896
5888
|
C: (f, a) => f(...a)
|
|
5897
5889
|
});
|
|
@@ -5905,7 +5897,7 @@ var InvitationsHandler = class {
|
|
|
5905
5897
|
authMethod: introductionResponse.authMethod
|
|
5906
5898
|
}, {
|
|
5907
5899
|
F: __dxlog_file21,
|
|
5908
|
-
L:
|
|
5900
|
+
L: 307,
|
|
5909
5901
|
S: this,
|
|
5910
5902
|
C: (f, a) => f(...a)
|
|
5911
5903
|
});
|
|
@@ -5927,7 +5919,7 @@ var InvitationsHandler = class {
|
|
|
5927
5919
|
...protocol.toJSON()
|
|
5928
5920
|
}, {
|
|
5929
5921
|
F: __dxlog_file21,
|
|
5930
|
-
L:
|
|
5922
|
+
L: 337,
|
|
5931
5923
|
S: this,
|
|
5932
5924
|
C: (f, a) => f(...a)
|
|
5933
5925
|
});
|
|
@@ -5940,7 +5932,7 @@ var InvitationsHandler = class {
|
|
|
5940
5932
|
...protocol.toJSON()
|
|
5941
5933
|
}, {
|
|
5942
5934
|
F: __dxlog_file21,
|
|
5943
|
-
L:
|
|
5935
|
+
L: 351,
|
|
5944
5936
|
S: this,
|
|
5945
5937
|
C: (f, a) => f(...a)
|
|
5946
5938
|
});
|
|
@@ -5953,7 +5945,7 @@ var InvitationsHandler = class {
|
|
|
5953
5945
|
id: traceId
|
|
5954
5946
|
}), {
|
|
5955
5947
|
F: __dxlog_file21,
|
|
5956
|
-
L:
|
|
5948
|
+
L: 360,
|
|
5957
5949
|
S: this,
|
|
5958
5950
|
C: (f, a) => f(...a)
|
|
5959
5951
|
});
|
|
@@ -5963,7 +5955,7 @@ var InvitationsHandler = class {
|
|
|
5963
5955
|
...protocol.toJSON()
|
|
5964
5956
|
}, {
|
|
5965
5957
|
F: __dxlog_file21,
|
|
5966
|
-
L:
|
|
5958
|
+
L: 363,
|
|
5967
5959
|
S: this,
|
|
5968
5960
|
C: (f, a) => f(...a)
|
|
5969
5961
|
});
|
|
@@ -5971,7 +5963,7 @@ var InvitationsHandler = class {
|
|
|
5971
5963
|
} else {
|
|
5972
5964
|
import_log12.log.verbose("auth failed", err, {
|
|
5973
5965
|
F: __dxlog_file21,
|
|
5974
|
-
L:
|
|
5966
|
+
L: 366,
|
|
5975
5967
|
S: this,
|
|
5976
5968
|
C: (f, a) => f(...a)
|
|
5977
5969
|
});
|
|
@@ -5983,7 +5975,7 @@ var InvitationsHandler = class {
|
|
|
5983
5975
|
error: err
|
|
5984
5976
|
}), {
|
|
5985
5977
|
F: __dxlog_file21,
|
|
5986
|
-
L:
|
|
5978
|
+
L: 370,
|
|
5987
5979
|
S: this,
|
|
5988
5980
|
C: (f, a) => f(...a)
|
|
5989
5981
|
});
|
|
@@ -5999,7 +5991,7 @@ var InvitationsHandler = class {
|
|
|
5999
5991
|
...protocol.toJSON()
|
|
6000
5992
|
}, {
|
|
6001
5993
|
F: __dxlog_file21,
|
|
6002
|
-
L:
|
|
5994
|
+
L: 379,
|
|
6003
5995
|
S: this,
|
|
6004
5996
|
C: (f, a) => f(...a)
|
|
6005
5997
|
});
|
|
@@ -6007,7 +5999,7 @@ var InvitationsHandler = class {
|
|
|
6007
5999
|
} else {
|
|
6008
6000
|
import_log12.log.verbose("auth failed", err, {
|
|
6009
6001
|
F: __dxlog_file21,
|
|
6010
|
-
L:
|
|
6002
|
+
L: 382,
|
|
6011
6003
|
S: this,
|
|
6012
6004
|
C: (f, a) => f(...a)
|
|
6013
6005
|
});
|
|
@@ -6024,7 +6016,7 @@ var InvitationsHandler = class {
|
|
|
6024
6016
|
...protocol.toJSON()
|
|
6025
6017
|
}, {
|
|
6026
6018
|
F: __dxlog_file21,
|
|
6027
|
-
L:
|
|
6019
|
+
L: 394,
|
|
6028
6020
|
S: this,
|
|
6029
6021
|
C: (f, a) => f(...a)
|
|
6030
6022
|
});
|
|
@@ -6037,14 +6029,14 @@ var InvitationsHandler = class {
|
|
|
6037
6029
|
});
|
|
6038
6030
|
edgeInvitationHandler.handle(ctx, guardedState, protocol, deviceProfile);
|
|
6039
6031
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6040
|
-
const error =
|
|
6032
|
+
const error = checkInvitation(protocol, invitation);
|
|
6041
6033
|
if (error) {
|
|
6042
6034
|
stream.error(error);
|
|
6043
6035
|
await ctx.dispose();
|
|
6044
6036
|
} else {
|
|
6045
6037
|
(0, import_invariant12.invariant)(invitation.swarmKey, void 0, {
|
|
6046
6038
|
F: __dxlog_file21,
|
|
6047
|
-
L:
|
|
6039
|
+
L: 406,
|
|
6048
6040
|
S: this,
|
|
6049
6041
|
A: [
|
|
6050
6042
|
"invitation.swarmKey",
|
|
@@ -6088,7 +6080,7 @@ var InvitationsHandler = class {
|
|
|
6088
6080
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6089
6081
|
(0, import_log12.log)("guest waiting for authentication code...", void 0, {
|
|
6090
6082
|
F: __dxlog_file21,
|
|
6091
|
-
L:
|
|
6083
|
+
L: 458,
|
|
6092
6084
|
S: this,
|
|
6093
6085
|
C: (f, a) => f(...a)
|
|
6094
6086
|
});
|
|
@@ -6096,7 +6088,7 @@ var InvitationsHandler = class {
|
|
|
6096
6088
|
const authCode = await authenticated.wait(options);
|
|
6097
6089
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6098
6090
|
F: __dxlog_file21,
|
|
6099
|
-
L:
|
|
6091
|
+
L: 462,
|
|
6100
6092
|
S: this,
|
|
6101
6093
|
C: (f, a) => f(...a)
|
|
6102
6094
|
});
|
|
@@ -6115,7 +6107,7 @@ var InvitationsHandler = class {
|
|
|
6115
6107
|
attempt
|
|
6116
6108
|
}, {
|
|
6117
6109
|
F: __dxlog_file21,
|
|
6118
|
-
L:
|
|
6110
|
+
L: 473,
|
|
6119
6111
|
S: this,
|
|
6120
6112
|
C: (f, a) => f(...a)
|
|
6121
6113
|
});
|
|
@@ -6133,7 +6125,7 @@ var InvitationsHandler = class {
|
|
|
6133
6125
|
}
|
|
6134
6126
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6135
6127
|
F: __dxlog_file21,
|
|
6136
|
-
L:
|
|
6128
|
+
L: 492,
|
|
6137
6129
|
S: this,
|
|
6138
6130
|
C: (f, a) => f(...a)
|
|
6139
6131
|
});
|
|
@@ -6146,6 +6138,13 @@ var InvitationsHandler = class {
|
|
|
6146
6138
|
}
|
|
6147
6139
|
}
|
|
6148
6140
|
};
|
|
6141
|
+
var checkInvitation = (protocol, invitation) => {
|
|
6142
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
6143
|
+
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
6144
|
+
return new import_protocols9.InvalidInvitationError("Invitation already expired.");
|
|
6145
|
+
}
|
|
6146
|
+
return protocol.checkInvitation(invitation);
|
|
6147
|
+
};
|
|
6149
6148
|
var createAdmissionKeypair = () => {
|
|
6150
6149
|
const keypair = (0, import_crypto.createKeyPair)();
|
|
6151
6150
|
return {
|
|
@@ -6162,7 +6161,7 @@ var InvitationsServiceImpl = class {
|
|
|
6162
6161
|
return {};
|
|
6163
6162
|
}
|
|
6164
6163
|
createInvitation(options) {
|
|
6165
|
-
return new
|
|
6164
|
+
return new import_stream9.Stream(({ next, close }) => {
|
|
6166
6165
|
void this._invitationsManager.createInvitation(options).then((invitation) => {
|
|
6167
6166
|
import_tracing9.trace.metrics.increment("dxos.invitation.created");
|
|
6168
6167
|
invitation.subscribe(next, close, close);
|
|
@@ -6171,7 +6170,7 @@ var InvitationsServiceImpl = class {
|
|
|
6171
6170
|
}
|
|
6172
6171
|
acceptInvitation(request) {
|
|
6173
6172
|
const invitation = this._invitationsManager.acceptInvitation(request);
|
|
6174
|
-
return new
|
|
6173
|
+
return new import_stream9.Stream(({ next, close }) => {
|
|
6175
6174
|
invitation.subscribe(next, close, close);
|
|
6176
6175
|
});
|
|
6177
6176
|
}
|
|
@@ -6182,7 +6181,7 @@ var InvitationsServiceImpl = class {
|
|
|
6182
6181
|
return this._invitationsManager.cancelInvitation(request);
|
|
6183
6182
|
}
|
|
6184
6183
|
queryInvitations() {
|
|
6185
|
-
return new
|
|
6184
|
+
return new import_stream9.Stream(({ next, ctx }) => {
|
|
6186
6185
|
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
6187
6186
|
next({
|
|
6188
6187
|
action: import_services16.QueryInvitationsResponse.Action.ADDED,
|
|
@@ -6280,7 +6279,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6280
6279
|
getInvitationContext() {
|
|
6281
6280
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6282
6281
|
F: __dxlog_file22,
|
|
6283
|
-
L:
|
|
6282
|
+
L: 65,
|
|
6284
6283
|
S: this,
|
|
6285
6284
|
A: [
|
|
6286
6285
|
"this._spaceKey",
|
|
@@ -6290,7 +6289,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6290
6289
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6291
6290
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6292
6291
|
F: __dxlog_file22,
|
|
6293
|
-
L:
|
|
6292
|
+
L: 67,
|
|
6294
6293
|
S: this,
|
|
6295
6294
|
A: [
|
|
6296
6295
|
"space",
|
|
@@ -6306,7 +6305,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6306
6305
|
async admit(invitation, request, guestProfile) {
|
|
6307
6306
|
(0, import_invariant17.invariant)(this._spaceKey && request.space, void 0, {
|
|
6308
6307
|
F: __dxlog_file22,
|
|
6309
|
-
L:
|
|
6308
|
+
L: 80,
|
|
6310
6309
|
S: this,
|
|
6311
6310
|
A: [
|
|
6312
6311
|
"this._spaceKey && request.space",
|
|
@@ -6318,7 +6317,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6318
6317
|
guest: request.space.deviceKey
|
|
6319
6318
|
}, {
|
|
6320
6319
|
F: __dxlog_file22,
|
|
6321
|
-
L:
|
|
6320
|
+
L: 81,
|
|
6322
6321
|
S: this,
|
|
6323
6322
|
C: (f, a) => f(...a)
|
|
6324
6323
|
});
|
|
@@ -6340,7 +6339,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6340
6339
|
async delegate(invitation) {
|
|
6341
6340
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6342
6341
|
F: __dxlog_file22,
|
|
6343
|
-
L:
|
|
6342
|
+
L: 101,
|
|
6344
6343
|
S: this,
|
|
6345
6344
|
A: [
|
|
6346
6345
|
"this._spaceKey",
|
|
@@ -6350,7 +6349,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6350
6349
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6351
6350
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6352
6351
|
F: __dxlog_file22,
|
|
6353
|
-
L:
|
|
6352
|
+
L: 103,
|
|
6354
6353
|
S: this,
|
|
6355
6354
|
A: [
|
|
6356
6355
|
"space",
|
|
@@ -6360,7 +6359,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6360
6359
|
if (invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6361
6360
|
(0, import_invariant17.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6362
6361
|
F: __dxlog_file22,
|
|
6363
|
-
L:
|
|
6362
|
+
L: 105,
|
|
6364
6363
|
S: this,
|
|
6365
6364
|
A: [
|
|
6366
6365
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6373,7 +6372,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6373
6372
|
id: invitation.invitationId
|
|
6374
6373
|
}, {
|
|
6375
6374
|
F: __dxlog_file22,
|
|
6376
|
-
L:
|
|
6375
|
+
L: 108,
|
|
6377
6376
|
S: this,
|
|
6378
6377
|
C: (f, a) => f(...a)
|
|
6379
6378
|
});
|
|
@@ -6382,13 +6381,13 @@ var SpaceInvitationProtocol = class {
|
|
|
6382
6381
|
authMethod: invitation.authMethod,
|
|
6383
6382
|
swarmKey: invitation.swarmKey,
|
|
6384
6383
|
role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
|
|
6385
|
-
expiresOn:
|
|
6384
|
+
expiresOn: computeExpirationTime(invitation),
|
|
6386
6385
|
multiUse: invitation.multiUse ?? false,
|
|
6387
6386
|
guestKey: invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6388
6387
|
});
|
|
6389
6388
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6390
6389
|
F: __dxlog_file22,
|
|
6391
|
-
L:
|
|
6390
|
+
L: 126,
|
|
6392
6391
|
S: this,
|
|
6393
6392
|
A: [
|
|
6394
6393
|
"credential.credential",
|
|
@@ -6403,7 +6402,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6403
6402
|
async cancelDelegation(invitation) {
|
|
6404
6403
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6405
6404
|
F: __dxlog_file22,
|
|
6406
|
-
L:
|
|
6405
|
+
L: 132,
|
|
6407
6406
|
S: this,
|
|
6408
6407
|
A: [
|
|
6409
6408
|
"this._spaceKey",
|
|
@@ -6412,7 +6411,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6412
6411
|
});
|
|
6413
6412
|
(0, import_invariant17.invariant)(invitation.type === import_services17.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6414
6413
|
F: __dxlog_file22,
|
|
6415
|
-
L:
|
|
6414
|
+
L: 133,
|
|
6416
6415
|
S: this,
|
|
6417
6416
|
A: [
|
|
6418
6417
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6422,7 +6421,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6422
6421
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6423
6422
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6424
6423
|
F: __dxlog_file22,
|
|
6425
|
-
L:
|
|
6424
|
+
L: 135,
|
|
6426
6425
|
S: this,
|
|
6427
6426
|
A: [
|
|
6428
6427
|
"space",
|
|
@@ -6434,14 +6433,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6434
6433
|
id: invitation.invitationId
|
|
6435
6434
|
}, {
|
|
6436
6435
|
F: __dxlog_file22,
|
|
6437
|
-
L:
|
|
6436
|
+
L: 137,
|
|
6438
6437
|
S: this,
|
|
6439
6438
|
C: (f, a) => f(...a)
|
|
6440
6439
|
});
|
|
6441
6440
|
const credential = await (0, import_credentials18.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6442
6441
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6443
6442
|
F: __dxlog_file22,
|
|
6444
|
-
L:
|
|
6443
|
+
L: 144,
|
|
6445
6444
|
S: this,
|
|
6446
6445
|
A: [
|
|
6447
6446
|
"credential.credential",
|
|
@@ -6480,7 +6479,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6480
6479
|
async accept(response) {
|
|
6481
6480
|
(0, import_invariant17.invariant)(response.space, void 0, {
|
|
6482
6481
|
F: __dxlog_file22,
|
|
6483
|
-
L:
|
|
6482
|
+
L: 179,
|
|
6484
6483
|
S: this,
|
|
6485
6484
|
A: [
|
|
6486
6485
|
"response.space",
|
|
@@ -6491,7 +6490,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6491
6490
|
const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
|
|
6492
6491
|
(0, import_invariant17.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6493
6492
|
F: __dxlog_file22,
|
|
6494
|
-
L:
|
|
6493
|
+
L: 182,
|
|
6495
6494
|
S: this,
|
|
6496
6495
|
A: [
|
|
6497
6496
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6500,7 +6499,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6500
6499
|
});
|
|
6501
6500
|
(0, import_invariant17.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6502
6501
|
F: __dxlog_file22,
|
|
6503
|
-
L:
|
|
6502
|
+
L: 183,
|
|
6504
6503
|
S: this,
|
|
6505
6504
|
A: [
|
|
6506
6505
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -6724,7 +6723,7 @@ var InvitationsManager = class {
|
|
|
6724
6723
|
}
|
|
6725
6724
|
}
|
|
6726
6725
|
_createInvitation(protocol, _options) {
|
|
6727
|
-
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false, ...options } = _options ?? {};
|
|
6726
|
+
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400 * 7, multiUse = false, ...options } = _options ?? {};
|
|
6728
6727
|
const authCode = options?.authCode ?? (authMethod === import_services18.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6729
6728
|
return {
|
|
6730
6729
|
invitationId,
|
|
@@ -6963,7 +6962,7 @@ var ClientRpcServer = class {
|
|
|
6963
6962
|
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
6964
6963
|
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
6965
6964
|
if (this._handleStream) {
|
|
6966
|
-
return
|
|
6965
|
+
return import_codec_protobuf2.Stream.map(import_codec_protobuf2.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
|
|
6967
6966
|
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
6968
6967
|
return data;
|
|
6969
6968
|
});
|
|
@@ -7063,6 +7062,18 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7063
7062
|
haloSpaceKey: this._identity.haloSpaceKey.toHex()
|
|
7064
7063
|
});
|
|
7065
7064
|
const deviceKey = import_keys15.PublicKey.fromHex(response.deviceKey);
|
|
7065
|
+
if (await this._identity.authorizedDeviceKeys.has(deviceKey)) {
|
|
7066
|
+
import_log21.log.info("agent was already added to HALO, ignoring response", {
|
|
7067
|
+
response
|
|
7068
|
+
}, {
|
|
7069
|
+
F: __dxlog_file25,
|
|
7070
|
+
L: 67,
|
|
7071
|
+
S: this,
|
|
7072
|
+
C: (f, a) => f(...a)
|
|
7073
|
+
});
|
|
7074
|
+
this._updateStatus(import_protocols14.EdgeAgentStatus.ACTIVE, deviceKey);
|
|
7075
|
+
return;
|
|
7076
|
+
}
|
|
7066
7077
|
await this._identity.admitDevice({
|
|
7067
7078
|
deviceKey,
|
|
7068
7079
|
controlFeedKey: import_keys15.PublicKey.fromHex(response.feedKey),
|
|
@@ -7071,7 +7082,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7071
7082
|
});
|
|
7072
7083
|
(0, import_log21.log)("agent created", response, {
|
|
7073
7084
|
F: __dxlog_file25,
|
|
7074
|
-
L:
|
|
7085
|
+
L: 79,
|
|
7075
7086
|
S: this,
|
|
7076
7087
|
C: (f, a) => f(...a)
|
|
7077
7088
|
});
|
|
@@ -7083,7 +7094,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7083
7094
|
isEnabled
|
|
7084
7095
|
}, {
|
|
7085
7096
|
F: __dxlog_file25,
|
|
7086
|
-
L:
|
|
7097
|
+
L: 87,
|
|
7087
7098
|
S: this,
|
|
7088
7099
|
C: (f, a) => f(...a)
|
|
7089
7100
|
});
|
|
@@ -7116,7 +7127,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7116
7127
|
async _fetchAgentStatus() {
|
|
7117
7128
|
(0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
|
|
7118
7129
|
F: __dxlog_file25,
|
|
7119
|
-
L:
|
|
7130
|
+
L: 121,
|
|
7120
7131
|
S: this,
|
|
7121
7132
|
A: [
|
|
7122
7133
|
"this._edgeHttpClient",
|
|
@@ -7126,7 +7137,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7126
7137
|
try {
|
|
7127
7138
|
(0, import_log21.log)("fetching agent status", void 0, {
|
|
7128
7139
|
F: __dxlog_file25,
|
|
7129
|
-
L:
|
|
7140
|
+
L: 123,
|
|
7130
7141
|
S: this,
|
|
7131
7142
|
C: (f, a) => f(...a)
|
|
7132
7143
|
});
|
|
@@ -7145,7 +7156,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7145
7156
|
err
|
|
7146
7157
|
}, {
|
|
7147
7158
|
F: __dxlog_file25,
|
|
7148
|
-
L:
|
|
7159
|
+
L: 133,
|
|
7149
7160
|
S: this,
|
|
7150
7161
|
C: (f, a) => f(...a)
|
|
7151
7162
|
});
|
|
@@ -7158,7 +7169,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7158
7169
|
retryAfterMs
|
|
7159
7170
|
}, {
|
|
7160
7171
|
F: __dxlog_file25,
|
|
7161
|
-
L:
|
|
7172
|
+
L: 138,
|
|
7162
7173
|
S: this,
|
|
7163
7174
|
C: (f, a) => f(...a)
|
|
7164
7175
|
});
|
|
@@ -7194,7 +7205,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7194
7205
|
spaceId: space.id
|
|
7195
7206
|
}, {
|
|
7196
7207
|
F: __dxlog_file25,
|
|
7197
|
-
L:
|
|
7208
|
+
L: 165,
|
|
7198
7209
|
S: this,
|
|
7199
7210
|
C: (f, a) => f(...a)
|
|
7200
7211
|
});
|
|
@@ -7214,7 +7225,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7214
7225
|
status
|
|
7215
7226
|
}, {
|
|
7216
7227
|
F: __dxlog_file25,
|
|
7217
|
-
L:
|
|
7228
|
+
L: 181,
|
|
7218
7229
|
S: this,
|
|
7219
7230
|
C: (f, a) => f(...a)
|
|
7220
7231
|
});
|
|
@@ -7229,7 +7240,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7229
7240
|
this._edgeConnection = _edgeConnection;
|
|
7230
7241
|
}
|
|
7231
7242
|
queryEdgeStatus() {
|
|
7232
|
-
return new
|
|
7243
|
+
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7233
7244
|
next({
|
|
7234
7245
|
status: import_services20.QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
|
|
7235
7246
|
});
|
|
@@ -7250,7 +7261,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7250
7261
|
return (await this._agentManagerProvider()).createAgent();
|
|
7251
7262
|
}
|
|
7252
7263
|
queryAgentStatus() {
|
|
7253
|
-
return new
|
|
7264
|
+
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7254
7265
|
next({
|
|
7255
7266
|
status: import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN
|
|
7256
7267
|
});
|
|
@@ -7287,27 +7298,41 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7287
7298
|
this._identityProvider = _identityProvider;
|
|
7288
7299
|
this._acceptRecoveredIdentity = _acceptRecoveredIdentity;
|
|
7289
7300
|
}
|
|
7290
|
-
async
|
|
7301
|
+
async createRecoveryCredential({ recoveryKey, algorithm }) {
|
|
7291
7302
|
const identity = this._identityProvider();
|
|
7292
7303
|
(0, import_invariant22.invariant)(identity, void 0, {
|
|
7293
7304
|
F: __dxlog_file26,
|
|
7294
|
-
L:
|
|
7305
|
+
L: 37,
|
|
7295
7306
|
S: this,
|
|
7296
7307
|
A: [
|
|
7297
7308
|
"identity",
|
|
7298
7309
|
""
|
|
7299
7310
|
]
|
|
7300
7311
|
});
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7312
|
+
let recoveryCode;
|
|
7313
|
+
if (!recoveryKey) {
|
|
7314
|
+
recoveryCode = (0, import_credentials23.generateSeedPhrase)();
|
|
7315
|
+
const keypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7316
|
+
recoveryKey = import_keys17.PublicKey.from(keypair.publicKey);
|
|
7317
|
+
algorithm = "ED25519";
|
|
7318
|
+
}
|
|
7319
|
+
(0, import_invariant22.invariant)(algorithm, "Algorithm is required.", {
|
|
7320
|
+
F: __dxlog_file26,
|
|
7321
|
+
L: 47,
|
|
7322
|
+
S: this,
|
|
7323
|
+
A: [
|
|
7324
|
+
"algorithm",
|
|
7325
|
+
"'Algorithm is required.'"
|
|
7326
|
+
]
|
|
7327
|
+
});
|
|
7304
7328
|
const identityKey = identity.identityKey;
|
|
7305
7329
|
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
7306
7330
|
subject: identityKey,
|
|
7307
7331
|
assertion: {
|
|
7308
7332
|
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
7309
7333
|
recoveryKey,
|
|
7310
|
-
identityKey
|
|
7334
|
+
identityKey,
|
|
7335
|
+
algorithm
|
|
7311
7336
|
}
|
|
7312
7337
|
});
|
|
7313
7338
|
const receipt = await identity.controlPipeline.writer.write({
|
|
@@ -7322,20 +7347,81 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7322
7347
|
]
|
|
7323
7348
|
]));
|
|
7324
7349
|
return {
|
|
7325
|
-
|
|
7350
|
+
recoveryCode
|
|
7351
|
+
};
|
|
7352
|
+
}
|
|
7353
|
+
async requestRecoveryChallenge() {
|
|
7354
|
+
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7355
|
+
F: __dxlog_file26,
|
|
7356
|
+
L: 66,
|
|
7357
|
+
S: this,
|
|
7358
|
+
A: [
|
|
7359
|
+
"this._edgeClient",
|
|
7360
|
+
"'Not connected to EDGE.'"
|
|
7361
|
+
]
|
|
7362
|
+
});
|
|
7363
|
+
const deviceKey = await this._keyring.createKey();
|
|
7364
|
+
const controlFeedKey = await this._keyring.createKey();
|
|
7365
|
+
const request = {
|
|
7366
|
+
deviceKey: deviceKey.toHex(),
|
|
7367
|
+
controlFeedKey: controlFeedKey.toHex()
|
|
7368
|
+
};
|
|
7369
|
+
try {
|
|
7370
|
+
await this._edgeClient.recoverIdentity(request);
|
|
7371
|
+
throw new Error("No challenge received.");
|
|
7372
|
+
} catch (error) {
|
|
7373
|
+
if (!(error instanceof import_protocols17.EdgeAuthChallengeError)) {
|
|
7374
|
+
throw error;
|
|
7375
|
+
}
|
|
7376
|
+
return {
|
|
7377
|
+
deviceKey,
|
|
7378
|
+
controlFeedKey,
|
|
7379
|
+
challenge: error.challenge
|
|
7380
|
+
};
|
|
7381
|
+
}
|
|
7382
|
+
}
|
|
7383
|
+
async recoverIdentityWithExternalSignature({ identityDid, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7384
|
+
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7385
|
+
F: __dxlog_file26,
|
|
7386
|
+
L: 98,
|
|
7387
|
+
S: this,
|
|
7388
|
+
A: [
|
|
7389
|
+
"this._edgeClient",
|
|
7390
|
+
"'Not connected to EDGE.'"
|
|
7391
|
+
]
|
|
7392
|
+
});
|
|
7393
|
+
const request = {
|
|
7394
|
+
identityDid,
|
|
7395
|
+
deviceKey: deviceKey.toHex(),
|
|
7396
|
+
controlFeedKey: controlFeedKey.toHex(),
|
|
7397
|
+
signature: clientDataJson && authenticatorData ? {
|
|
7398
|
+
signature: Buffer.from(signature).toString("base64"),
|
|
7399
|
+
clientDataJson: Buffer.from(clientDataJson).toString("base64"),
|
|
7400
|
+
authenticatorData: Buffer.from(authenticatorData).toString("base64")
|
|
7401
|
+
} : Buffer.from(signature).toString("base64")
|
|
7326
7402
|
};
|
|
7403
|
+
const response = await this._edgeClient.recoverIdentity(request);
|
|
7404
|
+
await this._acceptRecoveredIdentity({
|
|
7405
|
+
authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
|
|
7406
|
+
haloGenesisFeedKey: import_keys17.PublicKey.fromHex(response.genesisFeedKey),
|
|
7407
|
+
haloSpaceKey: import_keys17.PublicKey.fromHex(response.haloSpaceKey),
|
|
7408
|
+
identityKey: import_keys17.PublicKey.fromHex(response.identityKey),
|
|
7409
|
+
deviceKey,
|
|
7410
|
+
controlFeedKey,
|
|
7411
|
+
dataFeedKey: await this._keyring.createKey()
|
|
7412
|
+
});
|
|
7327
7413
|
}
|
|
7328
|
-
async recoverIdentity(
|
|
7414
|
+
async recoverIdentity({ recoveryCode }) {
|
|
7329
7415
|
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7330
7416
|
F: __dxlog_file26,
|
|
7331
|
-
L:
|
|
7417
|
+
L: 128,
|
|
7332
7418
|
S: this,
|
|
7333
7419
|
A: [
|
|
7334
7420
|
"this._edgeClient",
|
|
7335
7421
|
"'Not connected to EDGE.'"
|
|
7336
7422
|
]
|
|
7337
7423
|
});
|
|
7338
|
-
const recoveryKeypair = (0, import_credentials23.keyPairFromSeedPhrase)(
|
|
7424
|
+
const recoveryKeypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7339
7425
|
const recoveryKey = import_keys17.PublicKey.from(recoveryKeypair.publicKey);
|
|
7340
7426
|
const deviceKey = await this._keyring.createKey();
|
|
7341
7427
|
const controlFeedKey = await this._keyring.createKey();
|
|
@@ -7359,7 +7445,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7359
7445
|
}
|
|
7360
7446
|
import_log23.log.info("recovering identity", response, {
|
|
7361
7447
|
F: __dxlog_file26,
|
|
7362
|
-
L:
|
|
7448
|
+
L: 154,
|
|
7363
7449
|
S: this,
|
|
7364
7450
|
C: (f, a) => f(...a)
|
|
7365
7451
|
});
|
|
@@ -7498,7 +7584,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7498
7584
|
this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
|
|
7499
7585
|
this.echoHost = new import_echo_pipeline4.EchoHost({
|
|
7500
7586
|
kv: this.level,
|
|
7501
|
-
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
|
|
7587
|
+
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
|
|
7588
|
+
getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
|
|
7502
7589
|
});
|
|
7503
7590
|
this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
|
|
7504
7591
|
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
|
|
@@ -7517,7 +7604,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7517
7604
|
await this._checkStorageVersion();
|
|
7518
7605
|
(0, import_log22.log)("opening...", void 0, {
|
|
7519
7606
|
F: __dxlog_file27,
|
|
7520
|
-
L:
|
|
7607
|
+
L: 199,
|
|
7521
7608
|
S: this,
|
|
7522
7609
|
C: (f, a) => f(...a)
|
|
7523
7610
|
});
|
|
@@ -7525,7 +7612,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7525
7612
|
id: this._instanceId
|
|
7526
7613
|
}), {
|
|
7527
7614
|
F: __dxlog_file27,
|
|
7528
|
-
L:
|
|
7615
|
+
L: 200,
|
|
7529
7616
|
S: this,
|
|
7530
7617
|
C: (f, a) => f(...a)
|
|
7531
7618
|
});
|
|
@@ -7552,7 +7639,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7552
7639
|
count: loadedInvitations.invitations?.length
|
|
7553
7640
|
}, {
|
|
7554
7641
|
F: __dxlog_file27,
|
|
7555
|
-
L:
|
|
7642
|
+
L: 228,
|
|
7556
7643
|
S: this,
|
|
7557
7644
|
C: (f, a) => f(...a)
|
|
7558
7645
|
});
|
|
@@ -7560,13 +7647,13 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7560
7647
|
id: this._instanceId
|
|
7561
7648
|
}), {
|
|
7562
7649
|
F: __dxlog_file27,
|
|
7563
|
-
L:
|
|
7650
|
+
L: 230,
|
|
7564
7651
|
S: this,
|
|
7565
7652
|
C: (f, a) => f(...a)
|
|
7566
7653
|
});
|
|
7567
7654
|
(0, import_log22.log)("opened", void 0, {
|
|
7568
7655
|
F: __dxlog_file27,
|
|
7569
|
-
L:
|
|
7656
|
+
L: 231,
|
|
7570
7657
|
S: this,
|
|
7571
7658
|
C: (f, a) => f(...a)
|
|
7572
7659
|
});
|
|
@@ -7574,7 +7661,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7574
7661
|
async _close(ctx) {
|
|
7575
7662
|
(0, import_log22.log)("closing...", void 0, {
|
|
7576
7663
|
F: __dxlog_file27,
|
|
7577
|
-
L:
|
|
7664
|
+
L: 235,
|
|
7578
7665
|
S: this,
|
|
7579
7666
|
C: (f, a) => f(...a)
|
|
7580
7667
|
});
|
|
@@ -7593,7 +7680,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7593
7680
|
await this._edgeConnection?.close();
|
|
7594
7681
|
(0, import_log22.log)("closed", void 0, {
|
|
7595
7682
|
F: __dxlog_file27,
|
|
7596
|
-
L:
|
|
7683
|
+
L: 251,
|
|
7597
7684
|
S: this,
|
|
7598
7685
|
C: (f, a) => f(...a)
|
|
7599
7686
|
});
|
|
@@ -7604,7 +7691,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7604
7691
|
await identity.joinNetwork();
|
|
7605
7692
|
await this._initialize(new import_context16.Context(void 0, {
|
|
7606
7693
|
F: __dxlog_file27,
|
|
7607
|
-
L:
|
|
7694
|
+
L: 258
|
|
7608
7695
|
}));
|
|
7609
7696
|
return identity;
|
|
7610
7697
|
}
|
|
@@ -7615,7 +7702,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7615
7702
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
7616
7703
|
(0, import_invariant21.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
7617
7704
|
F: __dxlog_file27,
|
|
7618
|
-
L:
|
|
7705
|
+
L: 267,
|
|
7619
7706
|
S: this,
|
|
7620
7707
|
A: [
|
|
7621
7708
|
"factory",
|
|
@@ -7641,7 +7728,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7641
7728
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
7642
7729
|
await this._initialize(new import_context16.Context(void 0, {
|
|
7643
7730
|
F: __dxlog_file27,
|
|
7644
|
-
L:
|
|
7731
|
+
L: 286
|
|
7645
7732
|
}));
|
|
7646
7733
|
return identity;
|
|
7647
7734
|
}
|
|
@@ -7655,7 +7742,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7655
7742
|
async _initialize(ctx) {
|
|
7656
7743
|
(0, import_log22.log)("initializing spaces...", void 0, {
|
|
7657
7744
|
F: __dxlog_file27,
|
|
7658
|
-
L:
|
|
7745
|
+
L: 301,
|
|
7659
7746
|
S: this,
|
|
7660
7747
|
C: (f, a) => f(...a)
|
|
7661
7748
|
});
|
|
@@ -7694,7 +7781,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7694
7781
|
this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
|
|
7695
7782
|
(0, import_invariant21.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
7696
7783
|
F: __dxlog_file27,
|
|
7697
|
-
L:
|
|
7784
|
+
L: 339,
|
|
7698
7785
|
S: this,
|
|
7699
7786
|
A: [
|
|
7700
7787
|
"this.dataSpaceManager",
|
|
@@ -7718,7 +7805,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7718
7805
|
details: assertion
|
|
7719
7806
|
}, {
|
|
7720
7807
|
F: __dxlog_file27,
|
|
7721
|
-
L:
|
|
7808
|
+
L: 355,
|
|
7722
7809
|
S: this,
|
|
7723
7810
|
C: (f, a) => f(...a)
|
|
7724
7811
|
});
|
|
@@ -7729,7 +7816,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7729
7816
|
details: assertion
|
|
7730
7817
|
}, {
|
|
7731
7818
|
F: __dxlog_file27,
|
|
7732
|
-
L:
|
|
7819
|
+
L: 359,
|
|
7733
7820
|
S: this,
|
|
7734
7821
|
C: (f, a) => f(...a)
|
|
7735
7822
|
});
|
|
@@ -7740,7 +7827,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7740
7827
|
details: assertion
|
|
7741
7828
|
}, {
|
|
7742
7829
|
F: __dxlog_file27,
|
|
7743
|
-
L:
|
|
7830
|
+
L: 364,
|
|
7744
7831
|
S: this,
|
|
7745
7832
|
C: (f, a) => f(...a)
|
|
7746
7833
|
});
|
|
@@ -7751,7 +7838,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7751
7838
|
} catch (err) {
|
|
7752
7839
|
import_log22.log.catch(err, void 0, {
|
|
7753
7840
|
F: __dxlog_file27,
|
|
7754
|
-
L:
|
|
7841
|
+
L: 370,
|
|
7755
7842
|
S: this,
|
|
7756
7843
|
C: (f, a) => f(...a)
|
|
7757
7844
|
});
|
|
@@ -7772,7 +7859,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7772
7859
|
swarms: this.networkManager.topics
|
|
7773
7860
|
}, {
|
|
7774
7861
|
F: __dxlog_file27,
|
|
7775
|
-
L:
|
|
7862
|
+
L: 384,
|
|
7776
7863
|
S: this,
|
|
7777
7864
|
C: (f, a) => f(...a)
|
|
7778
7865
|
});
|
|
@@ -7786,7 +7873,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7786
7873
|
});
|
|
7787
7874
|
(0, import_invariant21.invariant)(identity.deviceCredentialChain, void 0, {
|
|
7788
7875
|
F: __dxlog_file27,
|
|
7789
|
-
L:
|
|
7876
|
+
L: 403,
|
|
7790
7877
|
S: this,
|
|
7791
7878
|
A: [
|
|
7792
7879
|
"identity.deviceCredentialChain",
|
|
@@ -8062,7 +8149,7 @@ var DevicesServiceImpl = class {
|
|
|
8062
8149
|
return this._identityManager.updateDeviceProfile(profile);
|
|
8063
8150
|
}
|
|
8064
8151
|
queryDevices() {
|
|
8065
|
-
return new
|
|
8152
|
+
return new import_stream11.Stream(({ next }) => {
|
|
8066
8153
|
const update = () => {
|
|
8067
8154
|
const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
|
|
8068
8155
|
if (!deviceKeys) {
|
|
@@ -8184,7 +8271,7 @@ var ContactsServiceImpl = class {
|
|
|
8184
8271
|
}
|
|
8185
8272
|
queryContacts() {
|
|
8186
8273
|
const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys20.PublicKey.hash);
|
|
8187
|
-
return new
|
|
8274
|
+
return new import_stream12.Stream(({ next, ctx }) => {
|
|
8188
8275
|
const pushUpdateTask = new import_async25.UpdateScheduler(ctx, async () => {
|
|
8189
8276
|
const contacts = await this.getContacts();
|
|
8190
8277
|
next(contacts);
|
|
@@ -8253,7 +8340,7 @@ var LoggingServiceImpl = class {
|
|
|
8253
8340
|
stats: (0, import_util16.numericalValues)(events, "duration")
|
|
8254
8341
|
};
|
|
8255
8342
|
};
|
|
8256
|
-
return new
|
|
8343
|
+
return new import_stream13.Stream(({ next }) => {
|
|
8257
8344
|
const update = () => {
|
|
8258
8345
|
const metrics2 = {
|
|
8259
8346
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -8275,7 +8362,7 @@ var LoggingServiceImpl = class {
|
|
|
8275
8362
|
});
|
|
8276
8363
|
}
|
|
8277
8364
|
queryLogs(request) {
|
|
8278
|
-
return new
|
|
8365
|
+
return new import_stream13.Stream(({ ctx, next }) => {
|
|
8279
8366
|
const handler = (entry2) => {
|
|
8280
8367
|
if (LOG_PROCESSING > 0) {
|
|
8281
8368
|
return;
|
|
@@ -8335,7 +8422,7 @@ var NetworkServiceImpl = class {
|
|
|
8335
8422
|
this.signalManager = signalManager;
|
|
8336
8423
|
}
|
|
8337
8424
|
queryStatus() {
|
|
8338
|
-
return new
|
|
8425
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8339
8426
|
const update = () => {
|
|
8340
8427
|
next({
|
|
8341
8428
|
swarm: this.networkManager.connectionState,
|
|
@@ -8358,6 +8445,35 @@ var NetworkServiceImpl = class {
|
|
|
8358
8445
|
async updateConfig(request) {
|
|
8359
8446
|
await this.networkManager.setConnectionState(request.swarm);
|
|
8360
8447
|
}
|
|
8448
|
+
async joinSwarm(request) {
|
|
8449
|
+
return this.signalManager.join(request);
|
|
8450
|
+
}
|
|
8451
|
+
async leaveSwarm(request) {
|
|
8452
|
+
return this.signalManager.leave(request);
|
|
8453
|
+
}
|
|
8454
|
+
subscribeSwarmState(request) {
|
|
8455
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8456
|
+
const unsubscribe = this.signalManager.swarmState?.on((state) => {
|
|
8457
|
+
if (request.topic.equals(state.swarmKey)) {
|
|
8458
|
+
next(state);
|
|
8459
|
+
}
|
|
8460
|
+
});
|
|
8461
|
+
return unsubscribe;
|
|
8462
|
+
});
|
|
8463
|
+
}
|
|
8464
|
+
async sendMessage(message) {
|
|
8465
|
+
return this.signalManager.sendMessage(message);
|
|
8466
|
+
}
|
|
8467
|
+
subscribeMessages(peer) {
|
|
8468
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8469
|
+
const unsubscribe = this.signalManager.onMessage.on((message) => {
|
|
8470
|
+
if (message.recipient.peerKey === peer.peerKey) {
|
|
8471
|
+
next(message);
|
|
8472
|
+
}
|
|
8473
|
+
});
|
|
8474
|
+
return unsubscribe;
|
|
8475
|
+
});
|
|
8476
|
+
}
|
|
8361
8477
|
};
|
|
8362
8478
|
var SystemServiceImpl = class {
|
|
8363
8479
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
@@ -8392,7 +8508,7 @@ var SystemServiceImpl = class {
|
|
|
8392
8508
|
}
|
|
8393
8509
|
// TODO(burdon): Standardize interval option in stream request?
|
|
8394
8510
|
queryStatus({ interval = 3e3 } = {}) {
|
|
8395
|
-
return new
|
|
8511
|
+
return new import_stream15.Stream(({ next }) => {
|
|
8396
8512
|
const update = () => {
|
|
8397
8513
|
next({
|
|
8398
8514
|
status: this._getCurrentStatus()
|
|
@@ -8858,4 +8974,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
8858
8974
|
subscribeToSpaces,
|
|
8859
8975
|
subscribeToSwarmInfo
|
|
8860
8976
|
});
|
|
8861
|
-
//# sourceMappingURL=chunk-
|
|
8977
|
+
//# sourceMappingURL=chunk-PK4NC3T7.cjs.map
|