@dxos/client-services 0.7.4 → 0.7.5-labs.071a3e2
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-423GRVVV.mjs → chunk-SKOL3Q2R.mjs} +379 -267
- package/dist/lib/browser/chunk-SKOL3Q2R.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-ZS24HRVA.cjs → chunk-XTM3FUCM.cjs} +405 -293
- package/dist/lib/node/chunk-XTM3FUCM.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-OQOXRHWF.mjs → chunk-EQU6BG5J.mjs} +379 -267
- package/dist/lib/node-esm/chunk-EQU6BG5J.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-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.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/spaces/edge-feed-replicator.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/src/version.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +38 -38
- 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.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 +3 -1
- package/src/packlets/spaces/data-space-manager.ts +1 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +16 -10
- 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 -5
- package/dist/lib/browser/chunk-423GRVVV.mjs.map +0 -7
- package/dist/lib/node/chunk-ZS24HRVA.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-OQOXRHWF.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_XTM3FUCM_exports = {};
|
|
30
|
+
__export(chunk_XTM3FUCM_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,24 +72,24 @@ __export(chunk_ZS24HRVA_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_XTM3FUCM_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.
|
|
738
|
+
var DXOS_VERSION = "0.7.5-labs.071a3e2";
|
|
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,
|
|
@@ -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,
|
|
@@ -1256,21 +1258,20 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1256
1258
|
});
|
|
1257
1259
|
return;
|
|
1258
1260
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
});
|
|
1261
|
+
if (message.type === "data") {
|
|
1262
|
+
(0, import_log3.log)("sending blocks", {
|
|
1263
|
+
feedKey: message.feedKey,
|
|
1264
|
+
blocks: message.blocks.map((b) => b.index)
|
|
1265
|
+
}, {
|
|
1266
|
+
F: __dxlog_file5,
|
|
1267
|
+
L: 151,
|
|
1268
|
+
S: this,
|
|
1269
|
+
C: (f, a) => f(...a)
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1271
1272
|
(0, import_invariant2.invariant)(message.feedKey, void 0, {
|
|
1272
1273
|
F: __dxlog_file5,
|
|
1273
|
-
L:
|
|
1274
|
+
L: 157,
|
|
1274
1275
|
S: this,
|
|
1275
1276
|
A: [
|
|
1276
1277
|
"message.feedKey",
|
|
@@ -1282,7 +1283,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1282
1283
|
type: message.type
|
|
1283
1284
|
}, {
|
|
1284
1285
|
F: __dxlog_file5,
|
|
1285
|
-
L:
|
|
1286
|
+
L: 160,
|
|
1286
1287
|
S: this,
|
|
1287
1288
|
C: (f, a) => f(...a)
|
|
1288
1289
|
});
|
|
@@ -1301,7 +1302,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1301
1302
|
if (!this._connectionCtx) {
|
|
1302
1303
|
import_log3.log.warn("received message after connection context was disposed", void 0, {
|
|
1303
1304
|
F: __dxlog_file5,
|
|
1304
|
-
L:
|
|
1305
|
+
L: 175,
|
|
1305
1306
|
S: this,
|
|
1306
1307
|
C: (f, a) => f(...a)
|
|
1307
1308
|
});
|
|
@@ -1312,14 +1313,6 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1312
1313
|
case "metadata": {
|
|
1313
1314
|
try {
|
|
1314
1315
|
var _usingCtx = _using_ctx();
|
|
1315
|
-
import_log3.log.info("received metadata", {
|
|
1316
|
-
message
|
|
1317
|
-
}, {
|
|
1318
|
-
F: __dxlog_file5,
|
|
1319
|
-
L: 178,
|
|
1320
|
-
S: this,
|
|
1321
|
-
C: (f, a) => f(...a)
|
|
1322
|
-
});
|
|
1323
1316
|
const feedKey = import_keys3.PublicKey.fromHex(message.feedKey);
|
|
1324
1317
|
const feed = this._feeds.get(feedKey);
|
|
1325
1318
|
if (!feed) {
|
|
@@ -1327,7 +1320,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1327
1320
|
feedKey
|
|
1328
1321
|
}, {
|
|
1329
1322
|
F: __dxlog_file5,
|
|
1330
|
-
L:
|
|
1323
|
+
L: 184,
|
|
1331
1324
|
S: this,
|
|
1332
1325
|
C: (f, a) => f(...a)
|
|
1333
1326
|
});
|
|
@@ -1335,7 +1328,18 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1335
1328
|
}
|
|
1336
1329
|
const _guard = _usingCtx.u(await this._getPushMutex(feed.key).acquire());
|
|
1337
1330
|
this._remoteLength.set(feedKey, message.length);
|
|
1331
|
+
const logMeta = {
|
|
1332
|
+
localLength: feed.length,
|
|
1333
|
+
remoteLength: message.length,
|
|
1334
|
+
feedKey
|
|
1335
|
+
};
|
|
1338
1336
|
if (message.length > feed.length) {
|
|
1337
|
+
(0, import_log3.log)("requesting missing blocks", logMeta, {
|
|
1338
|
+
F: __dxlog_file5,
|
|
1339
|
+
L: 194,
|
|
1340
|
+
S: this,
|
|
1341
|
+
C: (f, a) => f(...a)
|
|
1342
|
+
});
|
|
1339
1343
|
await this._sendMessage({
|
|
1340
1344
|
type: "request",
|
|
1341
1345
|
feedKey: feedKey.toHex(),
|
|
@@ -1345,6 +1349,12 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1345
1349
|
}
|
|
1346
1350
|
});
|
|
1347
1351
|
} else if (message.length < feed.length) {
|
|
1352
|
+
(0, import_log3.log)("pushing blocks to remote", logMeta, {
|
|
1353
|
+
F: __dxlog_file5,
|
|
1354
|
+
L: 202,
|
|
1355
|
+
S: this,
|
|
1356
|
+
C: (f, a) => f(...a)
|
|
1357
|
+
});
|
|
1348
1358
|
await this._pushBlocks(feed, message.length, feed.length);
|
|
1349
1359
|
}
|
|
1350
1360
|
break;
|
|
@@ -1355,12 +1365,12 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1355
1365
|
}
|
|
1356
1366
|
}
|
|
1357
1367
|
case "data": {
|
|
1358
|
-
import_log3.log
|
|
1368
|
+
(0, import_log3.log)("received data", {
|
|
1359
1369
|
feed: message.feedKey,
|
|
1360
1370
|
blocks: message.blocks.map((b) => b.index)
|
|
1361
1371
|
}, {
|
|
1362
1372
|
F: __dxlog_file5,
|
|
1363
|
-
L:
|
|
1373
|
+
L: 211,
|
|
1364
1374
|
S: this,
|
|
1365
1375
|
C: (f, a) => f(...a)
|
|
1366
1376
|
});
|
|
@@ -1371,7 +1381,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1371
1381
|
feedKey
|
|
1372
1382
|
}, {
|
|
1373
1383
|
F: __dxlog_file5,
|
|
1374
|
-
L:
|
|
1384
|
+
L: 216,
|
|
1375
1385
|
S: this,
|
|
1376
1386
|
C: (f, a) => f(...a)
|
|
1377
1387
|
});
|
|
@@ -1385,7 +1395,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1385
1395
|
...message
|
|
1386
1396
|
}, {
|
|
1387
1397
|
F: __dxlog_file5,
|
|
1388
|
-
L:
|
|
1398
|
+
L: 225,
|
|
1389
1399
|
S: this,
|
|
1390
1400
|
C: (f, a) => f(...a)
|
|
1391
1401
|
});
|
|
@@ -1394,13 +1404,13 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1394
1404
|
});
|
|
1395
1405
|
}
|
|
1396
1406
|
async _pushBlocks(feed, from, to) {
|
|
1397
|
-
import_log3.log
|
|
1407
|
+
(0, import_log3.log)("pushing blocks", {
|
|
1398
1408
|
feed: feed.key.toHex(),
|
|
1399
1409
|
from,
|
|
1400
1410
|
to
|
|
1401
1411
|
}, {
|
|
1402
1412
|
F: __dxlog_file5,
|
|
1403
|
-
L:
|
|
1413
|
+
L: 232,
|
|
1404
1414
|
S: this,
|
|
1405
1415
|
C: (f, a) => f(...a)
|
|
1406
1416
|
});
|
|
@@ -1410,7 +1420,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1410
1420
|
});
|
|
1411
1421
|
(0, import_invariant2.invariant)(data instanceof Uint8Array, void 0, {
|
|
1412
1422
|
F: __dxlog_file5,
|
|
1413
|
-
L:
|
|
1423
|
+
L: 237,
|
|
1414
1424
|
S: this,
|
|
1415
1425
|
A: [
|
|
1416
1426
|
"data instanceof Uint8Array",
|
|
@@ -1433,12 +1443,12 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1433
1443
|
this._remoteLength.set(feed.key, to);
|
|
1434
1444
|
}
|
|
1435
1445
|
async _integrateBlocks(feed, blocks) {
|
|
1436
|
-
import_log3.log
|
|
1446
|
+
(0, import_log3.log)("integrating blocks", {
|
|
1437
1447
|
feed: feed.key.toHex(),
|
|
1438
1448
|
blocks: blocks.length
|
|
1439
1449
|
}, {
|
|
1440
1450
|
F: __dxlog_file5,
|
|
1441
|
-
L:
|
|
1451
|
+
L: 258,
|
|
1442
1452
|
S: this,
|
|
1443
1453
|
C: (f, a) => f(...a)
|
|
1444
1454
|
});
|
|
@@ -1460,7 +1470,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1460
1470
|
if (!this._remoteLength.has(feed.key)) {
|
|
1461
1471
|
(0, import_log3.log)("blocks not pushed because remote length is unknown", void 0, {
|
|
1462
1472
|
F: __dxlog_file5,
|
|
1463
|
-
L:
|
|
1473
|
+
L: 279,
|
|
1464
1474
|
S: this,
|
|
1465
1475
|
C: (f, a) => f(...a)
|
|
1466
1476
|
});
|
|
@@ -1485,7 +1495,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1485
1495
|
if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
|
|
1486
1496
|
(0, import_log3.log)("resetting on reconnect", void 0, {
|
|
1487
1497
|
F: __dxlog_file5,
|
|
1488
|
-
L:
|
|
1498
|
+
L: 296,
|
|
1489
1499
|
S: this,
|
|
1490
1500
|
C: (f, a) => f(...a)
|
|
1491
1501
|
});
|
|
@@ -1496,7 +1506,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
|
|
|
1496
1506
|
}
|
|
1497
1507
|
}, {
|
|
1498
1508
|
F: __dxlog_file5,
|
|
1499
|
-
L:
|
|
1509
|
+
L: 290
|
|
1500
1510
|
});
|
|
1501
1511
|
return connectionCtx;
|
|
1502
1512
|
}
|
|
@@ -1625,6 +1635,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1625
1635
|
this._processedCredentials = new import_util5.ComplexSet(import_keys5.PublicKey.hash);
|
|
1626
1636
|
this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys5.PublicKey.hash);
|
|
1627
1637
|
this._activeEdgePollingIntervalHandle = void 0;
|
|
1638
|
+
this._activeEdgePollingEnabled = false;
|
|
1628
1639
|
this._spaceId = params.spaceId;
|
|
1629
1640
|
this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
|
|
1630
1641
|
if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
|
|
@@ -1632,15 +1643,6 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1632
1643
|
}
|
|
1633
1644
|
}
|
|
1634
1645
|
setActiveEdgePollingEnabled(enabled) {
|
|
1635
|
-
(0, import_invariant5.invariant)(this.isOpen, void 0, {
|
|
1636
|
-
F: __dxlog_file7,
|
|
1637
|
-
L: 109,
|
|
1638
|
-
S: this,
|
|
1639
|
-
A: [
|
|
1640
|
-
"this.isOpen",
|
|
1641
|
-
""
|
|
1642
|
-
]
|
|
1643
|
-
});
|
|
1644
1646
|
const client = this._edgeClient;
|
|
1645
1647
|
(0, import_invariant5.invariant)(client, void 0, {
|
|
1646
1648
|
F: __dxlog_file7,
|
|
@@ -1651,30 +1653,30 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1651
1653
|
""
|
|
1652
1654
|
]
|
|
1653
1655
|
});
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1662
|
-
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
|
+
}
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
1665
|
get hasWriter() {
|
|
1666
1666
|
return !!this._writer;
|
|
1667
1667
|
}
|
|
1668
1668
|
async _open() {
|
|
1669
|
-
if (this._edgeClient
|
|
1670
|
-
|
|
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
|
+
}
|
|
1671
1676
|
}
|
|
1672
1677
|
}
|
|
1673
1678
|
async _close() {
|
|
1674
|
-
|
|
1675
|
-
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1676
|
-
this._activeEdgePollingIntervalHandle = void 0;
|
|
1677
|
-
}
|
|
1679
|
+
this._stopPeriodicEdgePolling();
|
|
1678
1680
|
await this._ctx.dispose();
|
|
1679
1681
|
}
|
|
1680
1682
|
/**
|
|
@@ -1852,10 +1854,23 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1852
1854
|
]
|
|
1853
1855
|
});
|
|
1854
1856
|
this._writer = writer;
|
|
1855
|
-
if (this._edgeClient) {
|
|
1857
|
+
if (this._edgeClient && this.isOpen) {
|
|
1856
1858
|
this._notarizePendingEdgeCredentials(this._edgeClient, writer);
|
|
1857
1859
|
}
|
|
1858
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
|
+
}
|
|
1859
1874
|
/**
|
|
1860
1875
|
* The method is used only for adding agent feeds to spaces.
|
|
1861
1876
|
* When an agent is created we can admit them into all the existing spaces. In case the operation fails
|
|
@@ -1874,7 +1889,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1874
1889
|
if (!credentials.length) {
|
|
1875
1890
|
(0, import_log5.log)("edge did not return credentials for notarization", void 0, {
|
|
1876
1891
|
F: __dxlog_file7,
|
|
1877
|
-
L:
|
|
1892
|
+
L: 311,
|
|
1878
1893
|
S: this,
|
|
1879
1894
|
C: (f, a) => f(...a)
|
|
1880
1895
|
});
|
|
@@ -1884,7 +1899,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1884
1899
|
count: credentials.length
|
|
1885
1900
|
}, {
|
|
1886
1901
|
F: __dxlog_file7,
|
|
1887
|
-
L:
|
|
1902
|
+
L: 315,
|
|
1888
1903
|
S: this,
|
|
1889
1904
|
C: (f, a) => f(...a)
|
|
1890
1905
|
});
|
|
@@ -1897,7 +1912,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1897
1912
|
count: decodedCredentials.length
|
|
1898
1913
|
}, {
|
|
1899
1914
|
F: __dxlog_file7,
|
|
1900
|
-
L:
|
|
1915
|
+
L: 324,
|
|
1901
1916
|
S: this,
|
|
1902
1917
|
C: (f, a) => f(...a)
|
|
1903
1918
|
});
|
|
@@ -1925,7 +1940,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1925
1940
|
for (const credential of credentials) {
|
|
1926
1941
|
(0, import_invariant5.invariant)(credential.id, "Credential must have an id", {
|
|
1927
1942
|
F: __dxlog_file7,
|
|
1928
|
-
L:
|
|
1943
|
+
L: 350,
|
|
1929
1944
|
S: this,
|
|
1930
1945
|
A: [
|
|
1931
1946
|
"credential.id",
|
|
@@ -1949,7 +1964,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1949
1964
|
peer: extension.localPeerId
|
|
1950
1965
|
}, {
|
|
1951
1966
|
F: __dxlog_file7,
|
|
1952
|
-
L:
|
|
1967
|
+
L: 365,
|
|
1953
1968
|
S: this,
|
|
1954
1969
|
C: (f, a) => f(...a)
|
|
1955
1970
|
});
|
|
@@ -1961,7 +1976,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1961
1976
|
peer: extension.localPeerId
|
|
1962
1977
|
}, {
|
|
1963
1978
|
F: __dxlog_file7,
|
|
1964
|
-
L:
|
|
1979
|
+
L: 370,
|
|
1965
1980
|
S: this,
|
|
1966
1981
|
C: (f, a) => f(...a)
|
|
1967
1982
|
});
|
|
@@ -1978,7 +1993,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1978
1993
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1979
1994
|
}, {
|
|
1980
1995
|
F: __dxlog_file7,
|
|
1981
|
-
L:
|
|
1996
|
+
L: 382,
|
|
1982
1997
|
S: this,
|
|
1983
1998
|
C: (f, a) => f(...a)
|
|
1984
1999
|
});
|
|
@@ -1994,7 +2009,7 @@ var handleEdgeError = (error) => {
|
|
|
1994
2009
|
if (!(error instanceof import_protocols4.EdgeCallFailedError) || error.errorData) {
|
|
1995
2010
|
import_log5.log.catch(error, void 0, {
|
|
1996
2011
|
F: __dxlog_file7,
|
|
1997
|
-
L:
|
|
2012
|
+
L: 396,
|
|
1998
2013
|
S: void 0,
|
|
1999
2014
|
C: (f, a) => f(...a)
|
|
2000
2015
|
});
|
|
@@ -2003,7 +2018,7 @@ var handleEdgeError = (error) => {
|
|
|
2003
2018
|
reason: error.reason
|
|
2004
2019
|
}, {
|
|
2005
2020
|
F: __dxlog_file7,
|
|
2006
|
-
L:
|
|
2021
|
+
L: 398,
|
|
2007
2022
|
S: void 0,
|
|
2008
2023
|
C: (f, a) => f(...a)
|
|
2009
2024
|
});
|
|
@@ -2771,7 +2786,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2771
2786
|
guestKeypair: invitation.guestKey ? {
|
|
2772
2787
|
publicKey: invitation.guestKey
|
|
2773
2788
|
} : void 0,
|
|
2774
|
-
lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
|
|
2789
|
+
lifetime: invitation.expiresOn ? (invitation.expiresOn.getTime() - Date.now()) / 1e3 : void 0,
|
|
2775
2790
|
multiUse: invitation.multiUse,
|
|
2776
2791
|
delegationCredentialId: credentialId,
|
|
2777
2792
|
persistent: false
|
|
@@ -2843,7 +2858,7 @@ var SpacesServiceImpl = class {
|
|
|
2843
2858
|
const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2844
2859
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2845
2860
|
F: __dxlog_file10,
|
|
2846
|
-
L:
|
|
2861
|
+
L: 111,
|
|
2847
2862
|
S: this,
|
|
2848
2863
|
A: [
|
|
2849
2864
|
"credentials[0].credential",
|
|
@@ -2853,7 +2868,7 @@ var SpacesServiceImpl = class {
|
|
|
2853
2868
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2854
2869
|
(0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2855
2870
|
F: __dxlog_file10,
|
|
2856
|
-
L:
|
|
2871
|
+
L: 113,
|
|
2857
2872
|
S: this,
|
|
2858
2873
|
A: [
|
|
2859
2874
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2863,15 +2878,15 @@ var SpacesServiceImpl = class {
|
|
|
2863
2878
|
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
2864
2879
|
}
|
|
2865
2880
|
querySpaces() {
|
|
2866
|
-
return new
|
|
2881
|
+
return new import_stream7.Stream(({ next, ctx }) => {
|
|
2867
2882
|
const scheduler = new import_async12.UpdateScheduler(ctx, async () => {
|
|
2868
2883
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2869
|
-
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)));
|
|
2870
2885
|
(0, import_log9.log)("update", () => ({
|
|
2871
2886
|
ids: spaces.map((space) => space.id)
|
|
2872
2887
|
}), {
|
|
2873
2888
|
F: __dxlog_file10,
|
|
2874
|
-
L:
|
|
2889
|
+
L: 126,
|
|
2875
2890
|
S: this,
|
|
2876
2891
|
C: (f, a) => f(...a)
|
|
2877
2892
|
});
|
|
@@ -2923,7 +2938,7 @@ var SpacesServiceImpl = class {
|
|
|
2923
2938
|
await space.postMessage(getChannelId(channel), message);
|
|
2924
2939
|
}
|
|
2925
2940
|
subscribeMessages({ spaceKey, channel }) {
|
|
2926
|
-
return new
|
|
2941
|
+
return new import_stream7.Stream(({ ctx, next }) => {
|
|
2927
2942
|
(0, import_async12.scheduleTask)(ctx, async () => {
|
|
2928
2943
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2929
2944
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
@@ -2935,7 +2950,7 @@ var SpacesServiceImpl = class {
|
|
|
2935
2950
|
});
|
|
2936
2951
|
}
|
|
2937
2952
|
queryCredentials({ spaceKey, noTail }) {
|
|
2938
|
-
return new
|
|
2953
|
+
return new import_stream7.Stream(({ ctx, next, close }) => {
|
|
2939
2954
|
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
2940
2955
|
const processor = {
|
|
2941
2956
|
processCredential: async (credential) => {
|
|
@@ -2963,7 +2978,7 @@ var SpacesServiceImpl = class {
|
|
|
2963
2978
|
} else {
|
|
2964
2979
|
(0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2965
2980
|
F: __dxlog_file10,
|
|
2966
|
-
L:
|
|
2981
|
+
L: 224,
|
|
2967
2982
|
S: this,
|
|
2968
2983
|
A: [
|
|
2969
2984
|
"!credential.id",
|
|
@@ -2972,7 +2987,7 @@ var SpacesServiceImpl = class {
|
|
|
2972
2987
|
});
|
|
2973
2988
|
(0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
2974
2989
|
F: __dxlog_file10,
|
|
2975
|
-
L:
|
|
2990
|
+
L: 225,
|
|
2976
2991
|
S: this,
|
|
2977
2992
|
A: [
|
|
2978
2993
|
"this._identityManager.identity",
|
|
@@ -2982,7 +2997,7 @@ var SpacesServiceImpl = class {
|
|
|
2982
2997
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2983
2998
|
(0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2984
2999
|
F: __dxlog_file10,
|
|
2985
|
-
L:
|
|
3000
|
+
L: 227,
|
|
2986
3001
|
S: this,
|
|
2987
3002
|
A: [
|
|
2988
3003
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -3032,7 +3047,7 @@ var SpacesServiceImpl = class {
|
|
|
3032
3047
|
const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
|
|
3033
3048
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3034
3049
|
F: __dxlog_file10,
|
|
3035
|
-
L:
|
|
3050
|
+
L: 261,
|
|
3036
3051
|
S: this,
|
|
3037
3052
|
A: [
|
|
3038
3053
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3042,7 +3057,7 @@ var SpacesServiceImpl = class {
|
|
|
3042
3057
|
const myIdentity = this._identityManager.identity;
|
|
3043
3058
|
(0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
3044
3059
|
F: __dxlog_file10,
|
|
3045
|
-
L:
|
|
3060
|
+
L: 263,
|
|
3046
3061
|
S: this,
|
|
3047
3062
|
A: [
|
|
3048
3063
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -3063,10 +3078,10 @@ var SpacesServiceImpl = class {
|
|
|
3063
3078
|
});
|
|
3064
3079
|
}
|
|
3065
3080
|
return {
|
|
3066
|
-
space: this._serializeSpace(dataSpace)
|
|
3081
|
+
space: await this._serializeSpace(dataSpace)
|
|
3067
3082
|
};
|
|
3068
3083
|
}
|
|
3069
|
-
_serializeSpace(space) {
|
|
3084
|
+
async _serializeSpace(space) {
|
|
3070
3085
|
return {
|
|
3071
3086
|
id: space.id,
|
|
3072
3087
|
spaceKey: space.key,
|
|
@@ -3086,7 +3101,7 @@ var SpacesServiceImpl = class {
|
|
|
3086
3101
|
totalDataTimeframe: void 0,
|
|
3087
3102
|
spaceRootUrl: space.databaseRoot?.url
|
|
3088
3103
|
},
|
|
3089
|
-
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) => {
|
|
3090
3105
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
3091
3106
|
const isMe = this._identityManager.identity?.identityKey.equals(member.key);
|
|
3092
3107
|
if (isMe) {
|
|
@@ -3094,6 +3109,7 @@ var SpacesServiceImpl = class {
|
|
|
3094
3109
|
}
|
|
3095
3110
|
return {
|
|
3096
3111
|
identity: {
|
|
3112
|
+
did: await (0, import_credentials13.createDidFromIdentityKey)(member.key),
|
|
3097
3113
|
identityKey: member.key,
|
|
3098
3114
|
profile: member.profile ?? {}
|
|
3099
3115
|
},
|
|
@@ -3101,7 +3117,7 @@ var SpacesServiceImpl = class {
|
|
|
3101
3117
|
presence: peers.length > 0 ? import_services7.SpaceMember.PresenceState.ONLINE : import_services7.SpaceMember.PresenceState.OFFLINE,
|
|
3102
3118
|
peerStates: peers
|
|
3103
3119
|
};
|
|
3104
|
-
}),
|
|
3120
|
+
})),
|
|
3105
3121
|
creator: space.inner.spaceState.creator?.key,
|
|
3106
3122
|
cache: space.cache,
|
|
3107
3123
|
metrics: space.metrics,
|
|
@@ -3144,13 +3160,14 @@ var Identity = class {
|
|
|
3144
3160
|
this.space = params.space;
|
|
3145
3161
|
this._signer = params.signer;
|
|
3146
3162
|
this._presence = params.presence;
|
|
3163
|
+
this.did = params.did;
|
|
3147
3164
|
this.identityKey = params.identityKey;
|
|
3148
3165
|
this.deviceKey = params.deviceKey;
|
|
3149
3166
|
import_log6.log.trace("dxos.halo.device", {
|
|
3150
3167
|
deviceKey: params.deviceKey
|
|
3151
3168
|
}, {
|
|
3152
3169
|
F: __dxlog_file11,
|
|
3153
|
-
L:
|
|
3170
|
+
L: 82,
|
|
3154
3171
|
S: this,
|
|
3155
3172
|
C: (f, a) => f(...a)
|
|
3156
3173
|
});
|
|
@@ -3252,7 +3269,7 @@ var Identity = class {
|
|
|
3252
3269
|
getIdentityCredentialSigner() {
|
|
3253
3270
|
(0, import_invariant6.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
3254
3271
|
F: __dxlog_file11,
|
|
3255
|
-
L:
|
|
3272
|
+
L: 198,
|
|
3256
3273
|
S: this,
|
|
3257
3274
|
A: [
|
|
3258
3275
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -3296,7 +3313,7 @@ var Identity = class {
|
|
|
3296
3313
|
dataFeedKey
|
|
3297
3314
|
}, {
|
|
3298
3315
|
F: __dxlog_file11,
|
|
3299
|
-
L:
|
|
3316
|
+
L: 223,
|
|
3300
3317
|
S: this,
|
|
3301
3318
|
C: (f, a) => f(...a)
|
|
3302
3319
|
});
|
|
@@ -3379,7 +3396,7 @@ var IdentityManager = class {
|
|
|
3379
3396
|
id: traceId
|
|
3380
3397
|
}), {
|
|
3381
3398
|
F: __dxlog_file12,
|
|
3382
|
-
L:
|
|
3399
|
+
L: 116,
|
|
3383
3400
|
S: this,
|
|
3384
3401
|
C: (f, a) => f(...a)
|
|
3385
3402
|
});
|
|
@@ -3388,7 +3405,7 @@ var IdentityManager = class {
|
|
|
3388
3405
|
identityRecord
|
|
3389
3406
|
}, {
|
|
3390
3407
|
F: __dxlog_file12,
|
|
3391
|
-
L:
|
|
3408
|
+
L: 119,
|
|
3392
3409
|
S: this,
|
|
3393
3410
|
C: (f, a) => f(...a)
|
|
3394
3411
|
});
|
|
@@ -3401,7 +3418,7 @@ var IdentityManager = class {
|
|
|
3401
3418
|
displayName: this._identity.profileDocument?.displayName
|
|
3402
3419
|
}, {
|
|
3403
3420
|
F: __dxlog_file12,
|
|
3404
|
-
L:
|
|
3421
|
+
L: 124,
|
|
3405
3422
|
S: this,
|
|
3406
3423
|
C: (f, a) => f(...a)
|
|
3407
3424
|
});
|
|
@@ -3411,7 +3428,7 @@ var IdentityManager = class {
|
|
|
3411
3428
|
id: traceId
|
|
3412
3429
|
}), {
|
|
3413
3430
|
F: __dxlog_file12,
|
|
3414
|
-
L:
|
|
3431
|
+
L: 131,
|
|
3415
3432
|
S: this,
|
|
3416
3433
|
C: (f, a) => f(...a)
|
|
3417
3434
|
});
|
|
@@ -3419,13 +3436,13 @@ var IdentityManager = class {
|
|
|
3419
3436
|
async close() {
|
|
3420
3437
|
await this._identity?.close(new import_context8.Context(void 0, {
|
|
3421
3438
|
F: __dxlog_file12,
|
|
3422
|
-
L:
|
|
3439
|
+
L: 135
|
|
3423
3440
|
}));
|
|
3424
3441
|
}
|
|
3425
3442
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
3426
3443
|
(0, import_invariant9.invariant)(!this._identity, "Identity already exists.", {
|
|
3427
3444
|
F: __dxlog_file12,
|
|
3428
|
-
L:
|
|
3445
|
+
L: 140,
|
|
3429
3446
|
S: this,
|
|
3430
3447
|
A: [
|
|
3431
3448
|
"!this._identity",
|
|
@@ -3434,7 +3451,7 @@ var IdentityManager = class {
|
|
|
3434
3451
|
});
|
|
3435
3452
|
(0, import_log10.log)("creating identity...", void 0, {
|
|
3436
3453
|
F: __dxlog_file12,
|
|
3437
|
-
L:
|
|
3454
|
+
L: 141,
|
|
3438
3455
|
S: this,
|
|
3439
3456
|
C: (f, a) => f(...a)
|
|
3440
3457
|
});
|
|
@@ -3452,13 +3469,13 @@ var IdentityManager = class {
|
|
|
3452
3469
|
const identity = await this._constructIdentity(identityRecord);
|
|
3453
3470
|
await identity.open(new import_context8.Context(void 0, {
|
|
3454
3471
|
F: __dxlog_file12,
|
|
3455
|
-
L:
|
|
3472
|
+
L: 156
|
|
3456
3473
|
}));
|
|
3457
3474
|
{
|
|
3458
3475
|
const generator = new import_credentials14.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
3459
3476
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
3460
3477
|
F: __dxlog_file12,
|
|
3461
|
-
L:
|
|
3478
|
+
L: 160,
|
|
3462
3479
|
S: this,
|
|
3463
3480
|
A: [
|
|
3464
3481
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -3467,7 +3484,7 @@ var IdentityManager = class {
|
|
|
3467
3484
|
});
|
|
3468
3485
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
3469
3486
|
F: __dxlog_file12,
|
|
3470
|
-
L:
|
|
3487
|
+
L: 161,
|
|
3471
3488
|
S: this,
|
|
3472
3489
|
A: [
|
|
3473
3490
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3506,7 +3523,7 @@ var IdentityManager = class {
|
|
|
3506
3523
|
displayName: this._identity.profileDocument?.displayName
|
|
3507
3524
|
}, {
|
|
3508
3525
|
F: __dxlog_file12,
|
|
3509
|
-
L:
|
|
3526
|
+
L: 199,
|
|
3510
3527
|
S: this,
|
|
3511
3528
|
C: (f, a) => f(...a)
|
|
3512
3529
|
});
|
|
@@ -3517,7 +3534,7 @@ var IdentityManager = class {
|
|
|
3517
3534
|
profile: identity.profileDocument
|
|
3518
3535
|
}, {
|
|
3519
3536
|
F: __dxlog_file12,
|
|
3520
|
-
L:
|
|
3537
|
+
L: 205,
|
|
3521
3538
|
S: this,
|
|
3522
3539
|
C: (f, a) => f(...a)
|
|
3523
3540
|
});
|
|
@@ -3554,13 +3571,13 @@ var IdentityManager = class {
|
|
|
3554
3571
|
params
|
|
3555
3572
|
}, {
|
|
3556
3573
|
F: __dxlog_file12,
|
|
3557
|
-
L:
|
|
3574
|
+
L: 244,
|
|
3558
3575
|
S: this,
|
|
3559
3576
|
C: (f, a) => f(...a)
|
|
3560
3577
|
});
|
|
3561
3578
|
(0, import_invariant9.invariant)(!this._identity, "Identity already exists.", {
|
|
3562
3579
|
F: __dxlog_file12,
|
|
3563
|
-
L:
|
|
3580
|
+
L: 245,
|
|
3564
3581
|
S: this,
|
|
3565
3582
|
A: [
|
|
3566
3583
|
"!this._identity",
|
|
@@ -3581,7 +3598,7 @@ var IdentityManager = class {
|
|
|
3581
3598
|
const identity = await this._constructIdentity(identityRecord);
|
|
3582
3599
|
await identity.open(new import_context8.Context(void 0, {
|
|
3583
3600
|
F: __dxlog_file12,
|
|
3584
|
-
L:
|
|
3601
|
+
L: 259
|
|
3585
3602
|
}));
|
|
3586
3603
|
return {
|
|
3587
3604
|
identity,
|
|
@@ -3600,7 +3617,7 @@ var IdentityManager = class {
|
|
|
3600
3617
|
displayName: this._identity.profileDocument?.displayName
|
|
3601
3618
|
}, {
|
|
3602
3619
|
F: __dxlog_file12,
|
|
3603
|
-
L:
|
|
3620
|
+
L: 273,
|
|
3604
3621
|
S: this,
|
|
3605
3622
|
C: (f, a) => f(...a)
|
|
3606
3623
|
});
|
|
@@ -3614,7 +3631,7 @@ var IdentityManager = class {
|
|
|
3614
3631
|
deviceKey: identity.deviceKey
|
|
3615
3632
|
}, {
|
|
3616
3633
|
F: __dxlog_file12,
|
|
3617
|
-
L:
|
|
3634
|
+
L: 284,
|
|
3618
3635
|
S: this,
|
|
3619
3636
|
C: (f, a) => f(...a)
|
|
3620
3637
|
});
|
|
@@ -3625,7 +3642,7 @@ var IdentityManager = class {
|
|
|
3625
3642
|
async updateProfile(profile) {
|
|
3626
3643
|
(0, import_invariant9.invariant)(this._identity, "Identity not initialized.", {
|
|
3627
3644
|
F: __dxlog_file12,
|
|
3628
|
-
L:
|
|
3645
|
+
L: 291,
|
|
3629
3646
|
S: this,
|
|
3630
3647
|
A: [
|
|
3631
3648
|
"this._identity",
|
|
@@ -3656,7 +3673,7 @@ var IdentityManager = class {
|
|
|
3656
3673
|
async updateDeviceProfile(profile) {
|
|
3657
3674
|
(0, import_invariant9.invariant)(this._identity, "Identity not initialized.", {
|
|
3658
3675
|
F: __dxlog_file12,
|
|
3659
|
-
L:
|
|
3676
|
+
L: 308,
|
|
3660
3677
|
S: this,
|
|
3661
3678
|
A: [
|
|
3662
3679
|
"this._identity",
|
|
@@ -3689,48 +3706,10 @@ var IdentityManager = class {
|
|
|
3689
3706
|
profile
|
|
3690
3707
|
};
|
|
3691
3708
|
}
|
|
3692
|
-
async createRecoveryPhrase() {
|
|
3693
|
-
const identity = this._identity;
|
|
3694
|
-
(0, import_invariant9.invariant)(identity, void 0, {
|
|
3695
|
-
F: __dxlog_file12,
|
|
3696
|
-
L: 340,
|
|
3697
|
-
S: this,
|
|
3698
|
-
A: [
|
|
3699
|
-
"identity",
|
|
3700
|
-
""
|
|
3701
|
-
]
|
|
3702
|
-
});
|
|
3703
|
-
const seedphrase = (0, import_credentials14.generateSeedPhrase)();
|
|
3704
|
-
const keypair = (0, import_credentials14.keyPairFromSeedPhrase)(seedphrase);
|
|
3705
|
-
const recoveryKey = import_keys9.PublicKey.from(keypair.publicKey);
|
|
3706
|
-
const identityKey = identity.identityKey;
|
|
3707
|
-
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
3708
|
-
subject: identityKey,
|
|
3709
|
-
assertion: {
|
|
3710
|
-
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
3711
|
-
recoveryKey,
|
|
3712
|
-
identityKey
|
|
3713
|
-
}
|
|
3714
|
-
});
|
|
3715
|
-
const receipt = await identity.controlPipeline.writer.write({
|
|
3716
|
-
credential: {
|
|
3717
|
-
credential
|
|
3718
|
-
}
|
|
3719
|
-
});
|
|
3720
|
-
await identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe4.Timeframe([
|
|
3721
|
-
[
|
|
3722
|
-
receipt.feedKey,
|
|
3723
|
-
receipt.seq
|
|
3724
|
-
]
|
|
3725
|
-
]));
|
|
3726
|
-
return {
|
|
3727
|
-
seedphrase
|
|
3728
|
-
};
|
|
3729
|
-
}
|
|
3730
3709
|
async _constructIdentity(identityRecord) {
|
|
3731
3710
|
(0, import_invariant9.invariant)(!this._identity, void 0, {
|
|
3732
3711
|
F: __dxlog_file12,
|
|
3733
|
-
L:
|
|
3712
|
+
L: 334,
|
|
3734
3713
|
S: this,
|
|
3735
3714
|
A: [
|
|
3736
3715
|
"!this._identity",
|
|
@@ -3741,7 +3720,7 @@ var IdentityManager = class {
|
|
|
3741
3720
|
identityRecord
|
|
3742
3721
|
}, {
|
|
3743
3722
|
F: __dxlog_file12,
|
|
3744
|
-
L:
|
|
3723
|
+
L: 335,
|
|
3745
3724
|
S: this,
|
|
3746
3725
|
C: (f, a) => f(...a)
|
|
3747
3726
|
});
|
|
@@ -3756,7 +3735,7 @@ var IdentityManager = class {
|
|
|
3756
3735
|
});
|
|
3757
3736
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
3758
3737
|
F: __dxlog_file12,
|
|
3759
|
-
L:
|
|
3738
|
+
L: 348,
|
|
3760
3739
|
S: this,
|
|
3761
3740
|
A: [
|
|
3762
3741
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -3768,7 +3747,7 @@ var IdentityManager = class {
|
|
|
3768
3747
|
});
|
|
3769
3748
|
(0, import_invariant9.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
3770
3749
|
F: __dxlog_file12,
|
|
3771
|
-
L:
|
|
3750
|
+
L: 352,
|
|
3772
3751
|
S: this,
|
|
3773
3752
|
A: [
|
|
3774
3753
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -3792,10 +3771,12 @@ var IdentityManager = class {
|
|
|
3792
3771
|
});
|
|
3793
3772
|
await space.setControlFeed(controlFeed);
|
|
3794
3773
|
await space.setDataFeed(dataFeed);
|
|
3774
|
+
const did = await (0, import_credentials14.createDidFromIdentityKey)(identityRecord.identityKey);
|
|
3795
3775
|
const identity = new Identity({
|
|
3796
3776
|
space,
|
|
3797
3777
|
presence,
|
|
3798
3778
|
signer: this._keyring,
|
|
3779
|
+
did,
|
|
3799
3780
|
identityKey: identityRecord.identityKey,
|
|
3800
3781
|
deviceKey: identityRecord.deviceKey,
|
|
3801
3782
|
edgeConnection: this._edgeConnection,
|
|
@@ -3805,7 +3786,7 @@ var IdentityManager = class {
|
|
|
3805
3786
|
identityKey: identityRecord.identityKey
|
|
3806
3787
|
}, {
|
|
3807
3788
|
F: __dxlog_file12,
|
|
3808
|
-
L:
|
|
3789
|
+
L: 383,
|
|
3809
3790
|
S: this,
|
|
3810
3791
|
C: (f, a) => f(...a)
|
|
3811
3792
|
});
|
|
@@ -3830,7 +3811,7 @@ var IdentityManager = class {
|
|
|
3830
3811
|
onAuthFailure: () => {
|
|
3831
3812
|
import_log10.log.warn("auth failure", void 0, {
|
|
3832
3813
|
F: __dxlog_file12,
|
|
3833
|
-
L:
|
|
3814
|
+
L: 408,
|
|
3834
3815
|
S: this,
|
|
3835
3816
|
C: (f, a) => f(...a)
|
|
3836
3817
|
});
|
|
@@ -3883,7 +3864,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3883
3864
|
const identity = this._identityManager.identity;
|
|
3884
3865
|
(0, import_invariant10.invariant)(identity, void 0, {
|
|
3885
3866
|
F: __dxlog_file13,
|
|
3886
|
-
L:
|
|
3867
|
+
L: 61,
|
|
3887
3868
|
S: this,
|
|
3888
3869
|
A: [
|
|
3889
3870
|
"identity",
|
|
@@ -3893,7 +3874,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3893
3874
|
await identity.updateDefaultSpace(space.id);
|
|
3894
3875
|
}
|
|
3895
3876
|
queryIdentity() {
|
|
3896
|
-
return new
|
|
3877
|
+
return new import_stream8.Stream(({ next }) => {
|
|
3897
3878
|
const emitNext = () => next({
|
|
3898
3879
|
identity: this._getIdentity()
|
|
3899
3880
|
});
|
|
@@ -3906,6 +3887,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3906
3887
|
return void 0;
|
|
3907
3888
|
}
|
|
3908
3889
|
return {
|
|
3890
|
+
did: this._identityManager.identity.did,
|
|
3909
3891
|
identityKey: this._identityManager.identity.identityKey,
|
|
3910
3892
|
spaceKey: this._identityManager.identity.space.key,
|
|
3911
3893
|
profile: this._identityManager.identity.profileDocument
|
|
@@ -3914,7 +3896,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3914
3896
|
async updateProfile(profile) {
|
|
3915
3897
|
(0, import_invariant10.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
3916
3898
|
F: __dxlog_file13,
|
|
3917
|
-
L:
|
|
3899
|
+
L: 88,
|
|
3918
3900
|
S: this,
|
|
3919
3901
|
A: [
|
|
3920
3902
|
"this._identityManager.identity",
|
|
@@ -3925,18 +3907,29 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3925
3907
|
await this._onProfileUpdate?.(this._identityManager.identity.profileDocument);
|
|
3926
3908
|
return this._getIdentity();
|
|
3927
3909
|
}
|
|
3928
|
-
async
|
|
3929
|
-
return this._recoveryManager.
|
|
3910
|
+
async createRecoveryCredential(request) {
|
|
3911
|
+
return this._recoveryManager.createRecoveryCredential(request);
|
|
3912
|
+
}
|
|
3913
|
+
async requestRecoveryChallenge() {
|
|
3914
|
+
return this._recoveryManager.requestRecoveryChallenge();
|
|
3930
3915
|
}
|
|
3931
3916
|
async recoverIdentity(request) {
|
|
3932
|
-
|
|
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
|
+
}
|
|
3933
3926
|
return this._getIdentity();
|
|
3934
3927
|
}
|
|
3935
3928
|
// TODO(burdon): Rename createPresentation?
|
|
3936
3929
|
async signPresentation({ presentation, nonce }) {
|
|
3937
3930
|
(0, import_invariant10.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
3938
3931
|
F: __dxlog_file13,
|
|
3939
|
-
L:
|
|
3932
|
+
L: 116,
|
|
3940
3933
|
S: this,
|
|
3941
3934
|
A: [
|
|
3942
3935
|
"this._identityManager.identity",
|
|
@@ -3955,7 +3948,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3955
3948
|
const identity = this._identityManager.identity;
|
|
3956
3949
|
(0, import_invariant10.invariant)(identity, "Identity not initialized.", {
|
|
3957
3950
|
F: __dxlog_file13,
|
|
3958
|
-
L:
|
|
3951
|
+
L: 130,
|
|
3959
3952
|
S: this,
|
|
3960
3953
|
A: [
|
|
3961
3954
|
"identity",
|
|
@@ -3993,7 +3986,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3993
3986
|
duplicate: space.id
|
|
3994
3987
|
}, {
|
|
3995
3988
|
F: __dxlog_file13,
|
|
3996
|
-
L:
|
|
3989
|
+
L: 164,
|
|
3997
3990
|
S: this,
|
|
3998
3991
|
C: (f, a) => f(...a)
|
|
3999
3992
|
});
|
|
@@ -4007,7 +4000,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
4007
4000
|
}, (err) => {
|
|
4008
4001
|
import_log11.log.catch(err, void 0, {
|
|
4009
4002
|
F: __dxlog_file13,
|
|
4010
|
-
L:
|
|
4003
|
+
L: 175,
|
|
4011
4004
|
S: this,
|
|
4012
4005
|
C: (f, a) => f(...a)
|
|
4013
4006
|
});
|
|
@@ -4776,6 +4769,12 @@ var DeviceInvitationProtocol = class {
|
|
|
4776
4769
|
var stateToString = (state) => {
|
|
4777
4770
|
return Object.entries(import_services13.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
4778
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
|
+
};
|
|
4779
4778
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
4780
4779
|
let guard;
|
|
4781
4780
|
return (0, import_context11.cancelWithContext)(ctx, (async () => {
|
|
@@ -5752,18 +5751,19 @@ var InvitationsHandler = class {
|
|
|
5752
5751
|
});
|
|
5753
5752
|
return extension;
|
|
5754
5753
|
};
|
|
5755
|
-
|
|
5756
|
-
|
|
5754
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
5755
|
+
if (expiresOn) {
|
|
5756
|
+
if (expiresOn.getTime() < Date.now()) {
|
|
5757
5757
|
import_log12.log.warn("invitation has already expired", void 0, {
|
|
5758
5758
|
F: __dxlog_file21,
|
|
5759
|
-
L:
|
|
5759
|
+
L: 194,
|
|
5760
5760
|
S: this,
|
|
5761
5761
|
C: (f, a) => f(...a)
|
|
5762
5762
|
});
|
|
5763
5763
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5764
5764
|
void ctx.dispose().catch((err) => import_log12.log.catch(err, void 0, {
|
|
5765
5765
|
F: __dxlog_file21,
|
|
5766
|
-
L:
|
|
5766
|
+
L: 196,
|
|
5767
5767
|
S: this,
|
|
5768
5768
|
C: (f, a) => f(...a)
|
|
5769
5769
|
}));
|
|
@@ -5774,7 +5774,7 @@ var InvitationsHandler = class {
|
|
|
5774
5774
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5775
5775
|
metrics.increment("dxos.invitation.expired");
|
|
5776
5776
|
await ctx.dispose();
|
|
5777
|
-
},
|
|
5777
|
+
}, expiresOn.getTime() - Date.now());
|
|
5778
5778
|
}
|
|
5779
5779
|
let swarmConnection;
|
|
5780
5780
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
@@ -5790,7 +5790,7 @@ var InvitationsHandler = class {
|
|
|
5790
5790
|
type: invitation.type
|
|
5791
5791
|
}, {
|
|
5792
5792
|
F: __dxlog_file21,
|
|
5793
|
-
L:
|
|
5793
|
+
L: 227,
|
|
5794
5794
|
S: this,
|
|
5795
5795
|
C: (f, a) => f(...a)
|
|
5796
5796
|
});
|
|
@@ -5798,7 +5798,7 @@ var InvitationsHandler = class {
|
|
|
5798
5798
|
if (deviceProfile) {
|
|
5799
5799
|
(0, import_invariant12.invariant)(invitation.kind === import_services11.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5800
5800
|
F: __dxlog_file21,
|
|
5801
|
-
L:
|
|
5801
|
+
L: 236,
|
|
5802
5802
|
S: this,
|
|
5803
5803
|
A: [
|
|
5804
5804
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5816,7 +5816,7 @@ var InvitationsHandler = class {
|
|
|
5816
5816
|
triedPeers: triedPeersIds.size
|
|
5817
5817
|
}, {
|
|
5818
5818
|
F: __dxlog_file21,
|
|
5819
|
-
L:
|
|
5819
|
+
L: 244,
|
|
5820
5820
|
S: this,
|
|
5821
5821
|
C: (f, a) => f(...a)
|
|
5822
5822
|
});
|
|
@@ -5843,7 +5843,7 @@ var InvitationsHandler = class {
|
|
|
5843
5843
|
currentState: guardedState.current.state
|
|
5844
5844
|
}, {
|
|
5845
5845
|
F: __dxlog_file21,
|
|
5846
|
-
L:
|
|
5846
|
+
L: 272,
|
|
5847
5847
|
S: this,
|
|
5848
5848
|
C: (f, a) => f(...a)
|
|
5849
5849
|
});
|
|
@@ -5861,7 +5861,7 @@ var InvitationsHandler = class {
|
|
|
5861
5861
|
id: traceId
|
|
5862
5862
|
}), {
|
|
5863
5863
|
F: __dxlog_file21,
|
|
5864
|
-
L:
|
|
5864
|
+
L: 284,
|
|
5865
5865
|
S: this,
|
|
5866
5866
|
C: (f, a) => f(...a)
|
|
5867
5867
|
});
|
|
@@ -5873,7 +5873,7 @@ var InvitationsHandler = class {
|
|
|
5873
5873
|
...protocol.toJSON()
|
|
5874
5874
|
}, {
|
|
5875
5875
|
F: __dxlog_file21,
|
|
5876
|
-
L:
|
|
5876
|
+
L: 295,
|
|
5877
5877
|
S: this,
|
|
5878
5878
|
C: (f, a) => f(...a)
|
|
5879
5879
|
});
|
|
@@ -5883,7 +5883,7 @@ var InvitationsHandler = class {
|
|
|
5883
5883
|
...protocol.toJSON()
|
|
5884
5884
|
}, {
|
|
5885
5885
|
F: __dxlog_file21,
|
|
5886
|
-
L:
|
|
5886
|
+
L: 299,
|
|
5887
5887
|
S: this,
|
|
5888
5888
|
C: (f, a) => f(...a)
|
|
5889
5889
|
});
|
|
@@ -5897,7 +5897,7 @@ var InvitationsHandler = class {
|
|
|
5897
5897
|
authMethod: introductionResponse.authMethod
|
|
5898
5898
|
}, {
|
|
5899
5899
|
F: __dxlog_file21,
|
|
5900
|
-
L:
|
|
5900
|
+
L: 307,
|
|
5901
5901
|
S: this,
|
|
5902
5902
|
C: (f, a) => f(...a)
|
|
5903
5903
|
});
|
|
@@ -5919,7 +5919,7 @@ var InvitationsHandler = class {
|
|
|
5919
5919
|
...protocol.toJSON()
|
|
5920
5920
|
}, {
|
|
5921
5921
|
F: __dxlog_file21,
|
|
5922
|
-
L:
|
|
5922
|
+
L: 337,
|
|
5923
5923
|
S: this,
|
|
5924
5924
|
C: (f, a) => f(...a)
|
|
5925
5925
|
});
|
|
@@ -5932,7 +5932,7 @@ var InvitationsHandler = class {
|
|
|
5932
5932
|
...protocol.toJSON()
|
|
5933
5933
|
}, {
|
|
5934
5934
|
F: __dxlog_file21,
|
|
5935
|
-
L:
|
|
5935
|
+
L: 351,
|
|
5936
5936
|
S: this,
|
|
5937
5937
|
C: (f, a) => f(...a)
|
|
5938
5938
|
});
|
|
@@ -5945,7 +5945,7 @@ var InvitationsHandler = class {
|
|
|
5945
5945
|
id: traceId
|
|
5946
5946
|
}), {
|
|
5947
5947
|
F: __dxlog_file21,
|
|
5948
|
-
L:
|
|
5948
|
+
L: 360,
|
|
5949
5949
|
S: this,
|
|
5950
5950
|
C: (f, a) => f(...a)
|
|
5951
5951
|
});
|
|
@@ -5955,7 +5955,7 @@ var InvitationsHandler = class {
|
|
|
5955
5955
|
...protocol.toJSON()
|
|
5956
5956
|
}, {
|
|
5957
5957
|
F: __dxlog_file21,
|
|
5958
|
-
L:
|
|
5958
|
+
L: 363,
|
|
5959
5959
|
S: this,
|
|
5960
5960
|
C: (f, a) => f(...a)
|
|
5961
5961
|
});
|
|
@@ -5963,7 +5963,7 @@ var InvitationsHandler = class {
|
|
|
5963
5963
|
} else {
|
|
5964
5964
|
import_log12.log.verbose("auth failed", err, {
|
|
5965
5965
|
F: __dxlog_file21,
|
|
5966
|
-
L:
|
|
5966
|
+
L: 366,
|
|
5967
5967
|
S: this,
|
|
5968
5968
|
C: (f, a) => f(...a)
|
|
5969
5969
|
});
|
|
@@ -5975,7 +5975,7 @@ var InvitationsHandler = class {
|
|
|
5975
5975
|
error: err
|
|
5976
5976
|
}), {
|
|
5977
5977
|
F: __dxlog_file21,
|
|
5978
|
-
L:
|
|
5978
|
+
L: 370,
|
|
5979
5979
|
S: this,
|
|
5980
5980
|
C: (f, a) => f(...a)
|
|
5981
5981
|
});
|
|
@@ -5991,7 +5991,7 @@ var InvitationsHandler = class {
|
|
|
5991
5991
|
...protocol.toJSON()
|
|
5992
5992
|
}, {
|
|
5993
5993
|
F: __dxlog_file21,
|
|
5994
|
-
L:
|
|
5994
|
+
L: 379,
|
|
5995
5995
|
S: this,
|
|
5996
5996
|
C: (f, a) => f(...a)
|
|
5997
5997
|
});
|
|
@@ -5999,7 +5999,7 @@ var InvitationsHandler = class {
|
|
|
5999
5999
|
} else {
|
|
6000
6000
|
import_log12.log.verbose("auth failed", err, {
|
|
6001
6001
|
F: __dxlog_file21,
|
|
6002
|
-
L:
|
|
6002
|
+
L: 382,
|
|
6003
6003
|
S: this,
|
|
6004
6004
|
C: (f, a) => f(...a)
|
|
6005
6005
|
});
|
|
@@ -6016,7 +6016,7 @@ var InvitationsHandler = class {
|
|
|
6016
6016
|
...protocol.toJSON()
|
|
6017
6017
|
}, {
|
|
6018
6018
|
F: __dxlog_file21,
|
|
6019
|
-
L:
|
|
6019
|
+
L: 394,
|
|
6020
6020
|
S: this,
|
|
6021
6021
|
C: (f, a) => f(...a)
|
|
6022
6022
|
});
|
|
@@ -6029,14 +6029,14 @@ var InvitationsHandler = class {
|
|
|
6029
6029
|
});
|
|
6030
6030
|
edgeInvitationHandler.handle(ctx, guardedState, protocol, deviceProfile);
|
|
6031
6031
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6032
|
-
const error =
|
|
6032
|
+
const error = checkInvitation(protocol, invitation);
|
|
6033
6033
|
if (error) {
|
|
6034
6034
|
stream.error(error);
|
|
6035
6035
|
await ctx.dispose();
|
|
6036
6036
|
} else {
|
|
6037
6037
|
(0, import_invariant12.invariant)(invitation.swarmKey, void 0, {
|
|
6038
6038
|
F: __dxlog_file21,
|
|
6039
|
-
L:
|
|
6039
|
+
L: 406,
|
|
6040
6040
|
S: this,
|
|
6041
6041
|
A: [
|
|
6042
6042
|
"invitation.swarmKey",
|
|
@@ -6080,7 +6080,7 @@ var InvitationsHandler = class {
|
|
|
6080
6080
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6081
6081
|
(0, import_log12.log)("guest waiting for authentication code...", void 0, {
|
|
6082
6082
|
F: __dxlog_file21,
|
|
6083
|
-
L:
|
|
6083
|
+
L: 458,
|
|
6084
6084
|
S: this,
|
|
6085
6085
|
C: (f, a) => f(...a)
|
|
6086
6086
|
});
|
|
@@ -6088,7 +6088,7 @@ var InvitationsHandler = class {
|
|
|
6088
6088
|
const authCode = await authenticated.wait(options);
|
|
6089
6089
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6090
6090
|
F: __dxlog_file21,
|
|
6091
|
-
L:
|
|
6091
|
+
L: 462,
|
|
6092
6092
|
S: this,
|
|
6093
6093
|
C: (f, a) => f(...a)
|
|
6094
6094
|
});
|
|
@@ -6107,7 +6107,7 @@ var InvitationsHandler = class {
|
|
|
6107
6107
|
attempt
|
|
6108
6108
|
}, {
|
|
6109
6109
|
F: __dxlog_file21,
|
|
6110
|
-
L:
|
|
6110
|
+
L: 473,
|
|
6111
6111
|
S: this,
|
|
6112
6112
|
C: (f, a) => f(...a)
|
|
6113
6113
|
});
|
|
@@ -6125,7 +6125,7 @@ var InvitationsHandler = class {
|
|
|
6125
6125
|
}
|
|
6126
6126
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6127
6127
|
F: __dxlog_file21,
|
|
6128
|
-
L:
|
|
6128
|
+
L: 492,
|
|
6129
6129
|
S: this,
|
|
6130
6130
|
C: (f, a) => f(...a)
|
|
6131
6131
|
});
|
|
@@ -6138,6 +6138,13 @@ var InvitationsHandler = class {
|
|
|
6138
6138
|
}
|
|
6139
6139
|
}
|
|
6140
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
|
+
};
|
|
6141
6148
|
var createAdmissionKeypair = () => {
|
|
6142
6149
|
const keypair = (0, import_crypto.createKeyPair)();
|
|
6143
6150
|
return {
|
|
@@ -6154,7 +6161,7 @@ var InvitationsServiceImpl = class {
|
|
|
6154
6161
|
return {};
|
|
6155
6162
|
}
|
|
6156
6163
|
createInvitation(options) {
|
|
6157
|
-
return new
|
|
6164
|
+
return new import_stream9.Stream(({ next, close }) => {
|
|
6158
6165
|
void this._invitationsManager.createInvitation(options).then((invitation) => {
|
|
6159
6166
|
import_tracing9.trace.metrics.increment("dxos.invitation.created");
|
|
6160
6167
|
invitation.subscribe(next, close, close);
|
|
@@ -6163,7 +6170,7 @@ var InvitationsServiceImpl = class {
|
|
|
6163
6170
|
}
|
|
6164
6171
|
acceptInvitation(request) {
|
|
6165
6172
|
const invitation = this._invitationsManager.acceptInvitation(request);
|
|
6166
|
-
return new
|
|
6173
|
+
return new import_stream9.Stream(({ next, close }) => {
|
|
6167
6174
|
invitation.subscribe(next, close, close);
|
|
6168
6175
|
});
|
|
6169
6176
|
}
|
|
@@ -6174,7 +6181,7 @@ var InvitationsServiceImpl = class {
|
|
|
6174
6181
|
return this._invitationsManager.cancelInvitation(request);
|
|
6175
6182
|
}
|
|
6176
6183
|
queryInvitations() {
|
|
6177
|
-
return new
|
|
6184
|
+
return new import_stream9.Stream(({ next, ctx }) => {
|
|
6178
6185
|
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
6179
6186
|
next({
|
|
6180
6187
|
action: import_services16.QueryInvitationsResponse.Action.ADDED,
|
|
@@ -6272,7 +6279,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6272
6279
|
getInvitationContext() {
|
|
6273
6280
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6274
6281
|
F: __dxlog_file22,
|
|
6275
|
-
L:
|
|
6282
|
+
L: 65,
|
|
6276
6283
|
S: this,
|
|
6277
6284
|
A: [
|
|
6278
6285
|
"this._spaceKey",
|
|
@@ -6282,7 +6289,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6282
6289
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6283
6290
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6284
6291
|
F: __dxlog_file22,
|
|
6285
|
-
L:
|
|
6292
|
+
L: 67,
|
|
6286
6293
|
S: this,
|
|
6287
6294
|
A: [
|
|
6288
6295
|
"space",
|
|
@@ -6298,7 +6305,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6298
6305
|
async admit(invitation, request, guestProfile) {
|
|
6299
6306
|
(0, import_invariant17.invariant)(this._spaceKey && request.space, void 0, {
|
|
6300
6307
|
F: __dxlog_file22,
|
|
6301
|
-
L:
|
|
6308
|
+
L: 80,
|
|
6302
6309
|
S: this,
|
|
6303
6310
|
A: [
|
|
6304
6311
|
"this._spaceKey && request.space",
|
|
@@ -6310,7 +6317,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6310
6317
|
guest: request.space.deviceKey
|
|
6311
6318
|
}, {
|
|
6312
6319
|
F: __dxlog_file22,
|
|
6313
|
-
L:
|
|
6320
|
+
L: 81,
|
|
6314
6321
|
S: this,
|
|
6315
6322
|
C: (f, a) => f(...a)
|
|
6316
6323
|
});
|
|
@@ -6332,7 +6339,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6332
6339
|
async delegate(invitation) {
|
|
6333
6340
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6334
6341
|
F: __dxlog_file22,
|
|
6335
|
-
L:
|
|
6342
|
+
L: 101,
|
|
6336
6343
|
S: this,
|
|
6337
6344
|
A: [
|
|
6338
6345
|
"this._spaceKey",
|
|
@@ -6342,7 +6349,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6342
6349
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6343
6350
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6344
6351
|
F: __dxlog_file22,
|
|
6345
|
-
L:
|
|
6352
|
+
L: 103,
|
|
6346
6353
|
S: this,
|
|
6347
6354
|
A: [
|
|
6348
6355
|
"space",
|
|
@@ -6352,7 +6359,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6352
6359
|
if (invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6353
6360
|
(0, import_invariant17.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6354
6361
|
F: __dxlog_file22,
|
|
6355
|
-
L:
|
|
6362
|
+
L: 105,
|
|
6356
6363
|
S: this,
|
|
6357
6364
|
A: [
|
|
6358
6365
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6365,7 +6372,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6365
6372
|
id: invitation.invitationId
|
|
6366
6373
|
}, {
|
|
6367
6374
|
F: __dxlog_file22,
|
|
6368
|
-
L:
|
|
6375
|
+
L: 108,
|
|
6369
6376
|
S: this,
|
|
6370
6377
|
C: (f, a) => f(...a)
|
|
6371
6378
|
});
|
|
@@ -6374,13 +6381,13 @@ var SpaceInvitationProtocol = class {
|
|
|
6374
6381
|
authMethod: invitation.authMethod,
|
|
6375
6382
|
swarmKey: invitation.swarmKey,
|
|
6376
6383
|
role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
|
|
6377
|
-
expiresOn:
|
|
6384
|
+
expiresOn: computeExpirationTime(invitation),
|
|
6378
6385
|
multiUse: invitation.multiUse ?? false,
|
|
6379
6386
|
guestKey: invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6380
6387
|
});
|
|
6381
6388
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6382
6389
|
F: __dxlog_file22,
|
|
6383
|
-
L:
|
|
6390
|
+
L: 126,
|
|
6384
6391
|
S: this,
|
|
6385
6392
|
A: [
|
|
6386
6393
|
"credential.credential",
|
|
@@ -6395,7 +6402,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6395
6402
|
async cancelDelegation(invitation) {
|
|
6396
6403
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6397
6404
|
F: __dxlog_file22,
|
|
6398
|
-
L:
|
|
6405
|
+
L: 132,
|
|
6399
6406
|
S: this,
|
|
6400
6407
|
A: [
|
|
6401
6408
|
"this._spaceKey",
|
|
@@ -6404,7 +6411,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6404
6411
|
});
|
|
6405
6412
|
(0, import_invariant17.invariant)(invitation.type === import_services17.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6406
6413
|
F: __dxlog_file22,
|
|
6407
|
-
L:
|
|
6414
|
+
L: 133,
|
|
6408
6415
|
S: this,
|
|
6409
6416
|
A: [
|
|
6410
6417
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6414,7 +6421,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6414
6421
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6415
6422
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6416
6423
|
F: __dxlog_file22,
|
|
6417
|
-
L:
|
|
6424
|
+
L: 135,
|
|
6418
6425
|
S: this,
|
|
6419
6426
|
A: [
|
|
6420
6427
|
"space",
|
|
@@ -6426,14 +6433,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6426
6433
|
id: invitation.invitationId
|
|
6427
6434
|
}, {
|
|
6428
6435
|
F: __dxlog_file22,
|
|
6429
|
-
L:
|
|
6436
|
+
L: 137,
|
|
6430
6437
|
S: this,
|
|
6431
6438
|
C: (f, a) => f(...a)
|
|
6432
6439
|
});
|
|
6433
6440
|
const credential = await (0, import_credentials18.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6434
6441
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6435
6442
|
F: __dxlog_file22,
|
|
6436
|
-
L:
|
|
6443
|
+
L: 144,
|
|
6437
6444
|
S: this,
|
|
6438
6445
|
A: [
|
|
6439
6446
|
"credential.credential",
|
|
@@ -6472,7 +6479,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6472
6479
|
async accept(response) {
|
|
6473
6480
|
(0, import_invariant17.invariant)(response.space, void 0, {
|
|
6474
6481
|
F: __dxlog_file22,
|
|
6475
|
-
L:
|
|
6482
|
+
L: 179,
|
|
6476
6483
|
S: this,
|
|
6477
6484
|
A: [
|
|
6478
6485
|
"response.space",
|
|
@@ -6483,7 +6490,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6483
6490
|
const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
|
|
6484
6491
|
(0, import_invariant17.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6485
6492
|
F: __dxlog_file22,
|
|
6486
|
-
L:
|
|
6493
|
+
L: 182,
|
|
6487
6494
|
S: this,
|
|
6488
6495
|
A: [
|
|
6489
6496
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6492,7 +6499,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6492
6499
|
});
|
|
6493
6500
|
(0, import_invariant17.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6494
6501
|
F: __dxlog_file22,
|
|
6495
|
-
L:
|
|
6502
|
+
L: 183,
|
|
6496
6503
|
S: this,
|
|
6497
6504
|
A: [
|
|
6498
6505
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -6716,7 +6723,7 @@ var InvitationsManager = class {
|
|
|
6716
6723
|
}
|
|
6717
6724
|
}
|
|
6718
6725
|
_createInvitation(protocol, _options) {
|
|
6719
|
-
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 ?? {};
|
|
6720
6727
|
const authCode = options?.authCode ?? (authMethod === import_services18.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6721
6728
|
return {
|
|
6722
6729
|
invitationId,
|
|
@@ -6955,7 +6962,7 @@ var ClientRpcServer = class {
|
|
|
6955
6962
|
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
6956
6963
|
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
6957
6964
|
if (this._handleStream) {
|
|
6958
|
-
return
|
|
6965
|
+
return import_codec_protobuf2.Stream.map(import_codec_protobuf2.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
|
|
6959
6966
|
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
6960
6967
|
return data;
|
|
6961
6968
|
});
|
|
@@ -7221,7 +7228,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7221
7228
|
this._edgeConnection = _edgeConnection;
|
|
7222
7229
|
}
|
|
7223
7230
|
queryEdgeStatus() {
|
|
7224
|
-
return new
|
|
7231
|
+
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7225
7232
|
next({
|
|
7226
7233
|
status: import_services20.QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
|
|
7227
7234
|
});
|
|
@@ -7242,7 +7249,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7242
7249
|
return (await this._agentManagerProvider()).createAgent();
|
|
7243
7250
|
}
|
|
7244
7251
|
queryAgentStatus() {
|
|
7245
|
-
return new
|
|
7252
|
+
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7246
7253
|
next({
|
|
7247
7254
|
status: import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN
|
|
7248
7255
|
});
|
|
@@ -7279,27 +7286,41 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7279
7286
|
this._identityProvider = _identityProvider;
|
|
7280
7287
|
this._acceptRecoveredIdentity = _acceptRecoveredIdentity;
|
|
7281
7288
|
}
|
|
7282
|
-
async
|
|
7289
|
+
async createRecoveryCredential({ recoveryKey, algorithm }) {
|
|
7283
7290
|
const identity = this._identityProvider();
|
|
7284
7291
|
(0, import_invariant22.invariant)(identity, void 0, {
|
|
7285
7292
|
F: __dxlog_file26,
|
|
7286
|
-
L:
|
|
7293
|
+
L: 37,
|
|
7287
7294
|
S: this,
|
|
7288
7295
|
A: [
|
|
7289
7296
|
"identity",
|
|
7290
7297
|
""
|
|
7291
7298
|
]
|
|
7292
7299
|
});
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7300
|
+
let recoveryCode;
|
|
7301
|
+
if (!recoveryKey) {
|
|
7302
|
+
recoveryCode = (0, import_credentials23.generateSeedPhrase)();
|
|
7303
|
+
const keypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7304
|
+
recoveryKey = import_keys17.PublicKey.from(keypair.publicKey);
|
|
7305
|
+
algorithm = -8;
|
|
7306
|
+
}
|
|
7307
|
+
(0, import_invariant22.invariant)(algorithm, "Algorithm is required.", {
|
|
7308
|
+
F: __dxlog_file26,
|
|
7309
|
+
L: 47,
|
|
7310
|
+
S: this,
|
|
7311
|
+
A: [
|
|
7312
|
+
"algorithm",
|
|
7313
|
+
"'Algorithm is required.'"
|
|
7314
|
+
]
|
|
7315
|
+
});
|
|
7296
7316
|
const identityKey = identity.identityKey;
|
|
7297
7317
|
const credential = await identity.getIdentityCredentialSigner().createCredential({
|
|
7298
7318
|
subject: identityKey,
|
|
7299
7319
|
assertion: {
|
|
7300
7320
|
"@type": "dxos.halo.credentials.IdentityRecovery",
|
|
7301
7321
|
recoveryKey,
|
|
7302
|
-
identityKey
|
|
7322
|
+
identityKey,
|
|
7323
|
+
algorithm
|
|
7303
7324
|
}
|
|
7304
7325
|
});
|
|
7305
7326
|
const receipt = await identity.controlPipeline.writer.write({
|
|
@@ -7314,20 +7335,81 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7314
7335
|
]
|
|
7315
7336
|
]));
|
|
7316
7337
|
return {
|
|
7317
|
-
|
|
7338
|
+
recoveryCode
|
|
7339
|
+
};
|
|
7340
|
+
}
|
|
7341
|
+
async requestRecoveryChallenge() {
|
|
7342
|
+
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7343
|
+
F: __dxlog_file26,
|
|
7344
|
+
L: 66,
|
|
7345
|
+
S: this,
|
|
7346
|
+
A: [
|
|
7347
|
+
"this._edgeClient",
|
|
7348
|
+
"'Not connected to EDGE.'"
|
|
7349
|
+
]
|
|
7350
|
+
});
|
|
7351
|
+
const deviceKey = await this._keyring.createKey();
|
|
7352
|
+
const controlFeedKey = await this._keyring.createKey();
|
|
7353
|
+
const request = {
|
|
7354
|
+
deviceKey: deviceKey.toHex(),
|
|
7355
|
+
controlFeedKey: controlFeedKey.toHex()
|
|
7318
7356
|
};
|
|
7357
|
+
try {
|
|
7358
|
+
await this._edgeClient.recoverIdentity(request);
|
|
7359
|
+
throw new Error("No challenge received.");
|
|
7360
|
+
} catch (error) {
|
|
7361
|
+
if (!(error instanceof import_protocols17.EdgeAuthChallengeError)) {
|
|
7362
|
+
throw error;
|
|
7363
|
+
}
|
|
7364
|
+
return {
|
|
7365
|
+
deviceKey,
|
|
7366
|
+
controlFeedKey,
|
|
7367
|
+
challenge: error.challenge
|
|
7368
|
+
};
|
|
7369
|
+
}
|
|
7319
7370
|
}
|
|
7320
|
-
async
|
|
7371
|
+
async recoverIdentityWithExternalSignature({ identityDid, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7321
7372
|
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7322
7373
|
F: __dxlog_file26,
|
|
7323
|
-
L:
|
|
7374
|
+
L: 98,
|
|
7324
7375
|
S: this,
|
|
7325
7376
|
A: [
|
|
7326
7377
|
"this._edgeClient",
|
|
7327
7378
|
"'Not connected to EDGE.'"
|
|
7328
7379
|
]
|
|
7329
7380
|
});
|
|
7330
|
-
const
|
|
7381
|
+
const request = {
|
|
7382
|
+
identityDid,
|
|
7383
|
+
deviceKey: deviceKey.toHex(),
|
|
7384
|
+
controlFeedKey: controlFeedKey.toHex(),
|
|
7385
|
+
signature: clientDataJson && authenticatorData ? {
|
|
7386
|
+
signature: Buffer.from(signature).toString("base64"),
|
|
7387
|
+
clientDataJson: Buffer.from(clientDataJson).toString("base64"),
|
|
7388
|
+
authenticatorData: Buffer.from(authenticatorData).toString("base64")
|
|
7389
|
+
} : Buffer.from(signature).toString("base64")
|
|
7390
|
+
};
|
|
7391
|
+
const response = await this._edgeClient.recoverIdentity(request);
|
|
7392
|
+
await this._acceptRecoveredIdentity({
|
|
7393
|
+
authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
|
|
7394
|
+
haloGenesisFeedKey: import_keys17.PublicKey.fromHex(response.genesisFeedKey),
|
|
7395
|
+
haloSpaceKey: import_keys17.PublicKey.fromHex(response.haloSpaceKey),
|
|
7396
|
+
identityKey: import_keys17.PublicKey.fromHex(response.identityKey),
|
|
7397
|
+
deviceKey,
|
|
7398
|
+
controlFeedKey,
|
|
7399
|
+
dataFeedKey: await this._keyring.createKey()
|
|
7400
|
+
});
|
|
7401
|
+
}
|
|
7402
|
+
async recoverIdentity({ recoveryCode }) {
|
|
7403
|
+
(0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7404
|
+
F: __dxlog_file26,
|
|
7405
|
+
L: 128,
|
|
7406
|
+
S: this,
|
|
7407
|
+
A: [
|
|
7408
|
+
"this._edgeClient",
|
|
7409
|
+
"'Not connected to EDGE.'"
|
|
7410
|
+
]
|
|
7411
|
+
});
|
|
7412
|
+
const recoveryKeypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7331
7413
|
const recoveryKey = import_keys17.PublicKey.from(recoveryKeypair.publicKey);
|
|
7332
7414
|
const deviceKey = await this._keyring.createKey();
|
|
7333
7415
|
const controlFeedKey = await this._keyring.createKey();
|
|
@@ -7351,7 +7433,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7351
7433
|
}
|
|
7352
7434
|
import_log23.log.info("recovering identity", response, {
|
|
7353
7435
|
F: __dxlog_file26,
|
|
7354
|
-
L:
|
|
7436
|
+
L: 154,
|
|
7355
7437
|
S: this,
|
|
7356
7438
|
C: (f, a) => f(...a)
|
|
7357
7439
|
});
|
|
@@ -7490,7 +7572,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7490
7572
|
this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
|
|
7491
7573
|
this.echoHost = new import_echo_pipeline4.EchoHost({
|
|
7492
7574
|
kv: this.level,
|
|
7493
|
-
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
|
|
7575
|
+
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
|
|
7576
|
+
getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
|
|
7494
7577
|
});
|
|
7495
7578
|
this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
|
|
7496
7579
|
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
|
|
@@ -7509,7 +7592,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7509
7592
|
await this._checkStorageVersion();
|
|
7510
7593
|
(0, import_log22.log)("opening...", void 0, {
|
|
7511
7594
|
F: __dxlog_file27,
|
|
7512
|
-
L:
|
|
7595
|
+
L: 199,
|
|
7513
7596
|
S: this,
|
|
7514
7597
|
C: (f, a) => f(...a)
|
|
7515
7598
|
});
|
|
@@ -7517,7 +7600,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7517
7600
|
id: this._instanceId
|
|
7518
7601
|
}), {
|
|
7519
7602
|
F: __dxlog_file27,
|
|
7520
|
-
L:
|
|
7603
|
+
L: 200,
|
|
7521
7604
|
S: this,
|
|
7522
7605
|
C: (f, a) => f(...a)
|
|
7523
7606
|
});
|
|
@@ -7544,7 +7627,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7544
7627
|
count: loadedInvitations.invitations?.length
|
|
7545
7628
|
}, {
|
|
7546
7629
|
F: __dxlog_file27,
|
|
7547
|
-
L:
|
|
7630
|
+
L: 228,
|
|
7548
7631
|
S: this,
|
|
7549
7632
|
C: (f, a) => f(...a)
|
|
7550
7633
|
});
|
|
@@ -7552,13 +7635,13 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7552
7635
|
id: this._instanceId
|
|
7553
7636
|
}), {
|
|
7554
7637
|
F: __dxlog_file27,
|
|
7555
|
-
L:
|
|
7638
|
+
L: 230,
|
|
7556
7639
|
S: this,
|
|
7557
7640
|
C: (f, a) => f(...a)
|
|
7558
7641
|
});
|
|
7559
7642
|
(0, import_log22.log)("opened", void 0, {
|
|
7560
7643
|
F: __dxlog_file27,
|
|
7561
|
-
L:
|
|
7644
|
+
L: 231,
|
|
7562
7645
|
S: this,
|
|
7563
7646
|
C: (f, a) => f(...a)
|
|
7564
7647
|
});
|
|
@@ -7566,7 +7649,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7566
7649
|
async _close(ctx) {
|
|
7567
7650
|
(0, import_log22.log)("closing...", void 0, {
|
|
7568
7651
|
F: __dxlog_file27,
|
|
7569
|
-
L:
|
|
7652
|
+
L: 235,
|
|
7570
7653
|
S: this,
|
|
7571
7654
|
C: (f, a) => f(...a)
|
|
7572
7655
|
});
|
|
@@ -7585,7 +7668,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7585
7668
|
await this._edgeConnection?.close();
|
|
7586
7669
|
(0, import_log22.log)("closed", void 0, {
|
|
7587
7670
|
F: __dxlog_file27,
|
|
7588
|
-
L:
|
|
7671
|
+
L: 251,
|
|
7589
7672
|
S: this,
|
|
7590
7673
|
C: (f, a) => f(...a)
|
|
7591
7674
|
});
|
|
@@ -7596,7 +7679,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7596
7679
|
await identity.joinNetwork();
|
|
7597
7680
|
await this._initialize(new import_context16.Context(void 0, {
|
|
7598
7681
|
F: __dxlog_file27,
|
|
7599
|
-
L:
|
|
7682
|
+
L: 258
|
|
7600
7683
|
}));
|
|
7601
7684
|
return identity;
|
|
7602
7685
|
}
|
|
@@ -7607,7 +7690,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7607
7690
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
7608
7691
|
(0, import_invariant21.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
7609
7692
|
F: __dxlog_file27,
|
|
7610
|
-
L:
|
|
7693
|
+
L: 267,
|
|
7611
7694
|
S: this,
|
|
7612
7695
|
A: [
|
|
7613
7696
|
"factory",
|
|
@@ -7633,7 +7716,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7633
7716
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
7634
7717
|
await this._initialize(new import_context16.Context(void 0, {
|
|
7635
7718
|
F: __dxlog_file27,
|
|
7636
|
-
L:
|
|
7719
|
+
L: 286
|
|
7637
7720
|
}));
|
|
7638
7721
|
return identity;
|
|
7639
7722
|
}
|
|
@@ -7647,7 +7730,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7647
7730
|
async _initialize(ctx) {
|
|
7648
7731
|
(0, import_log22.log)("initializing spaces...", void 0, {
|
|
7649
7732
|
F: __dxlog_file27,
|
|
7650
|
-
L:
|
|
7733
|
+
L: 301,
|
|
7651
7734
|
S: this,
|
|
7652
7735
|
C: (f, a) => f(...a)
|
|
7653
7736
|
});
|
|
@@ -7686,7 +7769,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7686
7769
|
this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
|
|
7687
7770
|
(0, import_invariant21.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
7688
7771
|
F: __dxlog_file27,
|
|
7689
|
-
L:
|
|
7772
|
+
L: 339,
|
|
7690
7773
|
S: this,
|
|
7691
7774
|
A: [
|
|
7692
7775
|
"this.dataSpaceManager",
|
|
@@ -7710,7 +7793,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7710
7793
|
details: assertion
|
|
7711
7794
|
}, {
|
|
7712
7795
|
F: __dxlog_file27,
|
|
7713
|
-
L:
|
|
7796
|
+
L: 355,
|
|
7714
7797
|
S: this,
|
|
7715
7798
|
C: (f, a) => f(...a)
|
|
7716
7799
|
});
|
|
@@ -7721,7 +7804,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7721
7804
|
details: assertion
|
|
7722
7805
|
}, {
|
|
7723
7806
|
F: __dxlog_file27,
|
|
7724
|
-
L:
|
|
7807
|
+
L: 359,
|
|
7725
7808
|
S: this,
|
|
7726
7809
|
C: (f, a) => f(...a)
|
|
7727
7810
|
});
|
|
@@ -7732,7 +7815,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7732
7815
|
details: assertion
|
|
7733
7816
|
}, {
|
|
7734
7817
|
F: __dxlog_file27,
|
|
7735
|
-
L:
|
|
7818
|
+
L: 364,
|
|
7736
7819
|
S: this,
|
|
7737
7820
|
C: (f, a) => f(...a)
|
|
7738
7821
|
});
|
|
@@ -7743,7 +7826,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7743
7826
|
} catch (err) {
|
|
7744
7827
|
import_log22.log.catch(err, void 0, {
|
|
7745
7828
|
F: __dxlog_file27,
|
|
7746
|
-
L:
|
|
7829
|
+
L: 370,
|
|
7747
7830
|
S: this,
|
|
7748
7831
|
C: (f, a) => f(...a)
|
|
7749
7832
|
});
|
|
@@ -7759,12 +7842,12 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7759
7842
|
let edgeIdentity;
|
|
7760
7843
|
const identity = this.identityManager.identity;
|
|
7761
7844
|
if (identity) {
|
|
7762
|
-
import_log22.log
|
|
7845
|
+
(0, import_log22.log)("setting identity on edge connection", {
|
|
7763
7846
|
identity: identity.identityKey.toHex(),
|
|
7764
7847
|
swarms: this.networkManager.topics
|
|
7765
7848
|
}, {
|
|
7766
7849
|
F: __dxlog_file27,
|
|
7767
|
-
L:
|
|
7850
|
+
L: 384,
|
|
7768
7851
|
S: this,
|
|
7769
7852
|
C: (f, a) => f(...a)
|
|
7770
7853
|
});
|
|
@@ -7778,7 +7861,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7778
7861
|
});
|
|
7779
7862
|
(0, import_invariant21.invariant)(identity.deviceCredentialChain, void 0, {
|
|
7780
7863
|
F: __dxlog_file27,
|
|
7781
|
-
L:
|
|
7864
|
+
L: 403,
|
|
7782
7865
|
S: this,
|
|
7783
7866
|
A: [
|
|
7784
7867
|
"identity.deviceCredentialChain",
|
|
@@ -8054,7 +8137,7 @@ var DevicesServiceImpl = class {
|
|
|
8054
8137
|
return this._identityManager.updateDeviceProfile(profile);
|
|
8055
8138
|
}
|
|
8056
8139
|
queryDevices() {
|
|
8057
|
-
return new
|
|
8140
|
+
return new import_stream11.Stream(({ next }) => {
|
|
8058
8141
|
const update = () => {
|
|
8059
8142
|
const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
|
|
8060
8143
|
if (!deviceKeys) {
|
|
@@ -8176,7 +8259,7 @@ var ContactsServiceImpl = class {
|
|
|
8176
8259
|
}
|
|
8177
8260
|
queryContacts() {
|
|
8178
8261
|
const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys20.PublicKey.hash);
|
|
8179
|
-
return new
|
|
8262
|
+
return new import_stream12.Stream(({ next, ctx }) => {
|
|
8180
8263
|
const pushUpdateTask = new import_async25.UpdateScheduler(ctx, async () => {
|
|
8181
8264
|
const contacts = await this.getContacts();
|
|
8182
8265
|
next(contacts);
|
|
@@ -8245,7 +8328,7 @@ var LoggingServiceImpl = class {
|
|
|
8245
8328
|
stats: (0, import_util16.numericalValues)(events, "duration")
|
|
8246
8329
|
};
|
|
8247
8330
|
};
|
|
8248
|
-
return new
|
|
8331
|
+
return new import_stream13.Stream(({ next }) => {
|
|
8249
8332
|
const update = () => {
|
|
8250
8333
|
const metrics2 = {
|
|
8251
8334
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -8267,7 +8350,7 @@ var LoggingServiceImpl = class {
|
|
|
8267
8350
|
});
|
|
8268
8351
|
}
|
|
8269
8352
|
queryLogs(request) {
|
|
8270
|
-
return new
|
|
8353
|
+
return new import_stream13.Stream(({ ctx, next }) => {
|
|
8271
8354
|
const handler = (entry2) => {
|
|
8272
8355
|
if (LOG_PROCESSING > 0) {
|
|
8273
8356
|
return;
|
|
@@ -8327,7 +8410,7 @@ var NetworkServiceImpl = class {
|
|
|
8327
8410
|
this.signalManager = signalManager;
|
|
8328
8411
|
}
|
|
8329
8412
|
queryStatus() {
|
|
8330
|
-
return new
|
|
8413
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8331
8414
|
const update = () => {
|
|
8332
8415
|
next({
|
|
8333
8416
|
swarm: this.networkManager.connectionState,
|
|
@@ -8350,6 +8433,35 @@ var NetworkServiceImpl = class {
|
|
|
8350
8433
|
async updateConfig(request) {
|
|
8351
8434
|
await this.networkManager.setConnectionState(request.swarm);
|
|
8352
8435
|
}
|
|
8436
|
+
async joinSwarm(request) {
|
|
8437
|
+
return this.signalManager.join(request);
|
|
8438
|
+
}
|
|
8439
|
+
async leaveSwarm(request) {
|
|
8440
|
+
return this.signalManager.leave(request);
|
|
8441
|
+
}
|
|
8442
|
+
subscribeSwarmState(request) {
|
|
8443
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8444
|
+
const unsubscribe = this.signalManager.swarmState?.on((state) => {
|
|
8445
|
+
if (request.topic.equals(state.swarmKey)) {
|
|
8446
|
+
next(state);
|
|
8447
|
+
}
|
|
8448
|
+
});
|
|
8449
|
+
return unsubscribe;
|
|
8450
|
+
});
|
|
8451
|
+
}
|
|
8452
|
+
async sendMessage(message) {
|
|
8453
|
+
return this.signalManager.sendMessage(message);
|
|
8454
|
+
}
|
|
8455
|
+
subscribeMessages(peer) {
|
|
8456
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8457
|
+
const unsubscribe = this.signalManager.onMessage.on((message) => {
|
|
8458
|
+
if (message.recipient.peerKey === peer.peerKey) {
|
|
8459
|
+
next(message);
|
|
8460
|
+
}
|
|
8461
|
+
});
|
|
8462
|
+
return unsubscribe;
|
|
8463
|
+
});
|
|
8464
|
+
}
|
|
8353
8465
|
};
|
|
8354
8466
|
var SystemServiceImpl = class {
|
|
8355
8467
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
@@ -8384,7 +8496,7 @@ var SystemServiceImpl = class {
|
|
|
8384
8496
|
}
|
|
8385
8497
|
// TODO(burdon): Standardize interval option in stream request?
|
|
8386
8498
|
queryStatus({ interval = 3e3 } = {}) {
|
|
8387
|
-
return new
|
|
8499
|
+
return new import_stream15.Stream(({ next }) => {
|
|
8388
8500
|
const update = () => {
|
|
8389
8501
|
next({
|
|
8390
8502
|
status: this._getCurrentStatus()
|
|
@@ -8850,4 +8962,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
8850
8962
|
subscribeToSpaces,
|
|
8851
8963
|
subscribeToSwarmInfo
|
|
8852
8964
|
});
|
|
8853
|
-
//# sourceMappingURL=chunk-
|
|
8965
|
+
//# sourceMappingURL=chunk-XTM3FUCM.cjs.map
|