@dxos/client-services 0.1.55 → 0.1.56-main.09ca29d
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-XSZIBW37.mjs → chunk-FD4L7N4K.mjs} +677 -293
- package/dist/lib/browser/chunk-FD4L7N4K.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +50 -33
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +12 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +729 -330
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +691 -300
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-extension.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.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/packlets/identity/authenticator.test.ts +2 -2
- package/src/packlets/identity/identity-manager.ts +1 -2
- package/src/packlets/identity/identity-service.ts +1 -2
- package/src/packlets/identity/identity.ts +1 -2
- package/src/packlets/invitations/device-invitation-protocol.ts +1 -2
- package/src/packlets/invitations/invitation-extension.ts +1 -2
- package/src/packlets/invitations/invitations-handler.ts +1 -2
- package/src/packlets/invitations/invitations-service.ts +1 -2
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -2
- package/src/packlets/locks/node.ts +1 -1
- package/src/packlets/services/service-context.ts +1 -2
- package/src/packlets/services/service-host.ts +1 -2
- package/src/packlets/spaces/data-space-manager.ts +2 -3
- package/src/packlets/spaces/notarization-plugin.ts +1 -2
- package/src/packlets/spaces/spaces-service.ts +18 -12
- package/src/packlets/testing/invitation-utils.ts +1 -2
- package/src/packlets/vault/shell-runtime.ts +1 -2
- package/src/packlets/vault/worker-session.ts +1 -2
- package/dist/lib/browser/chunk-XSZIBW37.mjs.map +0 -7
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// packages/sdk/client-services/src/packlets/testing/index.ts
|
|
@@ -61,8 +51,8 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
|
|
|
61
51
|
});
|
|
62
52
|
|
|
63
53
|
// packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
|
|
64
|
-
var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
|
|
65
54
|
var import_async18 = require("@dxos/async");
|
|
55
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
66
56
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
67
57
|
|
|
68
58
|
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
@@ -71,12 +61,12 @@ var import_debug = require("@dxos/debug");
|
|
|
71
61
|
var import_rpc = require("@dxos/rpc");
|
|
72
62
|
|
|
73
63
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
74
|
-
var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
|
|
75
64
|
var import_async11 = require("@dxos/async");
|
|
76
65
|
var import_credentials14 = require("@dxos/credentials");
|
|
77
66
|
var import_debug7 = require("@dxos/debug");
|
|
78
67
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
79
68
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
69
|
+
var import_invariant11 = require("@dxos/invariant");
|
|
80
70
|
var import_keyring = require("@dxos/keyring");
|
|
81
71
|
var import_keys8 = require("@dxos/keys");
|
|
82
72
|
var import_log12 = require("@dxos/log");
|
|
@@ -90,7 +80,7 @@ var import_context = require("@dxos/context");
|
|
|
90
80
|
var import_credentials2 = require("@dxos/credentials");
|
|
91
81
|
var import_log = require("@dxos/log");
|
|
92
82
|
var import_protocols = require("@dxos/protocols");
|
|
93
|
-
var __dxlog_file = "/
|
|
83
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
94
84
|
var Credential = import_protocols.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
95
85
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
96
86
|
const credential = await signer.createCredential({
|
|
@@ -201,15 +191,15 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
201
191
|
};
|
|
202
192
|
|
|
203
193
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
204
|
-
var import_tiny_invariant = __toESM(require("tiny-invariant"));
|
|
205
194
|
var import_async2 = require("@dxos/async");
|
|
206
195
|
var import_client_protocol = require("@dxos/client-protocol");
|
|
207
196
|
var import_credentials3 = require("@dxos/credentials");
|
|
208
197
|
var import_debug2 = require("@dxos/debug");
|
|
209
198
|
var import_feed_store = require("@dxos/feed-store");
|
|
199
|
+
var import_invariant = require("@dxos/invariant");
|
|
210
200
|
var import_log2 = require("@dxos/log");
|
|
211
201
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
212
|
-
var __dxlog_file2 = "/
|
|
202
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
213
203
|
var Identity = class {
|
|
214
204
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
215
205
|
this.stateUpdate = new import_async2.Event();
|
|
@@ -284,7 +274,15 @@ var Identity = class {
|
|
|
284
274
|
* Requires identity to be ready.
|
|
285
275
|
*/
|
|
286
276
|
getIdentityCredentialSigner() {
|
|
287
|
-
(0,
|
|
277
|
+
(0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
278
|
+
F: __dxlog_file2,
|
|
279
|
+
L: 134,
|
|
280
|
+
S: this,
|
|
281
|
+
A: [
|
|
282
|
+
"this._deviceStateMachine.deviceCredentialChain",
|
|
283
|
+
"'Device credential chain is not ready.'"
|
|
284
|
+
]
|
|
285
|
+
});
|
|
288
286
|
return (0, import_credentials3.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.deviceCredentialChain, this.deviceKey);
|
|
289
287
|
}
|
|
290
288
|
/**
|
|
@@ -302,7 +300,7 @@ var Identity = class {
|
|
|
302
300
|
dataFeedKey
|
|
303
301
|
}, {
|
|
304
302
|
F: __dxlog_file2,
|
|
305
|
-
L:
|
|
303
|
+
L: 150,
|
|
306
304
|
S: this,
|
|
307
305
|
C: (f, a) => f(...a)
|
|
308
306
|
});
|
|
@@ -345,15 +343,15 @@ var Identity = class {
|
|
|
345
343
|
};
|
|
346
344
|
|
|
347
345
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
348
|
-
var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
|
|
349
346
|
var import_async3 = require("@dxos/async");
|
|
350
347
|
var import_credentials5 = require("@dxos/credentials");
|
|
348
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
351
349
|
var import_keys2 = require("@dxos/keys");
|
|
352
350
|
var import_log3 = require("@dxos/log");
|
|
353
351
|
var import_protocols2 = require("@dxos/protocols");
|
|
354
352
|
var import_credentials6 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
355
353
|
var import_util = require("@dxos/util");
|
|
356
|
-
var __dxlog_file3 = "/
|
|
354
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
357
355
|
var IdentityManager = class {
|
|
358
356
|
// TODO(burdon): IdentityManagerParams.
|
|
359
357
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
@@ -374,7 +372,7 @@ var IdentityManager = class {
|
|
|
374
372
|
id: traceId
|
|
375
373
|
}), {
|
|
376
374
|
F: __dxlog_file3,
|
|
377
|
-
L:
|
|
375
|
+
L: 69,
|
|
378
376
|
S: this,
|
|
379
377
|
C: (f, a) => f(...a)
|
|
380
378
|
});
|
|
@@ -384,7 +382,7 @@ var IdentityManager = class {
|
|
|
384
382
|
identityRecord
|
|
385
383
|
}, {
|
|
386
384
|
F: __dxlog_file3,
|
|
387
|
-
L:
|
|
385
|
+
L: 73,
|
|
388
386
|
S: this,
|
|
389
387
|
C: (f, a) => f(...a)
|
|
390
388
|
});
|
|
@@ -397,7 +395,7 @@ var IdentityManager = class {
|
|
|
397
395
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
398
396
|
}, {
|
|
399
397
|
F: __dxlog_file3,
|
|
400
|
-
L:
|
|
398
|
+
L: 78,
|
|
401
399
|
S: this,
|
|
402
400
|
C: (f, a) => f(...a)
|
|
403
401
|
});
|
|
@@ -407,7 +405,7 @@ var IdentityManager = class {
|
|
|
407
405
|
id: traceId
|
|
408
406
|
}), {
|
|
409
407
|
F: __dxlog_file3,
|
|
410
|
-
L:
|
|
408
|
+
L: 84,
|
|
411
409
|
S: this,
|
|
412
410
|
C: (f, a) => f(...a)
|
|
413
411
|
});
|
|
@@ -418,10 +416,18 @@ var IdentityManager = class {
|
|
|
418
416
|
}
|
|
419
417
|
async createIdentity({ displayName } = {}) {
|
|
420
418
|
var _a;
|
|
421
|
-
(0,
|
|
419
|
+
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
420
|
+
F: __dxlog_file3,
|
|
421
|
+
L: 92,
|
|
422
|
+
S: this,
|
|
423
|
+
A: [
|
|
424
|
+
"!this._identity",
|
|
425
|
+
"'Identity already exists.'"
|
|
426
|
+
]
|
|
427
|
+
});
|
|
422
428
|
(0, import_log3.log)("creating identity...", void 0, {
|
|
423
429
|
F: __dxlog_file3,
|
|
424
|
-
L:
|
|
430
|
+
L: 93,
|
|
425
431
|
S: this,
|
|
426
432
|
C: (f, a) => f(...a)
|
|
427
433
|
});
|
|
@@ -440,8 +446,24 @@ var IdentityManager = class {
|
|
|
440
446
|
await identity.open();
|
|
441
447
|
{
|
|
442
448
|
const generator = new import_credentials5.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
443
|
-
(0,
|
|
444
|
-
|
|
449
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
450
|
+
F: __dxlog_file3,
|
|
451
|
+
L: 112,
|
|
452
|
+
S: this,
|
|
453
|
+
A: [
|
|
454
|
+
"identityRecord.haloSpace.genesisFeedKey",
|
|
455
|
+
"'Genesis feed key is required.'"
|
|
456
|
+
]
|
|
457
|
+
});
|
|
458
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
459
|
+
F: __dxlog_file3,
|
|
460
|
+
L: 113,
|
|
461
|
+
S: this,
|
|
462
|
+
A: [
|
|
463
|
+
"identityRecord.haloSpace.dataFeedKey",
|
|
464
|
+
"'Data feed key is required.'"
|
|
465
|
+
]
|
|
466
|
+
});
|
|
445
467
|
const credentials = [
|
|
446
468
|
// Space genesis.
|
|
447
469
|
...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
|
|
@@ -470,7 +492,7 @@ var IdentityManager = class {
|
|
|
470
492
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
471
493
|
}, {
|
|
472
494
|
F: __dxlog_file3,
|
|
473
|
-
L:
|
|
495
|
+
L: 148,
|
|
474
496
|
S: this,
|
|
475
497
|
C: (f, a) => f(...a)
|
|
476
498
|
});
|
|
@@ -480,7 +502,7 @@ var IdentityManager = class {
|
|
|
480
502
|
deviceKey: identity.deviceKey
|
|
481
503
|
}, {
|
|
482
504
|
F: __dxlog_file3,
|
|
483
|
-
L:
|
|
505
|
+
L: 154,
|
|
484
506
|
S: this,
|
|
485
507
|
C: (f, a) => f(...a)
|
|
486
508
|
});
|
|
@@ -495,11 +517,19 @@ var IdentityManager = class {
|
|
|
495
517
|
params
|
|
496
518
|
}, {
|
|
497
519
|
F: __dxlog_file3,
|
|
498
|
-
L:
|
|
520
|
+
L: 162,
|
|
499
521
|
S: this,
|
|
500
522
|
C: (f, a) => f(...a)
|
|
501
523
|
});
|
|
502
|
-
(0,
|
|
524
|
+
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
525
|
+
F: __dxlog_file3,
|
|
526
|
+
L: 163,
|
|
527
|
+
S: this,
|
|
528
|
+
A: [
|
|
529
|
+
"!this._identity",
|
|
530
|
+
"'Identity already exists.'"
|
|
531
|
+
]
|
|
532
|
+
});
|
|
503
533
|
const identityRecord = {
|
|
504
534
|
identityKey: params.identityKey,
|
|
505
535
|
deviceKey: params.deviceKey,
|
|
@@ -521,7 +551,7 @@ var IdentityManager = class {
|
|
|
521
551
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
522
552
|
}, {
|
|
523
553
|
F: __dxlog_file3,
|
|
524
|
-
L:
|
|
554
|
+
L: 182,
|
|
525
555
|
S: this,
|
|
526
556
|
C: (f, a) => f(...a)
|
|
527
557
|
});
|
|
@@ -531,27 +561,51 @@ var IdentityManager = class {
|
|
|
531
561
|
deviceKey: identity.deviceKey
|
|
532
562
|
}, {
|
|
533
563
|
F: __dxlog_file3,
|
|
534
|
-
L:
|
|
564
|
+
L: 188,
|
|
535
565
|
S: this,
|
|
536
566
|
C: (f, a) => f(...a)
|
|
537
567
|
});
|
|
538
568
|
return identity;
|
|
539
569
|
}
|
|
540
570
|
async _constructIdentity(identityRecord) {
|
|
541
|
-
(0,
|
|
571
|
+
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
572
|
+
F: __dxlog_file3,
|
|
573
|
+
L: 193,
|
|
574
|
+
S: this,
|
|
575
|
+
A: [
|
|
576
|
+
"!this._identity",
|
|
577
|
+
""
|
|
578
|
+
]
|
|
579
|
+
});
|
|
542
580
|
(0, import_log3.log)("constructing identity", {
|
|
543
581
|
identityRecord
|
|
544
582
|
}, {
|
|
545
583
|
F: __dxlog_file3,
|
|
546
|
-
L:
|
|
584
|
+
L: 194,
|
|
547
585
|
S: this,
|
|
548
586
|
C: (f, a) => f(...a)
|
|
549
587
|
});
|
|
550
|
-
(0,
|
|
588
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
589
|
+
F: __dxlog_file3,
|
|
590
|
+
L: 197,
|
|
591
|
+
S: this,
|
|
592
|
+
A: [
|
|
593
|
+
"identityRecord.haloSpace.controlFeedKey",
|
|
594
|
+
""
|
|
595
|
+
]
|
|
596
|
+
});
|
|
551
597
|
const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
|
|
552
598
|
writable: true
|
|
553
599
|
});
|
|
554
|
-
(0,
|
|
600
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
601
|
+
F: __dxlog_file3,
|
|
602
|
+
L: 201,
|
|
603
|
+
S: this,
|
|
604
|
+
A: [
|
|
605
|
+
"identityRecord.haloSpace.dataFeedKey",
|
|
606
|
+
""
|
|
607
|
+
]
|
|
608
|
+
});
|
|
555
609
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
556
610
|
writable: true,
|
|
557
611
|
sparse: true
|
|
@@ -577,7 +631,7 @@ var IdentityManager = class {
|
|
|
577
631
|
identityKey: identityRecord.identityKey
|
|
578
632
|
}, {
|
|
579
633
|
F: __dxlog_file3,
|
|
580
|
-
L:
|
|
634
|
+
L: 225,
|
|
581
635
|
S: this,
|
|
582
636
|
C: (f, a) => f(...a)
|
|
583
637
|
});
|
|
@@ -598,7 +652,7 @@ var IdentityManager = class {
|
|
|
598
652
|
onAuthFailure: () => {
|
|
599
653
|
import_log3.log.warn("auth failure", void 0, {
|
|
600
654
|
F: __dxlog_file3,
|
|
601
|
-
L:
|
|
655
|
+
L: 244,
|
|
602
656
|
S: this,
|
|
603
657
|
C: (f, a) => f(...a)
|
|
604
658
|
});
|
|
@@ -609,10 +663,11 @@ var IdentityManager = class {
|
|
|
609
663
|
};
|
|
610
664
|
|
|
611
665
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
612
|
-
var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
|
|
613
666
|
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
614
667
|
var import_credentials7 = require("@dxos/credentials");
|
|
615
668
|
var import_debug3 = require("@dxos/debug");
|
|
669
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
670
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
616
671
|
var IdentityServiceImpl = class {
|
|
617
672
|
// TODO(wittjosiah): Remove dependency on service context.
|
|
618
673
|
constructor(_serviceContext) {
|
|
@@ -645,7 +700,15 @@ var IdentityServiceImpl = class {
|
|
|
645
700
|
};
|
|
646
701
|
}
|
|
647
702
|
async signPresentation({ presentation, nonce }) {
|
|
648
|
-
(0,
|
|
703
|
+
(0, import_invariant3.invariant)(this._serviceContext.identityManager.identity, "Identity not initialized.", {
|
|
704
|
+
F: __dxlog_file4,
|
|
705
|
+
L: 56,
|
|
706
|
+
S: this,
|
|
707
|
+
A: [
|
|
708
|
+
"this._serviceContext.identityManager.identity",
|
|
709
|
+
"'Identity not initialized.'"
|
|
710
|
+
]
|
|
711
|
+
});
|
|
649
712
|
return await (0, import_credentials7.signPresentation)({
|
|
650
713
|
presentation,
|
|
651
714
|
signer: this._serviceContext.keyring,
|
|
@@ -657,8 +720,9 @@ var IdentityServiceImpl = class {
|
|
|
657
720
|
};
|
|
658
721
|
|
|
659
722
|
// packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
|
|
660
|
-
var
|
|
723
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
661
724
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
725
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
662
726
|
var DeviceInvitationProtocol = class {
|
|
663
727
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
664
728
|
this._keyring = _keyring;
|
|
@@ -674,7 +738,15 @@ var DeviceInvitationProtocol = class {
|
|
|
674
738
|
};
|
|
675
739
|
}
|
|
676
740
|
async admit(request) {
|
|
677
|
-
(0,
|
|
741
|
+
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
742
|
+
F: __dxlog_file5,
|
|
743
|
+
L: 31,
|
|
744
|
+
S: this,
|
|
745
|
+
A: [
|
|
746
|
+
"request.device",
|
|
747
|
+
""
|
|
748
|
+
]
|
|
749
|
+
});
|
|
678
750
|
const identity = this._getIdentity();
|
|
679
751
|
await identity.admitDevice(request.device);
|
|
680
752
|
return {
|
|
@@ -702,9 +774,25 @@ var DeviceInvitationProtocol = class {
|
|
|
702
774
|
};
|
|
703
775
|
}
|
|
704
776
|
async accept(response, request) {
|
|
705
|
-
(0,
|
|
777
|
+
(0, import_invariant4.invariant)(response.device, void 0, {
|
|
778
|
+
F: __dxlog_file5,
|
|
779
|
+
L: 64,
|
|
780
|
+
S: this,
|
|
781
|
+
A: [
|
|
782
|
+
"response.device",
|
|
783
|
+
""
|
|
784
|
+
]
|
|
785
|
+
});
|
|
706
786
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
707
|
-
(0,
|
|
787
|
+
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
788
|
+
F: __dxlog_file5,
|
|
789
|
+
L: 67,
|
|
790
|
+
S: this,
|
|
791
|
+
A: [
|
|
792
|
+
"request.device",
|
|
793
|
+
""
|
|
794
|
+
]
|
|
795
|
+
});
|
|
708
796
|
const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
|
|
709
797
|
await this._acceptIdentity({
|
|
710
798
|
identityKey,
|
|
@@ -722,12 +810,12 @@ var DeviceInvitationProtocol = class {
|
|
|
722
810
|
};
|
|
723
811
|
|
|
724
812
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
725
|
-
var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
|
|
726
813
|
var import_async5 = require("@dxos/async");
|
|
727
814
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
728
815
|
var import_context3 = require("@dxos/context");
|
|
729
816
|
var import_credentials8 = require("@dxos/credentials");
|
|
730
817
|
var import_errors2 = require("@dxos/errors");
|
|
818
|
+
var import_invariant6 = require("@dxos/invariant");
|
|
731
819
|
var import_keys4 = require("@dxos/keys");
|
|
732
820
|
var import_log5 = require("@dxos/log");
|
|
733
821
|
var import_network_manager = require("@dxos/network-manager");
|
|
@@ -736,17 +824,17 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
736
824
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
737
825
|
|
|
738
826
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
739
|
-
var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
|
|
740
827
|
var import_async4 = require("@dxos/async");
|
|
741
828
|
var import_context2 = require("@dxos/context");
|
|
742
829
|
var import_errors = require("@dxos/errors");
|
|
830
|
+
var import_invariant5 = require("@dxos/invariant");
|
|
743
831
|
var import_keys3 = require("@dxos/keys");
|
|
744
832
|
var import_log4 = require("@dxos/log");
|
|
745
833
|
var import_protocols3 = require("@dxos/protocols");
|
|
746
834
|
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
747
835
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
748
836
|
var import_teleport = require("@dxos/teleport");
|
|
749
|
-
var
|
|
837
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
|
|
750
838
|
var OPTIONS_TIMEOUT = 1e4;
|
|
751
839
|
var MAX_OTP_ATTEMPTS = 3;
|
|
752
840
|
var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
@@ -774,7 +862,15 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
774
862
|
// Perhaps in the future we will have more complex logic here.
|
|
775
863
|
InvitationHostService: {
|
|
776
864
|
options: async (options) => {
|
|
777
|
-
(0,
|
|
865
|
+
(0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
866
|
+
F: __dxlog_file6,
|
|
867
|
+
L: 88,
|
|
868
|
+
S: this,
|
|
869
|
+
A: [
|
|
870
|
+
"!this._remoteOptions",
|
|
871
|
+
"'Remote options already set.'"
|
|
872
|
+
]
|
|
873
|
+
});
|
|
778
874
|
this._remoteOptions = options;
|
|
779
875
|
this._remoteOptionsTrigger.wake();
|
|
780
876
|
},
|
|
@@ -784,8 +880,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
784
880
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
|
|
785
881
|
id: traceId
|
|
786
882
|
}), {
|
|
787
|
-
F:
|
|
788
|
-
L:
|
|
883
|
+
F: __dxlog_file6,
|
|
884
|
+
L: 97,
|
|
789
885
|
S: this,
|
|
790
886
|
C: (f, a) => f(...a)
|
|
791
887
|
});
|
|
@@ -794,8 +890,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
794
890
|
import_log4.log.warn("invitation not found", {
|
|
795
891
|
invitationId
|
|
796
892
|
}, {
|
|
797
|
-
F:
|
|
798
|
-
L:
|
|
893
|
+
F: __dxlog_file6,
|
|
894
|
+
L: 101,
|
|
799
895
|
S: this,
|
|
800
896
|
C: (f, a) => f(...a)
|
|
801
897
|
});
|
|
@@ -808,8 +904,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
808
904
|
(0, import_log4.log)("guest introduced itself", {
|
|
809
905
|
guestProfile: profile
|
|
810
906
|
}, {
|
|
811
|
-
F:
|
|
812
|
-
L:
|
|
907
|
+
F: __dxlog_file6,
|
|
908
|
+
L: 110,
|
|
813
909
|
S: this,
|
|
814
910
|
C: (f, a) => f(...a)
|
|
815
911
|
});
|
|
@@ -821,8 +917,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
821
917
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
|
|
822
918
|
id: traceId
|
|
823
919
|
}), {
|
|
824
|
-
F:
|
|
825
|
-
L:
|
|
920
|
+
F: __dxlog_file6,
|
|
921
|
+
L: 117,
|
|
826
922
|
S: this,
|
|
827
923
|
C: (f, a) => f(...a)
|
|
828
924
|
});
|
|
@@ -836,26 +932,34 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
836
932
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
|
|
837
933
|
id: traceId
|
|
838
934
|
}), {
|
|
839
|
-
F:
|
|
840
|
-
L:
|
|
935
|
+
F: __dxlog_file6,
|
|
936
|
+
L: 126,
|
|
841
937
|
S: this,
|
|
842
938
|
C: (f, a) => f(...a)
|
|
843
939
|
});
|
|
844
940
|
(0, import_log4.log)("received authentication request", {
|
|
845
941
|
authCode: code
|
|
846
942
|
}, {
|
|
847
|
-
F:
|
|
848
|
-
L:
|
|
943
|
+
F: __dxlog_file6,
|
|
944
|
+
L: 127,
|
|
849
945
|
S: this,
|
|
850
946
|
C: (f, a) => f(...a)
|
|
851
947
|
});
|
|
852
948
|
let status = import_invitations.AuthenticationResponse.Status.OK;
|
|
853
|
-
(0,
|
|
949
|
+
(0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
|
|
950
|
+
F: __dxlog_file6,
|
|
951
|
+
L: 130,
|
|
952
|
+
S: this,
|
|
953
|
+
A: [
|
|
954
|
+
"this.invitation",
|
|
955
|
+
"'Invitation is not set.'"
|
|
956
|
+
]
|
|
957
|
+
});
|
|
854
958
|
switch (this.invitation.authMethod) {
|
|
855
959
|
case import_services2.Invitation.AuthMethod.NONE: {
|
|
856
960
|
(0, import_log4.log)("authentication not required", void 0, {
|
|
857
|
-
F:
|
|
858
|
-
L:
|
|
961
|
+
F: __dxlog_file6,
|
|
962
|
+
L: 133,
|
|
859
963
|
S: this,
|
|
860
964
|
C: (f, a) => f(...a)
|
|
861
965
|
});
|
|
@@ -879,8 +983,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
879
983
|
import_log4.log.error("invalid authentication method", {
|
|
880
984
|
authMethod: this.invitation.authMethod
|
|
881
985
|
}, {
|
|
882
|
-
F:
|
|
883
|
-
L:
|
|
986
|
+
F: __dxlog_file6,
|
|
987
|
+
L: 151,
|
|
884
988
|
S: this,
|
|
885
989
|
C: (f, a) => f(...a)
|
|
886
990
|
});
|
|
@@ -894,8 +998,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
894
998
|
status
|
|
895
999
|
}
|
|
896
1000
|
}), {
|
|
897
|
-
F:
|
|
898
|
-
L:
|
|
1001
|
+
F: __dxlog_file6,
|
|
1002
|
+
L: 157,
|
|
899
1003
|
S: this,
|
|
900
1004
|
C: (f, a) => f(...a)
|
|
901
1005
|
});
|
|
@@ -908,13 +1012,21 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
908
1012
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
|
|
909
1013
|
id: traceId
|
|
910
1014
|
}), {
|
|
911
|
-
F:
|
|
912
|
-
L:
|
|
1015
|
+
F: __dxlog_file6,
|
|
1016
|
+
L: 163,
|
|
913
1017
|
S: this,
|
|
914
1018
|
C: (f, a) => f(...a)
|
|
915
1019
|
});
|
|
916
1020
|
try {
|
|
917
|
-
(0,
|
|
1021
|
+
(0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
|
|
1022
|
+
F: __dxlog_file6,
|
|
1023
|
+
L: 166,
|
|
1024
|
+
S: this,
|
|
1025
|
+
A: [
|
|
1026
|
+
"this.invitation",
|
|
1027
|
+
"'Invitation is not set.'"
|
|
1028
|
+
]
|
|
1029
|
+
});
|
|
918
1030
|
if (isAuthenticationRequired(this.invitation) && !this.authenticationPassed) {
|
|
919
1031
|
throw new Error("Not authenticated");
|
|
920
1032
|
}
|
|
@@ -922,8 +1034,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
922
1034
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
|
|
923
1035
|
id: traceId
|
|
924
1036
|
}), {
|
|
925
|
-
F:
|
|
926
|
-
L:
|
|
1037
|
+
F: __dxlog_file6,
|
|
1038
|
+
L: 174,
|
|
927
1039
|
S: this,
|
|
928
1040
|
C: (f, a) => f(...a)
|
|
929
1041
|
});
|
|
@@ -979,7 +1091,15 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
979
1091
|
return {
|
|
980
1092
|
InvitationHostService: {
|
|
981
1093
|
options: async (options) => {
|
|
982
|
-
(0,
|
|
1094
|
+
(0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1095
|
+
F: __dxlog_file6,
|
|
1096
|
+
L: 241,
|
|
1097
|
+
S: this,
|
|
1098
|
+
A: [
|
|
1099
|
+
"!this._remoteOptions",
|
|
1100
|
+
"'Remote options already set.'"
|
|
1101
|
+
]
|
|
1102
|
+
});
|
|
983
1103
|
this._remoteOptions = options;
|
|
984
1104
|
this._remoteOptionsTrigger.wake();
|
|
985
1105
|
},
|
|
@@ -1000,8 +1120,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1000
1120
|
await super.onOpen(context);
|
|
1001
1121
|
try {
|
|
1002
1122
|
(0, import_log4.log)("begin options", void 0, {
|
|
1003
|
-
F:
|
|
1004
|
-
L:
|
|
1123
|
+
F: __dxlog_file6,
|
|
1124
|
+
L: 262,
|
|
1005
1125
|
S: this,
|
|
1006
1126
|
C: (f, a) => f(...a)
|
|
1007
1127
|
});
|
|
@@ -1012,8 +1132,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1012
1132
|
timeout: OPTIONS_TIMEOUT
|
|
1013
1133
|
}));
|
|
1014
1134
|
(0, import_log4.log)("end options", void 0, {
|
|
1015
|
-
F:
|
|
1016
|
-
L:
|
|
1135
|
+
F: __dxlog_file6,
|
|
1136
|
+
L: 265,
|
|
1017
1137
|
S: this,
|
|
1018
1138
|
C: (f, a) => f(...a)
|
|
1019
1139
|
});
|
|
@@ -1026,8 +1146,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1026
1146
|
this._callbacks.onOpen(this._ctx);
|
|
1027
1147
|
} catch (err) {
|
|
1028
1148
|
(0, import_log4.log)("openError", err, {
|
|
1029
|
-
F:
|
|
1030
|
-
L:
|
|
1149
|
+
F: __dxlog_file6,
|
|
1150
|
+
L: 275,
|
|
1031
1151
|
S: this,
|
|
1032
1152
|
C: (f, a) => f(...a)
|
|
1033
1153
|
});
|
|
@@ -1036,8 +1156,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1036
1156
|
}
|
|
1037
1157
|
async onClose() {
|
|
1038
1158
|
(0, import_log4.log)("onClose", void 0, {
|
|
1039
|
-
F:
|
|
1040
|
-
L:
|
|
1159
|
+
F: __dxlog_file6,
|
|
1160
|
+
L: 281,
|
|
1041
1161
|
S: this,
|
|
1042
1162
|
C: (f, a) => f(...a)
|
|
1043
1163
|
});
|
|
@@ -1047,7 +1167,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1047
1167
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services2.Invitation.AuthMethod.NONE;
|
|
1048
1168
|
|
|
1049
1169
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1050
|
-
var
|
|
1170
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
1051
1171
|
var InvitationsHandler = class {
|
|
1052
1172
|
/**
|
|
1053
1173
|
* @internal
|
|
@@ -1059,7 +1179,15 @@ var InvitationsHandler = class {
|
|
|
1059
1179
|
var _a;
|
|
1060
1180
|
const { invitationId = import_keys4.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys4.PublicKey.random() } = options != null ? options : {};
|
|
1061
1181
|
const authCode = (_a = options == null ? void 0 : options.authCode) != null ? _a : authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials8.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0;
|
|
1062
|
-
(0,
|
|
1182
|
+
(0, import_invariant6.invariant)(protocol, void 0, {
|
|
1183
|
+
F: __dxlog_file7,
|
|
1184
|
+
L: 76,
|
|
1185
|
+
S: this,
|
|
1186
|
+
A: [
|
|
1187
|
+
"protocol",
|
|
1188
|
+
""
|
|
1189
|
+
]
|
|
1190
|
+
});
|
|
1063
1191
|
const invitation = {
|
|
1064
1192
|
invitationId,
|
|
1065
1193
|
type,
|
|
@@ -1081,8 +1209,8 @@ var InvitationsHandler = class {
|
|
|
1081
1209
|
(0, import_log5.log)("complete", {
|
|
1082
1210
|
...protocol.toJSON()
|
|
1083
1211
|
}, {
|
|
1084
|
-
F:
|
|
1085
|
-
L:
|
|
1212
|
+
F: __dxlog_file7,
|
|
1213
|
+
L: 98,
|
|
1086
1214
|
S: this,
|
|
1087
1215
|
C: (f, a) => f(...a)
|
|
1088
1216
|
});
|
|
@@ -1106,7 +1234,15 @@ var InvitationsHandler = class {
|
|
|
1106
1234
|
var _a2, _b, _c;
|
|
1107
1235
|
try {
|
|
1108
1236
|
const deviceKey = (_c = (_a2 = admissionRequest.device) == null ? void 0 : _a2.deviceKey) != null ? _c : (_b = admissionRequest.space) == null ? void 0 : _b.deviceKey;
|
|
1109
|
-
(0,
|
|
1237
|
+
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
1238
|
+
F: __dxlog_file7,
|
|
1239
|
+
L: 119,
|
|
1240
|
+
S: this,
|
|
1241
|
+
A: [
|
|
1242
|
+
"deviceKey",
|
|
1243
|
+
""
|
|
1244
|
+
]
|
|
1245
|
+
});
|
|
1110
1246
|
const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
|
|
1111
1247
|
extension.completedTrigger.wake(deviceKey);
|
|
1112
1248
|
return admissionResponse;
|
|
@@ -1122,16 +1258,16 @@ var InvitationsHandler = class {
|
|
|
1122
1258
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1123
1259
|
id: traceId
|
|
1124
1260
|
}), {
|
|
1125
|
-
F:
|
|
1126
|
-
L:
|
|
1261
|
+
F: __dxlog_file7,
|
|
1262
|
+
L: 137,
|
|
1127
1263
|
S: this,
|
|
1128
1264
|
C: (f, a) => f(...a)
|
|
1129
1265
|
});
|
|
1130
1266
|
(0, import_log5.log)("connected", {
|
|
1131
1267
|
...protocol.toJSON()
|
|
1132
1268
|
}, {
|
|
1133
|
-
F:
|
|
1134
|
-
L:
|
|
1269
|
+
F: __dxlog_file7,
|
|
1270
|
+
L: 138,
|
|
1135
1271
|
S: this,
|
|
1136
1272
|
C: (f, a) => f(...a)
|
|
1137
1273
|
});
|
|
@@ -1146,8 +1282,8 @@ var InvitationsHandler = class {
|
|
|
1146
1282
|
guest: deviceKey,
|
|
1147
1283
|
...protocol.toJSON()
|
|
1148
1284
|
}, {
|
|
1149
|
-
F:
|
|
1150
|
-
L:
|
|
1285
|
+
F: __dxlog_file7,
|
|
1286
|
+
L: 141,
|
|
1151
1287
|
S: this,
|
|
1152
1288
|
C: (f, a) => f(...a)
|
|
1153
1289
|
});
|
|
@@ -1158,8 +1294,8 @@ var InvitationsHandler = class {
|
|
|
1158
1294
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1159
1295
|
id: traceId
|
|
1160
1296
|
}), {
|
|
1161
|
-
F:
|
|
1162
|
-
L:
|
|
1297
|
+
F: __dxlog_file7,
|
|
1298
|
+
L: 143,
|
|
1163
1299
|
S: this,
|
|
1164
1300
|
C: (f, a) => f(...a)
|
|
1165
1301
|
});
|
|
@@ -1168,8 +1304,8 @@ var InvitationsHandler = class {
|
|
|
1168
1304
|
(0, import_log5.log)("timeout", {
|
|
1169
1305
|
...protocol.toJSON()
|
|
1170
1306
|
}, {
|
|
1171
|
-
F:
|
|
1172
|
-
L:
|
|
1307
|
+
F: __dxlog_file7,
|
|
1308
|
+
L: 146,
|
|
1173
1309
|
S: this,
|
|
1174
1310
|
C: (f, a) => f(...a)
|
|
1175
1311
|
});
|
|
@@ -1179,8 +1315,8 @@ var InvitationsHandler = class {
|
|
|
1179
1315
|
});
|
|
1180
1316
|
} else {
|
|
1181
1317
|
import_log5.log.error("failed", err, {
|
|
1182
|
-
F:
|
|
1183
|
-
L:
|
|
1318
|
+
F: __dxlog_file7,
|
|
1319
|
+
L: 149,
|
|
1184
1320
|
S: this,
|
|
1185
1321
|
C: (f, a) => f(...a)
|
|
1186
1322
|
});
|
|
@@ -1190,8 +1326,8 @@ var InvitationsHandler = class {
|
|
|
1190
1326
|
id: traceId,
|
|
1191
1327
|
error: err
|
|
1192
1328
|
}), {
|
|
1193
|
-
F:
|
|
1194
|
-
L:
|
|
1329
|
+
F: __dxlog_file7,
|
|
1330
|
+
L: 152,
|
|
1195
1331
|
S: this,
|
|
1196
1332
|
C: (f, a) => f(...a)
|
|
1197
1333
|
});
|
|
@@ -1211,8 +1347,8 @@ var InvitationsHandler = class {
|
|
|
1211
1347
|
(0, import_log5.log)("timeout", {
|
|
1212
1348
|
...protocol.toJSON()
|
|
1213
1349
|
}, {
|
|
1214
|
-
F:
|
|
1215
|
-
L:
|
|
1350
|
+
F: __dxlog_file7,
|
|
1351
|
+
L: 167,
|
|
1216
1352
|
S: this,
|
|
1217
1353
|
C: (f, a) => f(...a)
|
|
1218
1354
|
});
|
|
@@ -1222,8 +1358,8 @@ var InvitationsHandler = class {
|
|
|
1222
1358
|
});
|
|
1223
1359
|
} else {
|
|
1224
1360
|
import_log5.log.error("failed", err, {
|
|
1225
|
-
F:
|
|
1226
|
-
L:
|
|
1361
|
+
F: __dxlog_file7,
|
|
1362
|
+
L: 170,
|
|
1227
1363
|
S: this,
|
|
1228
1364
|
C: (f, a) => f(...a)
|
|
1229
1365
|
});
|
|
@@ -1265,13 +1401,29 @@ var InvitationsHandler = class {
|
|
|
1265
1401
|
}
|
|
1266
1402
|
acceptInvitation(protocol, invitation) {
|
|
1267
1403
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
1268
|
-
(0,
|
|
1404
|
+
(0, import_invariant6.invariant)(protocol, void 0, {
|
|
1405
|
+
F: __dxlog_file7,
|
|
1406
|
+
L: 210,
|
|
1407
|
+
S: this,
|
|
1408
|
+
A: [
|
|
1409
|
+
"protocol",
|
|
1410
|
+
""
|
|
1411
|
+
]
|
|
1412
|
+
});
|
|
1269
1413
|
const authenticated = new import_async5.Trigger();
|
|
1270
1414
|
let admitted = false;
|
|
1271
1415
|
let currentState;
|
|
1272
1416
|
const stream = new import_async5.PushStream();
|
|
1273
1417
|
const setState = (newData) => {
|
|
1274
|
-
(0,
|
|
1418
|
+
(0, import_invariant6.invariant)(newData.state !== void 0, void 0, {
|
|
1419
|
+
F: __dxlog_file7,
|
|
1420
|
+
L: 221,
|
|
1421
|
+
S: this,
|
|
1422
|
+
A: [
|
|
1423
|
+
"newData.state !== undefined",
|
|
1424
|
+
""
|
|
1425
|
+
]
|
|
1426
|
+
});
|
|
1275
1427
|
currentState = newData.state;
|
|
1276
1428
|
stream.next({
|
|
1277
1429
|
...invitation,
|
|
@@ -1284,8 +1436,8 @@ var InvitationsHandler = class {
|
|
|
1284
1436
|
(0, import_log5.log)("timeout", {
|
|
1285
1437
|
...protocol.toJSON()
|
|
1286
1438
|
}, {
|
|
1287
|
-
F:
|
|
1288
|
-
L:
|
|
1439
|
+
F: __dxlog_file7,
|
|
1440
|
+
L: 229,
|
|
1289
1441
|
S: this,
|
|
1290
1442
|
C: (f, a) => f(...a)
|
|
1291
1443
|
});
|
|
@@ -1294,8 +1446,8 @@ var InvitationsHandler = class {
|
|
|
1294
1446
|
});
|
|
1295
1447
|
} else {
|
|
1296
1448
|
import_log5.log.warn("auth failed", err, {
|
|
1297
|
-
F:
|
|
1298
|
-
L:
|
|
1449
|
+
F: __dxlog_file7,
|
|
1450
|
+
L: 232,
|
|
1299
1451
|
S: this,
|
|
1300
1452
|
C: (f, a) => f(...a)
|
|
1301
1453
|
});
|
|
@@ -1308,8 +1460,8 @@ var InvitationsHandler = class {
|
|
|
1308
1460
|
(0, import_log5.log)("complete", {
|
|
1309
1461
|
...protocol.toJSON()
|
|
1310
1462
|
}, {
|
|
1311
|
-
F:
|
|
1312
|
-
L:
|
|
1463
|
+
F: __dxlog_file7,
|
|
1464
|
+
L: 240,
|
|
1313
1465
|
S: this,
|
|
1314
1466
|
C: (f, a) => f(...a)
|
|
1315
1467
|
});
|
|
@@ -1323,8 +1475,8 @@ var InvitationsHandler = class {
|
|
|
1323
1475
|
(0, import_log5.log)("extension disposed", {
|
|
1324
1476
|
currentState
|
|
1325
1477
|
}, {
|
|
1326
|
-
F:
|
|
1327
|
-
L:
|
|
1478
|
+
F: __dxlog_file7,
|
|
1479
|
+
L: 250,
|
|
1328
1480
|
S: this,
|
|
1329
1481
|
C: (f, a) => f(...a)
|
|
1330
1482
|
});
|
|
@@ -1338,8 +1490,8 @@ var InvitationsHandler = class {
|
|
|
1338
1490
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
1339
1491
|
id: traceId
|
|
1340
1492
|
}), {
|
|
1341
|
-
F:
|
|
1342
|
-
L:
|
|
1493
|
+
F: __dxlog_file7,
|
|
1494
|
+
L: 259,
|
|
1343
1495
|
S: this,
|
|
1344
1496
|
C: (f, a) => f(...a)
|
|
1345
1497
|
});
|
|
@@ -1350,8 +1502,8 @@ var InvitationsHandler = class {
|
|
|
1350
1502
|
(0, import_log5.log)("connected", {
|
|
1351
1503
|
...protocol.toJSON()
|
|
1352
1504
|
}, {
|
|
1353
|
-
F:
|
|
1354
|
-
L:
|
|
1505
|
+
F: __dxlog_file7,
|
|
1506
|
+
L: 267,
|
|
1355
1507
|
S: this,
|
|
1356
1508
|
C: (f, a) => f(...a)
|
|
1357
1509
|
});
|
|
@@ -1361,8 +1513,8 @@ var InvitationsHandler = class {
|
|
|
1361
1513
|
(0, import_log5.log)("introduce", {
|
|
1362
1514
|
...protocol.toJSON()
|
|
1363
1515
|
}, {
|
|
1364
|
-
F:
|
|
1365
|
-
L:
|
|
1516
|
+
F: __dxlog_file7,
|
|
1517
|
+
L: 271,
|
|
1366
1518
|
S: this,
|
|
1367
1519
|
C: (f, a) => f(...a)
|
|
1368
1520
|
});
|
|
@@ -1371,8 +1523,8 @@ var InvitationsHandler = class {
|
|
|
1371
1523
|
...protocol.toJSON(),
|
|
1372
1524
|
response: introductionResponse
|
|
1373
1525
|
}, {
|
|
1374
|
-
F:
|
|
1375
|
-
L:
|
|
1526
|
+
F: __dxlog_file7,
|
|
1527
|
+
L: 275,
|
|
1376
1528
|
S: this,
|
|
1377
1529
|
C: (f, a) => f(...a)
|
|
1378
1530
|
});
|
|
@@ -1383,8 +1535,8 @@ var InvitationsHandler = class {
|
|
|
1383
1535
|
if (isAuthenticationRequired(invitation)) {
|
|
1384
1536
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1385
1537
|
(0, import_log5.log)("guest waiting for authentication code...", void 0, {
|
|
1386
|
-
F:
|
|
1387
|
-
L:
|
|
1538
|
+
F: __dxlog_file7,
|
|
1539
|
+
L: 284,
|
|
1388
1540
|
S: this,
|
|
1389
1541
|
C: (f, a) => f(...a)
|
|
1390
1542
|
});
|
|
@@ -1395,8 +1547,8 @@ var InvitationsHandler = class {
|
|
|
1395
1547
|
timeout
|
|
1396
1548
|
});
|
|
1397
1549
|
(0, import_log5.log)("sending authentication request", void 0, {
|
|
1398
|
-
F:
|
|
1399
|
-
L:
|
|
1550
|
+
F: __dxlog_file7,
|
|
1551
|
+
L: 288,
|
|
1400
1552
|
S: this,
|
|
1401
1553
|
C: (f, a) => f(...a)
|
|
1402
1554
|
});
|
|
@@ -1416,8 +1568,8 @@ var InvitationsHandler = class {
|
|
|
1416
1568
|
(0, import_log5.log)("retrying invalid code", {
|
|
1417
1569
|
attempt
|
|
1418
1570
|
}, {
|
|
1419
|
-
F:
|
|
1420
|
-
L:
|
|
1571
|
+
F: __dxlog_file7,
|
|
1572
|
+
L: 299,
|
|
1421
1573
|
S: this,
|
|
1422
1574
|
C: (f, a) => f(...a)
|
|
1423
1575
|
});
|
|
@@ -1433,8 +1585,8 @@ var InvitationsHandler = class {
|
|
|
1433
1585
|
(0, import_log5.log)("request admission", {
|
|
1434
1586
|
...protocol.toJSON()
|
|
1435
1587
|
}, {
|
|
1436
|
-
F:
|
|
1437
|
-
L:
|
|
1588
|
+
F: __dxlog_file7,
|
|
1589
|
+
L: 310,
|
|
1438
1590
|
S: this,
|
|
1439
1591
|
C: (f, a) => f(...a)
|
|
1440
1592
|
});
|
|
@@ -1445,8 +1597,8 @@ var InvitationsHandler = class {
|
|
|
1445
1597
|
(0, import_log5.log)("admitted by host", {
|
|
1446
1598
|
...protocol.toJSON()
|
|
1447
1599
|
}, {
|
|
1448
|
-
F:
|
|
1449
|
-
L:
|
|
1600
|
+
F: __dxlog_file7,
|
|
1601
|
+
L: 321,
|
|
1450
1602
|
S: this,
|
|
1451
1603
|
C: (f, a) => f(...a)
|
|
1452
1604
|
});
|
|
@@ -1457,8 +1609,8 @@ var InvitationsHandler = class {
|
|
|
1457
1609
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
1458
1610
|
id: traceId
|
|
1459
1611
|
}), {
|
|
1460
|
-
F:
|
|
1461
|
-
L:
|
|
1612
|
+
F: __dxlog_file7,
|
|
1613
|
+
L: 323,
|
|
1462
1614
|
S: this,
|
|
1463
1615
|
C: (f, a) => f(...a)
|
|
1464
1616
|
});
|
|
@@ -1467,8 +1619,8 @@ var InvitationsHandler = class {
|
|
|
1467
1619
|
(0, import_log5.log)("timeout", {
|
|
1468
1620
|
...protocol.toJSON()
|
|
1469
1621
|
}, {
|
|
1470
|
-
F:
|
|
1471
|
-
L:
|
|
1622
|
+
F: __dxlog_file7,
|
|
1623
|
+
L: 326,
|
|
1472
1624
|
S: this,
|
|
1473
1625
|
C: (f, a) => f(...a)
|
|
1474
1626
|
});
|
|
@@ -1477,8 +1629,8 @@ var InvitationsHandler = class {
|
|
|
1477
1629
|
});
|
|
1478
1630
|
} else {
|
|
1479
1631
|
(0, import_log5.log)("auth failed", err, {
|
|
1480
|
-
F:
|
|
1481
|
-
L:
|
|
1632
|
+
F: __dxlog_file7,
|
|
1633
|
+
L: 329,
|
|
1482
1634
|
S: this,
|
|
1483
1635
|
C: (f, a) => f(...a)
|
|
1484
1636
|
});
|
|
@@ -1488,8 +1640,8 @@ var InvitationsHandler = class {
|
|
|
1488
1640
|
id: traceId,
|
|
1489
1641
|
error: err
|
|
1490
1642
|
}), {
|
|
1491
|
-
F:
|
|
1492
|
-
L:
|
|
1643
|
+
F: __dxlog_file7,
|
|
1644
|
+
L: 332,
|
|
1493
1645
|
S: this,
|
|
1494
1646
|
C: (f, a) => f(...a)
|
|
1495
1647
|
});
|
|
@@ -1506,8 +1658,8 @@ var InvitationsHandler = class {
|
|
|
1506
1658
|
(0, import_log5.log)("timeout", {
|
|
1507
1659
|
...protocol.toJSON()
|
|
1508
1660
|
}, {
|
|
1509
|
-
F:
|
|
1510
|
-
L:
|
|
1661
|
+
F: __dxlog_file7,
|
|
1662
|
+
L: 343,
|
|
1511
1663
|
S: this,
|
|
1512
1664
|
C: (f, a) => f(...a)
|
|
1513
1665
|
});
|
|
@@ -1516,8 +1668,8 @@ var InvitationsHandler = class {
|
|
|
1516
1668
|
});
|
|
1517
1669
|
} else {
|
|
1518
1670
|
(0, import_log5.log)("auth failed", err, {
|
|
1519
|
-
F:
|
|
1520
|
-
L:
|
|
1671
|
+
F: __dxlog_file7,
|
|
1672
|
+
L: 346,
|
|
1521
1673
|
S: this,
|
|
1522
1674
|
C: (f, a) => f(...a)
|
|
1523
1675
|
});
|
|
@@ -1528,7 +1680,15 @@ var InvitationsHandler = class {
|
|
|
1528
1680
|
return extension;
|
|
1529
1681
|
};
|
|
1530
1682
|
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1531
|
-
(0,
|
|
1683
|
+
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
1684
|
+
F: __dxlog_file7,
|
|
1685
|
+
L: 356,
|
|
1686
|
+
S: this,
|
|
1687
|
+
A: [
|
|
1688
|
+
"invitation.swarmKey",
|
|
1689
|
+
""
|
|
1690
|
+
]
|
|
1691
|
+
});
|
|
1532
1692
|
const topic = invitation.swarmKey;
|
|
1533
1693
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
1534
1694
|
topic,
|
|
@@ -1561,12 +1721,12 @@ var InvitationsHandler = class {
|
|
|
1561
1721
|
};
|
|
1562
1722
|
|
|
1563
1723
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
1564
|
-
var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
|
|
1565
1724
|
var import_async6 = require("@dxos/async");
|
|
1566
1725
|
var import_codec_protobuf3 = require("@dxos/codec-protobuf");
|
|
1726
|
+
var import_invariant7 = require("@dxos/invariant");
|
|
1567
1727
|
var import_log6 = require("@dxos/log");
|
|
1568
1728
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
1569
|
-
var
|
|
1729
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
1570
1730
|
var InvitationsServiceImpl = class {
|
|
1571
1731
|
constructor(_invitationsHandler, _getHandler) {
|
|
1572
1732
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -1628,19 +1788,27 @@ var InvitationsServiceImpl = class {
|
|
|
1628
1788
|
}
|
|
1629
1789
|
async authenticate({ invitationId, authCode }) {
|
|
1630
1790
|
(0, import_log6.log)("authenticating...", void 0, {
|
|
1631
|
-
F:
|
|
1632
|
-
L:
|
|
1791
|
+
F: __dxlog_file8,
|
|
1792
|
+
L: 102,
|
|
1633
1793
|
S: this,
|
|
1634
1794
|
C: (f, a) => f(...a)
|
|
1635
1795
|
});
|
|
1636
|
-
(0,
|
|
1796
|
+
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
1797
|
+
F: __dxlog_file8,
|
|
1798
|
+
L: 103,
|
|
1799
|
+
S: this,
|
|
1800
|
+
A: [
|
|
1801
|
+
"invitationId",
|
|
1802
|
+
""
|
|
1803
|
+
]
|
|
1804
|
+
});
|
|
1637
1805
|
const observable = this._acceptInvitations.get(invitationId);
|
|
1638
1806
|
if (!observable) {
|
|
1639
1807
|
import_log6.log.warn("invalid invitation", {
|
|
1640
1808
|
invitationId
|
|
1641
1809
|
}, {
|
|
1642
|
-
F:
|
|
1643
|
-
L:
|
|
1810
|
+
F: __dxlog_file8,
|
|
1811
|
+
L: 106,
|
|
1644
1812
|
S: this,
|
|
1645
1813
|
C: (f, a) => f(...a)
|
|
1646
1814
|
});
|
|
@@ -1650,12 +1818,20 @@ var InvitationsServiceImpl = class {
|
|
|
1650
1818
|
}
|
|
1651
1819
|
async cancelInvitation({ invitationId }) {
|
|
1652
1820
|
(0, import_log6.log)("deleting...", void 0, {
|
|
1653
|
-
F:
|
|
1654
|
-
L:
|
|
1821
|
+
F: __dxlog_file8,
|
|
1822
|
+
L: 113,
|
|
1655
1823
|
S: this,
|
|
1656
1824
|
C: (f, a) => f(...a)
|
|
1657
1825
|
});
|
|
1658
|
-
(0,
|
|
1826
|
+
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
1827
|
+
F: __dxlog_file8,
|
|
1828
|
+
L: 114,
|
|
1829
|
+
S: this,
|
|
1830
|
+
A: [
|
|
1831
|
+
"invitationId",
|
|
1832
|
+
""
|
|
1833
|
+
]
|
|
1834
|
+
});
|
|
1659
1835
|
const created = this._createInvitations.get(invitationId);
|
|
1660
1836
|
const accepted = this._acceptInvitations.get(invitationId);
|
|
1661
1837
|
if (created) {
|
|
@@ -1670,8 +1846,8 @@ var InvitationsServiceImpl = class {
|
|
|
1670
1846
|
import_log6.log.warn("invalid invitation", {
|
|
1671
1847
|
invitationId
|
|
1672
1848
|
}, {
|
|
1673
|
-
F:
|
|
1674
|
-
L:
|
|
1849
|
+
F: __dxlog_file8,
|
|
1850
|
+
L: 126,
|
|
1675
1851
|
S: this,
|
|
1676
1852
|
C: (f, a) => f(...a)
|
|
1677
1853
|
});
|
|
@@ -1730,12 +1906,12 @@ var InvitationsServiceImpl = class {
|
|
|
1730
1906
|
};
|
|
1731
1907
|
|
|
1732
1908
|
// packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
|
|
1733
|
-
var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
|
|
1734
1909
|
var import_credentials9 = require("@dxos/credentials");
|
|
1735
1910
|
var import_feed_store2 = require("@dxos/feed-store");
|
|
1911
|
+
var import_invariant8 = require("@dxos/invariant");
|
|
1736
1912
|
var import_log7 = require("@dxos/log");
|
|
1737
1913
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
1738
|
-
var
|
|
1914
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
1739
1915
|
var SpaceInvitationProtocol = class {
|
|
1740
1916
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
1741
1917
|
this._spaceManager = _spaceManager;
|
|
@@ -1757,24 +1933,64 @@ var SpaceInvitationProtocol = class {
|
|
|
1757
1933
|
}
|
|
1758
1934
|
async admit(request, guestProfile) {
|
|
1759
1935
|
var _a;
|
|
1760
|
-
(0,
|
|
1936
|
+
(0, import_invariant8.invariant)(this._spaceKey, void 0, {
|
|
1937
|
+
F: __dxlog_file9,
|
|
1938
|
+
L: 42,
|
|
1939
|
+
S: this,
|
|
1940
|
+
A: [
|
|
1941
|
+
"this._spaceKey",
|
|
1942
|
+
""
|
|
1943
|
+
]
|
|
1944
|
+
});
|
|
1761
1945
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
1762
|
-
(0,
|
|
1763
|
-
|
|
1946
|
+
(0, import_invariant8.invariant)(space, void 0, {
|
|
1947
|
+
F: __dxlog_file9,
|
|
1948
|
+
L: 44,
|
|
1949
|
+
S: this,
|
|
1950
|
+
A: [
|
|
1951
|
+
"space",
|
|
1952
|
+
""
|
|
1953
|
+
]
|
|
1954
|
+
});
|
|
1955
|
+
(0, import_invariant8.invariant)(request.space, void 0, {
|
|
1956
|
+
F: __dxlog_file9,
|
|
1957
|
+
L: 46,
|
|
1958
|
+
S: this,
|
|
1959
|
+
A: [
|
|
1960
|
+
"request.space",
|
|
1961
|
+
""
|
|
1962
|
+
]
|
|
1963
|
+
});
|
|
1764
1964
|
const { identityKey, deviceKey } = request.space;
|
|
1765
1965
|
(0, import_log7.log)("writing guest credentials", {
|
|
1766
1966
|
host: this._signingContext.deviceKey,
|
|
1767
1967
|
guest: deviceKey
|
|
1768
1968
|
}, {
|
|
1769
|
-
F:
|
|
1770
|
-
L:
|
|
1969
|
+
F: __dxlog_file9,
|
|
1970
|
+
L: 49,
|
|
1771
1971
|
S: this,
|
|
1772
1972
|
C: (f, a) => f(...a)
|
|
1773
1973
|
});
|
|
1774
1974
|
const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
1775
|
-
(0,
|
|
1975
|
+
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
1976
|
+
F: __dxlog_file9,
|
|
1977
|
+
L: 60,
|
|
1978
|
+
S: this,
|
|
1979
|
+
A: [
|
|
1980
|
+
"credentials[0].credential",
|
|
1981
|
+
""
|
|
1982
|
+
]
|
|
1983
|
+
});
|
|
1776
1984
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
1777
|
-
(0,
|
|
1985
|
+
(0, import_invariant8.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
1986
|
+
F: __dxlog_file9,
|
|
1987
|
+
L: 62,
|
|
1988
|
+
S: this,
|
|
1989
|
+
A: [
|
|
1990
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
1991
|
+
""
|
|
1992
|
+
]
|
|
1993
|
+
});
|
|
1778
1994
|
await (0, import_feed_store2.writeMessages)(space.inner.controlPipeline.writer, credentials);
|
|
1779
1995
|
return {
|
|
1780
1996
|
space: {
|
|
@@ -1802,11 +2018,35 @@ var SpaceInvitationProtocol = class {
|
|
|
1802
2018
|
};
|
|
1803
2019
|
}
|
|
1804
2020
|
async accept(response) {
|
|
1805
|
-
(0,
|
|
2021
|
+
(0, import_invariant8.invariant)(response.space, void 0, {
|
|
2022
|
+
F: __dxlog_file9,
|
|
2023
|
+
L: 97,
|
|
2024
|
+
S: this,
|
|
2025
|
+
A: [
|
|
2026
|
+
"response.space",
|
|
2027
|
+
""
|
|
2028
|
+
]
|
|
2029
|
+
});
|
|
1806
2030
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
1807
2031
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
1808
|
-
(0,
|
|
1809
|
-
|
|
2032
|
+
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2033
|
+
F: __dxlog_file9,
|
|
2034
|
+
L: 100,
|
|
2035
|
+
S: this,
|
|
2036
|
+
A: [
|
|
2037
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
2038
|
+
"'Invalid credential'"
|
|
2039
|
+
]
|
|
2040
|
+
});
|
|
2041
|
+
(0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2042
|
+
F: __dxlog_file9,
|
|
2043
|
+
L: 101,
|
|
2044
|
+
S: this,
|
|
2045
|
+
A: [
|
|
2046
|
+
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
2047
|
+
""
|
|
2048
|
+
]
|
|
2049
|
+
});
|
|
1810
2050
|
await this._spaceManager.acceptSpace({
|
|
1811
2051
|
spaceKey: assertion.spaceKey,
|
|
1812
2052
|
genesisFeedKey: assertion.genesisFeedKey,
|
|
@@ -1821,10 +2061,10 @@ var SpaceInvitationProtocol = class {
|
|
|
1821
2061
|
};
|
|
1822
2062
|
|
|
1823
2063
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
1824
|
-
var import_tiny_invariant10 = __toESM(require("tiny-invariant"));
|
|
1825
2064
|
var import_async9 = require("@dxos/async");
|
|
1826
2065
|
var import_context6 = require("@dxos/context");
|
|
1827
2066
|
var import_credentials13 = require("@dxos/credentials");
|
|
2067
|
+
var import_invariant10 = require("@dxos/invariant");
|
|
1828
2068
|
var import_keys7 = require("@dxos/keys");
|
|
1829
2069
|
var import_log10 = require("@dxos/log");
|
|
1830
2070
|
var import_protocols6 = require("@dxos/protocols");
|
|
@@ -1847,15 +2087,15 @@ var import_timeframe = require("@dxos/timeframe");
|
|
|
1847
2087
|
var import_util3 = require("@dxos/util");
|
|
1848
2088
|
|
|
1849
2089
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
1850
|
-
var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
|
|
1851
2090
|
var import_async7 = require("@dxos/async");
|
|
1852
2091
|
var import_context4 = require("@dxos/context");
|
|
2092
|
+
var import_invariant9 = require("@dxos/invariant");
|
|
1853
2093
|
var import_keys5 = require("@dxos/keys");
|
|
1854
2094
|
var import_log8 = require("@dxos/log");
|
|
1855
2095
|
var import_protocols5 = require("@dxos/protocols");
|
|
1856
2096
|
var import_teleport2 = require("@dxos/teleport");
|
|
1857
2097
|
var import_util2 = require("@dxos/util");
|
|
1858
|
-
var
|
|
2098
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
1859
2099
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
1860
2100
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
1861
2101
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -1883,20 +2123,28 @@ var NotarizationPlugin = class {
|
|
|
1883
2123
|
(0, import_log8.log)("notarize", {
|
|
1884
2124
|
credentials
|
|
1885
2125
|
}, {
|
|
1886
|
-
F:
|
|
1887
|
-
L:
|
|
2126
|
+
F: __dxlog_file10,
|
|
2127
|
+
L: 90,
|
|
1888
2128
|
S: this,
|
|
1889
2129
|
C: (f, a) => f(...a)
|
|
1890
2130
|
});
|
|
1891
|
-
(0,
|
|
2131
|
+
(0, import_invariant9.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
2132
|
+
F: __dxlog_file10,
|
|
2133
|
+
L: 91,
|
|
2134
|
+
S: this,
|
|
2135
|
+
A: [
|
|
2136
|
+
"credentials.every((credential) => credential.id)",
|
|
2137
|
+
"'Credentials must have an id'"
|
|
2138
|
+
]
|
|
2139
|
+
});
|
|
1892
2140
|
const errors = new import_async7.Trigger();
|
|
1893
2141
|
const ctx = this._ctx.derive({
|
|
1894
2142
|
onError: (err) => {
|
|
1895
2143
|
import_log8.log.warn("Notarization error", {
|
|
1896
2144
|
err
|
|
1897
2145
|
}, {
|
|
1898
|
-
F:
|
|
1899
|
-
L:
|
|
2146
|
+
F: __dxlog_file10,
|
|
2147
|
+
L: 99,
|
|
1900
2148
|
S: this,
|
|
1901
2149
|
C: (f, a) => f(...a)
|
|
1902
2150
|
});
|
|
@@ -1911,8 +2159,8 @@ var NotarizationPlugin = class {
|
|
|
1911
2159
|
timeout,
|
|
1912
2160
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1913
2161
|
}, {
|
|
1914
|
-
F:
|
|
1915
|
-
L:
|
|
2162
|
+
F: __dxlog_file10,
|
|
2163
|
+
L: 111,
|
|
1916
2164
|
S: this,
|
|
1917
2165
|
C: (f, a) => f(...a)
|
|
1918
2166
|
});
|
|
@@ -1934,8 +2182,8 @@ var NotarizationPlugin = class {
|
|
|
1934
2182
|
import_log8.log.warn("Exhausted all peers to notarize with", {
|
|
1935
2183
|
retryIn: retryTimeout
|
|
1936
2184
|
}, {
|
|
1937
|
-
F:
|
|
1938
|
-
L:
|
|
2185
|
+
F: __dxlog_file10,
|
|
2186
|
+
L: 136,
|
|
1939
2187
|
S: this,
|
|
1940
2188
|
C: (f, a) => f(...a)
|
|
1941
2189
|
});
|
|
@@ -1948,8 +2196,8 @@ var NotarizationPlugin = class {
|
|
|
1948
2196
|
peer: peer.localPeerId,
|
|
1949
2197
|
credentialId: credentials.map((credential) => credential.id)
|
|
1950
2198
|
}, {
|
|
1951
|
-
F:
|
|
1952
|
-
L:
|
|
2199
|
+
F: __dxlog_file10,
|
|
2200
|
+
L: 143,
|
|
1953
2201
|
S: this,
|
|
1954
2202
|
C: (f, a) => f(...a)
|
|
1955
2203
|
});
|
|
@@ -1957,8 +2205,8 @@ var NotarizationPlugin = class {
|
|
|
1957
2205
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
1958
2206
|
});
|
|
1959
2207
|
(0, import_log8.log)("success", void 0, {
|
|
1960
|
-
F:
|
|
1961
|
-
L:
|
|
2208
|
+
F: __dxlog_file10,
|
|
2209
|
+
L: 147,
|
|
1962
2210
|
S: this,
|
|
1963
2211
|
C: (f, a) => f(...a)
|
|
1964
2212
|
});
|
|
@@ -1966,8 +2214,8 @@ var NotarizationPlugin = class {
|
|
|
1966
2214
|
} catch (err) {
|
|
1967
2215
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
1968
2216
|
import_log8.log.warn("error notarizing (recoverable)", err, {
|
|
1969
|
-
F:
|
|
1970
|
-
L:
|
|
2217
|
+
F: __dxlog_file10,
|
|
2218
|
+
L: 151,
|
|
1971
2219
|
S: this,
|
|
1972
2220
|
C: (f, a) => f(...a)
|
|
1973
2221
|
});
|
|
@@ -1984,8 +2232,8 @@ var NotarizationPlugin = class {
|
|
|
1984
2232
|
errors.wait()
|
|
1985
2233
|
]);
|
|
1986
2234
|
(0, import_log8.log)("done", void 0, {
|
|
1987
|
-
F:
|
|
1988
|
-
L:
|
|
2235
|
+
F: __dxlog_file10,
|
|
2236
|
+
L: 162,
|
|
1989
2237
|
S: this,
|
|
1990
2238
|
C: (f, a) => f(...a)
|
|
1991
2239
|
});
|
|
@@ -2006,7 +2254,15 @@ var NotarizationPlugin = class {
|
|
|
2006
2254
|
this._processCredentialsTriggers.delete(credential.id);
|
|
2007
2255
|
}
|
|
2008
2256
|
setWriter(writer) {
|
|
2009
|
-
(0,
|
|
2257
|
+
(0, import_invariant9.invariant)(!this._writer, "Writer already set.", {
|
|
2258
|
+
F: __dxlog_file10,
|
|
2259
|
+
L: 181,
|
|
2260
|
+
S: this,
|
|
2261
|
+
A: [
|
|
2262
|
+
"!this._writer",
|
|
2263
|
+
"'Writer already set.'"
|
|
2264
|
+
]
|
|
2265
|
+
});
|
|
2010
2266
|
this._writer = writer;
|
|
2011
2267
|
}
|
|
2012
2268
|
async _waitUntilProcessed(id) {
|
|
@@ -2024,7 +2280,15 @@ var NotarizationPlugin = class {
|
|
|
2024
2280
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
2025
2281
|
}
|
|
2026
2282
|
for (const credential of (_a = request.credentials) != null ? _a : []) {
|
|
2027
|
-
(0,
|
|
2283
|
+
(0, import_invariant9.invariant)(credential.id, "Credential must have an id", {
|
|
2284
|
+
F: __dxlog_file10,
|
|
2285
|
+
L: 200,
|
|
2286
|
+
S: this,
|
|
2287
|
+
A: [
|
|
2288
|
+
"credential.id",
|
|
2289
|
+
"'Credential must have an id'"
|
|
2290
|
+
]
|
|
2291
|
+
});
|
|
2028
2292
|
if (this._processedCredentials.has(credential.id)) {
|
|
2029
2293
|
continue;
|
|
2030
2294
|
}
|
|
@@ -2037,8 +2301,8 @@ var NotarizationPlugin = class {
|
|
|
2037
2301
|
(0, import_log8.log)("extension opened", {
|
|
2038
2302
|
peer: extension.localPeerId
|
|
2039
2303
|
}, {
|
|
2040
|
-
F:
|
|
2041
|
-
L:
|
|
2304
|
+
F: __dxlog_file10,
|
|
2305
|
+
L: 211,
|
|
2042
2306
|
S: this,
|
|
2043
2307
|
C: (f, a) => f(...a)
|
|
2044
2308
|
});
|
|
@@ -2049,8 +2313,8 @@ var NotarizationPlugin = class {
|
|
|
2049
2313
|
(0, import_log8.log)("extension closed", {
|
|
2050
2314
|
peer: extension.localPeerId
|
|
2051
2315
|
}, {
|
|
2052
|
-
F:
|
|
2053
|
-
L:
|
|
2316
|
+
F: __dxlog_file10,
|
|
2317
|
+
L: 216,
|
|
2054
2318
|
S: this,
|
|
2055
2319
|
C: (f, a) => f(...a)
|
|
2056
2320
|
});
|
|
@@ -2103,7 +2367,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
2103
2367
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2104
2368
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2105
2369
|
}
|
|
2106
|
-
var
|
|
2370
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
2107
2371
|
var DataSpace = class DataSpace2 {
|
|
2108
2372
|
constructor(params) {
|
|
2109
2373
|
this._ctx = new import_context5.Context();
|
|
@@ -2202,7 +2466,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2202
2466
|
} catch (err) {
|
|
2203
2467
|
if (err instanceof import_errors3.CancelledError) {
|
|
2204
2468
|
(0, import_log9.log)("data pipeline initialization cancelled", err, {
|
|
2205
|
-
F:
|
|
2469
|
+
F: __dxlog_file11,
|
|
2206
2470
|
L: 193,
|
|
2207
2471
|
S: this,
|
|
2208
2472
|
C: (f, a) => f(...a)
|
|
@@ -2210,7 +2474,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2210
2474
|
return;
|
|
2211
2475
|
}
|
|
2212
2476
|
import_log9.log.error("Error initializing data pipeline", err, {
|
|
2213
|
-
F:
|
|
2477
|
+
F: __dxlog_file11,
|
|
2214
2478
|
L: 197,
|
|
2215
2479
|
S: this,
|
|
2216
2480
|
C: (f, a) => f(...a)
|
|
@@ -2236,7 +2500,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2236
2500
|
this.metrics.controlPipelineReady = new Date();
|
|
2237
2501
|
await this._createWritableFeeds();
|
|
2238
2502
|
(0, import_log9.log)("writable feeds created", void 0, {
|
|
2239
|
-
F:
|
|
2503
|
+
F: __dxlog_file11,
|
|
2240
2504
|
L: 221,
|
|
2241
2505
|
S: this,
|
|
2242
2506
|
C: (f, a) => f(...a)
|
|
@@ -2253,7 +2517,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2253
2517
|
this.metrics.dataPipelineOpen = new Date();
|
|
2254
2518
|
await (0, import_context5.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
2255
2519
|
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
2256
|
-
F:
|
|
2520
|
+
F: __dxlog_file11,
|
|
2257
2521
|
L: 242,
|
|
2258
2522
|
S: this,
|
|
2259
2523
|
C: (f, a) => f(...a)
|
|
@@ -2264,7 +2528,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2264
2528
|
});
|
|
2265
2529
|
this.metrics.dataPipelineReady = new Date();
|
|
2266
2530
|
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
2267
|
-
F:
|
|
2531
|
+
F: __dxlog_file11,
|
|
2268
2532
|
L: 251,
|
|
2269
2533
|
S: this,
|
|
2270
2534
|
C: (f, a) => f(...a)
|
|
@@ -2463,7 +2727,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
2463
2727
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2464
2728
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2465
2729
|
}
|
|
2466
|
-
var
|
|
2730
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
2467
2731
|
var DataSpaceManager = class DataSpaceManager2 {
|
|
2468
2732
|
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
|
|
2469
2733
|
this._spaceManager = _spaceManager;
|
|
@@ -2484,16 +2748,16 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2484
2748
|
}
|
|
2485
2749
|
async open() {
|
|
2486
2750
|
(0, import_log10.log)("open", void 0, {
|
|
2487
|
-
F:
|
|
2488
|
-
L:
|
|
2751
|
+
F: __dxlog_file12,
|
|
2752
|
+
L: 79,
|
|
2489
2753
|
S: this,
|
|
2490
2754
|
C: (f, a) => f(...a)
|
|
2491
2755
|
});
|
|
2492
2756
|
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.begin({
|
|
2493
2757
|
id: this._instanceId
|
|
2494
2758
|
}), {
|
|
2495
|
-
F:
|
|
2496
|
-
L:
|
|
2759
|
+
F: __dxlog_file12,
|
|
2760
|
+
L: 80,
|
|
2497
2761
|
S: this,
|
|
2498
2762
|
C: (f, a) => f(...a)
|
|
2499
2763
|
});
|
|
@@ -2501,8 +2765,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2501
2765
|
(0, import_log10.log)("metadata loaded", {
|
|
2502
2766
|
spaces: this._metadataStore.spaces.length
|
|
2503
2767
|
}, {
|
|
2504
|
-
F:
|
|
2505
|
-
L:
|
|
2768
|
+
F: __dxlog_file12,
|
|
2769
|
+
L: 82,
|
|
2506
2770
|
S: this,
|
|
2507
2771
|
C: (f, a) => f(...a)
|
|
2508
2772
|
});
|
|
@@ -2511,8 +2775,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2511
2775
|
(0, import_log10.log)("load space", {
|
|
2512
2776
|
spaceMetadata
|
|
2513
2777
|
}, {
|
|
2514
|
-
F:
|
|
2515
|
-
L:
|
|
2778
|
+
F: __dxlog_file12,
|
|
2779
|
+
L: 86,
|
|
2516
2780
|
S: this,
|
|
2517
2781
|
C: (f, a) => f(...a)
|
|
2518
2782
|
});
|
|
@@ -2525,8 +2789,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2525
2789
|
spaceMetadata,
|
|
2526
2790
|
err
|
|
2527
2791
|
}, {
|
|
2528
|
-
F:
|
|
2529
|
-
L:
|
|
2792
|
+
F: __dxlog_file12,
|
|
2793
|
+
L: 92,
|
|
2530
2794
|
S: this,
|
|
2531
2795
|
C: (f, a) => f(...a)
|
|
2532
2796
|
});
|
|
@@ -2537,16 +2801,16 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2537
2801
|
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.end({
|
|
2538
2802
|
id: this._instanceId
|
|
2539
2803
|
}), {
|
|
2540
|
-
F:
|
|
2541
|
-
L:
|
|
2804
|
+
F: __dxlog_file12,
|
|
2805
|
+
L: 98,
|
|
2542
2806
|
S: this,
|
|
2543
2807
|
C: (f, a) => f(...a)
|
|
2544
2808
|
});
|
|
2545
2809
|
}
|
|
2546
2810
|
async close() {
|
|
2547
2811
|
(0, import_log10.log)("close", void 0, {
|
|
2548
|
-
F:
|
|
2549
|
-
L:
|
|
2812
|
+
F: __dxlog_file12,
|
|
2813
|
+
L: 103,
|
|
2550
2814
|
S: this,
|
|
2551
2815
|
C: (f, a) => f(...a)
|
|
2552
2816
|
});
|
|
@@ -2560,7 +2824,15 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2560
2824
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
2561
2825
|
*/
|
|
2562
2826
|
async createSpace() {
|
|
2563
|
-
(0,
|
|
2827
|
+
(0, import_invariant10.invariant)(this._isOpen, "Not open.", {
|
|
2828
|
+
F: __dxlog_file12,
|
|
2829
|
+
L: 116,
|
|
2830
|
+
S: this,
|
|
2831
|
+
A: [
|
|
2832
|
+
"this._isOpen",
|
|
2833
|
+
"'Not open.'"
|
|
2834
|
+
]
|
|
2835
|
+
});
|
|
2564
2836
|
const spaceKey = await this._keyring.createKey();
|
|
2565
2837
|
const controlFeedKey = await this._keyring.createKey();
|
|
2566
2838
|
const dataFeedKey = await this._keyring.createKey();
|
|
@@ -2574,8 +2846,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2574
2846
|
(0, import_log10.log)("creating space...", {
|
|
2575
2847
|
spaceKey
|
|
2576
2848
|
}, {
|
|
2577
|
-
F:
|
|
2578
|
-
L:
|
|
2849
|
+
F: __dxlog_file12,
|
|
2850
|
+
L: 128,
|
|
2579
2851
|
S: this,
|
|
2580
2852
|
C: (f, a) => f(...a)
|
|
2581
2853
|
});
|
|
@@ -2583,7 +2855,15 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2583
2855
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
|
|
2584
2856
|
await this._metadataStore.addSpace(metadata);
|
|
2585
2857
|
const memberCredential = credentials[1];
|
|
2586
|
-
(0,
|
|
2858
|
+
(0, import_invariant10.invariant)((0, import_credentials13.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2859
|
+
F: __dxlog_file12,
|
|
2860
|
+
L: 135,
|
|
2861
|
+
S: this,
|
|
2862
|
+
A: [
|
|
2863
|
+
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
2864
|
+
""
|
|
2865
|
+
]
|
|
2866
|
+
});
|
|
2587
2867
|
await this._signingContext.recordCredential(memberCredential);
|
|
2588
2868
|
await space.initializeDataPipeline();
|
|
2589
2869
|
this.updated.emit();
|
|
@@ -2594,13 +2874,29 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2594
2874
|
(0, import_log10.log)("accept space", {
|
|
2595
2875
|
opts
|
|
2596
2876
|
}, {
|
|
2597
|
-
F:
|
|
2598
|
-
L:
|
|
2877
|
+
F: __dxlog_file12,
|
|
2878
|
+
L: 147,
|
|
2599
2879
|
S: this,
|
|
2600
2880
|
C: (f, a) => f(...a)
|
|
2601
2881
|
});
|
|
2602
|
-
(0,
|
|
2603
|
-
|
|
2882
|
+
(0, import_invariant10.invariant)(this._isOpen, "Not open.", {
|
|
2883
|
+
F: __dxlog_file12,
|
|
2884
|
+
L: 148,
|
|
2885
|
+
S: this,
|
|
2886
|
+
A: [
|
|
2887
|
+
"this._isOpen",
|
|
2888
|
+
"'Not open.'"
|
|
2889
|
+
]
|
|
2890
|
+
});
|
|
2891
|
+
(0, import_invariant10.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
2892
|
+
F: __dxlog_file12,
|
|
2893
|
+
L: 149,
|
|
2894
|
+
S: this,
|
|
2895
|
+
A: [
|
|
2896
|
+
"!this._spaces.has(opts.spaceKey)",
|
|
2897
|
+
"'Space already exists.'"
|
|
2898
|
+
]
|
|
2899
|
+
});
|
|
2604
2900
|
const metadata = {
|
|
2605
2901
|
key: opts.spaceKey,
|
|
2606
2902
|
genesisFeedKey: opts.genesisFeedKey,
|
|
@@ -2628,8 +2924,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2628
2924
|
(0, import_log10.log)("construct space", {
|
|
2629
2925
|
metadata
|
|
2630
2926
|
}, {
|
|
2631
|
-
F:
|
|
2632
|
-
L:
|
|
2927
|
+
F: __dxlog_file12,
|
|
2928
|
+
L: 182,
|
|
2633
2929
|
S: this,
|
|
2634
2930
|
C: (f, a) => f(...a)
|
|
2635
2931
|
});
|
|
@@ -2637,7 +2933,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2637
2933
|
localPeerId: this._signingContext.deviceKey
|
|
2638
2934
|
});
|
|
2639
2935
|
const presence = new import_teleport_extension_gossip.Presence({
|
|
2640
|
-
announceInterval:
|
|
2936
|
+
announceInterval: 1e3,
|
|
2641
2937
|
offlineTimeout: 5e3,
|
|
2642
2938
|
identityKey: this._signingContext.identityKey,
|
|
2643
2939
|
gossip
|
|
@@ -2664,8 +2960,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2664
2960
|
},
|
|
2665
2961
|
onAuthFailure: () => {
|
|
2666
2962
|
import_log10.log.warn("auth failure", void 0, {
|
|
2667
|
-
F:
|
|
2668
|
-
L:
|
|
2963
|
+
F: __dxlog_file12,
|
|
2964
|
+
L: 213,
|
|
2669
2965
|
S: this,
|
|
2670
2966
|
C: (f, a) => f(...a)
|
|
2671
2967
|
});
|
|
@@ -2688,8 +2984,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2688
2984
|
(0, import_log10.log)("before space ready", {
|
|
2689
2985
|
space: space.key
|
|
2690
2986
|
}, {
|
|
2691
|
-
F:
|
|
2692
|
-
L:
|
|
2987
|
+
F: __dxlog_file12,
|
|
2988
|
+
L: 231,
|
|
2693
2989
|
S: this,
|
|
2694
2990
|
C: (f, a) => f(...a)
|
|
2695
2991
|
});
|
|
@@ -2700,8 +2996,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2700
2996
|
space: space.key,
|
|
2701
2997
|
open: this._isOpen
|
|
2702
2998
|
}, {
|
|
2703
|
-
F:
|
|
2704
|
-
L:
|
|
2999
|
+
F: __dxlog_file12,
|
|
3000
|
+
L: 238,
|
|
2705
3001
|
S: this,
|
|
2706
3002
|
C: (f, a) => f(...a)
|
|
2707
3003
|
});
|
|
@@ -2713,8 +3009,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2713
3009
|
(0, import_log10.log)("before space close", {
|
|
2714
3010
|
space: space.key
|
|
2715
3011
|
}, {
|
|
2716
|
-
F:
|
|
2717
|
-
L:
|
|
3012
|
+
F: __dxlog_file12,
|
|
3013
|
+
L: 244,
|
|
2718
3014
|
S: this,
|
|
2719
3015
|
C: (f, a) => f(...a)
|
|
2720
3016
|
});
|
|
@@ -2762,7 +3058,7 @@ var import_log11 = require("@dxos/log");
|
|
|
2762
3058
|
var import_protocols7 = require("@dxos/protocols");
|
|
2763
3059
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2764
3060
|
var import_util5 = require("@dxos/util");
|
|
2765
|
-
var
|
|
3061
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
2766
3062
|
var SpacesServiceImpl = class {
|
|
2767
3063
|
constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
|
|
2768
3064
|
this._identityManager = _identityManager;
|
|
@@ -2803,7 +3099,7 @@ var SpacesServiceImpl = class {
|
|
|
2803
3099
|
(0, import_log11.log)("update", {
|
|
2804
3100
|
spaces
|
|
2805
3101
|
}, {
|
|
2806
|
-
F:
|
|
3102
|
+
F: __dxlog_file13,
|
|
2807
3103
|
L: 78,
|
|
2808
3104
|
S: this,
|
|
2809
3105
|
C: (f, a) => f(...a)
|
|
@@ -2914,14 +3210,20 @@ var SpacesServiceImpl = class {
|
|
|
2914
3210
|
},
|
|
2915
3211
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
2916
3212
|
var _a2, _b2, _c2;
|
|
3213
|
+
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
3214
|
+
const isMe = (_a2 = this._identityManager.identity) == null ? void 0 : _a2.identityKey.equals(member.key);
|
|
3215
|
+
if (isMe) {
|
|
3216
|
+
peers.push(space.presence.getLocalState());
|
|
3217
|
+
}
|
|
2917
3218
|
return {
|
|
2918
3219
|
identity: {
|
|
2919
3220
|
identityKey: member.key,
|
|
2920
3221
|
profile: {
|
|
2921
|
-
displayName: (
|
|
3222
|
+
displayName: (_c2 = (_b2 = member.assertion.profile) == null ? void 0 : _b2.displayName) != null ? _c2 : (0, import_util5.humanize)(member.key)
|
|
2922
3223
|
}
|
|
2923
3224
|
},
|
|
2924
|
-
presence:
|
|
3225
|
+
presence: isMe || peers.length > 0 ? import_services8.SpaceMember.PresenceState.ONLINE : import_services8.SpaceMember.PresenceState.OFFLINE,
|
|
3226
|
+
peerStates: peers
|
|
2925
3227
|
};
|
|
2926
3228
|
}),
|
|
2927
3229
|
creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
|
|
@@ -2933,7 +3235,7 @@ var SpacesServiceImpl = class {
|
|
|
2933
3235
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
2934
3236
|
|
|
2935
3237
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
2936
|
-
var
|
|
3238
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
2937
3239
|
var ServiceContext = class {
|
|
2938
3240
|
// prettier-ignore
|
|
2939
3241
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
@@ -2977,15 +3279,15 @@ var ServiceContext = class {
|
|
|
2977
3279
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.begin({
|
|
2978
3280
|
id: this._instanceId
|
|
2979
3281
|
}), {
|
|
2980
|
-
F:
|
|
2981
|
-
L:
|
|
3282
|
+
F: __dxlog_file14,
|
|
3283
|
+
L: 125,
|
|
2982
3284
|
S: this,
|
|
2983
3285
|
C: (f, a) => f(...a)
|
|
2984
3286
|
});
|
|
2985
3287
|
await this._checkStorageVersion();
|
|
2986
3288
|
(0, import_log12.log)("opening...", void 0, {
|
|
2987
|
-
F:
|
|
2988
|
-
L:
|
|
3289
|
+
F: __dxlog_file14,
|
|
3290
|
+
L: 129,
|
|
2989
3291
|
S: this,
|
|
2990
3292
|
C: (f, a) => f(...a)
|
|
2991
3293
|
});
|
|
@@ -2997,16 +3299,16 @@ var ServiceContext = class {
|
|
|
2997
3299
|
await this._initialize();
|
|
2998
3300
|
}
|
|
2999
3301
|
(0, import_log12.log)("opened", void 0, {
|
|
3000
|
-
F:
|
|
3001
|
-
L:
|
|
3302
|
+
F: __dxlog_file14,
|
|
3303
|
+
L: 137,
|
|
3002
3304
|
S: this,
|
|
3003
3305
|
C: (f, a) => f(...a)
|
|
3004
3306
|
});
|
|
3005
3307
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.end({
|
|
3006
3308
|
id: this._instanceId
|
|
3007
3309
|
}), {
|
|
3008
|
-
F:
|
|
3009
|
-
L:
|
|
3310
|
+
F: __dxlog_file14,
|
|
3311
|
+
L: 138,
|
|
3010
3312
|
S: this,
|
|
3011
3313
|
C: (f, a) => f(...a)
|
|
3012
3314
|
});
|
|
@@ -3014,8 +3316,8 @@ var ServiceContext = class {
|
|
|
3014
3316
|
async close() {
|
|
3015
3317
|
var _a;
|
|
3016
3318
|
(0, import_log12.log)("closing...", void 0, {
|
|
3017
|
-
F:
|
|
3018
|
-
L:
|
|
3319
|
+
F: __dxlog_file14,
|
|
3320
|
+
L: 142,
|
|
3019
3321
|
S: this,
|
|
3020
3322
|
C: (f, a) => f(...a)
|
|
3021
3323
|
});
|
|
@@ -3030,8 +3332,8 @@ var ServiceContext = class {
|
|
|
3030
3332
|
await this.signalManager.close();
|
|
3031
3333
|
this.dataServiceSubscriptions.clear();
|
|
3032
3334
|
(0, import_log12.log)("closed", void 0, {
|
|
3033
|
-
F:
|
|
3034
|
-
L:
|
|
3335
|
+
F: __dxlog_file14,
|
|
3336
|
+
L: 153,
|
|
3035
3337
|
S: this,
|
|
3036
3338
|
C: (f, a) => f(...a)
|
|
3037
3339
|
});
|
|
@@ -3043,7 +3345,15 @@ var ServiceContext = class {
|
|
|
3043
3345
|
}
|
|
3044
3346
|
getInvitationHandler(invitation) {
|
|
3045
3347
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
3046
|
-
(0,
|
|
3348
|
+
(0, import_invariant11.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
3349
|
+
F: __dxlog_file14,
|
|
3350
|
+
L: 165,
|
|
3351
|
+
S: this,
|
|
3352
|
+
A: [
|
|
3353
|
+
"factory",
|
|
3354
|
+
"`Unknown invitation kind: ${invitation.kind}`"
|
|
3355
|
+
]
|
|
3356
|
+
});
|
|
3047
3357
|
return factory(invitation);
|
|
3048
3358
|
}
|
|
3049
3359
|
async _acceptIdentity(params) {
|
|
@@ -3061,8 +3371,8 @@ var ServiceContext = class {
|
|
|
3061
3371
|
async _initialize() {
|
|
3062
3372
|
var _a;
|
|
3063
3373
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
3064
|
-
F:
|
|
3065
|
-
L:
|
|
3374
|
+
F: __dxlog_file14,
|
|
3375
|
+
L: 186,
|
|
3066
3376
|
S: this,
|
|
3067
3377
|
C: (f, a) => f(...a)
|
|
3068
3378
|
});
|
|
@@ -3083,7 +3393,15 @@ var ServiceContext = class {
|
|
|
3083
3393
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
3084
3394
|
await this.dataSpaceManager.open();
|
|
3085
3395
|
this._handlerFactories.set(import_services9.Invitation.Kind.SPACE, (invitation) => {
|
|
3086
|
-
(0,
|
|
3396
|
+
(0, import_invariant11.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
3397
|
+
F: __dxlog_file14,
|
|
3398
|
+
L: 209,
|
|
3399
|
+
S: this,
|
|
3400
|
+
A: [
|
|
3401
|
+
"this.dataSpaceManager",
|
|
3402
|
+
"'dataSpaceManager not initialized yet'"
|
|
3403
|
+
]
|
|
3404
|
+
});
|
|
3087
3405
|
return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
|
|
3088
3406
|
});
|
|
3089
3407
|
this.initialized.wake();
|
|
@@ -3100,8 +3418,8 @@ var ServiceContext = class {
|
|
|
3100
3418
|
(0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
3101
3419
|
details: assertion
|
|
3102
3420
|
}, {
|
|
3103
|
-
F:
|
|
3104
|
-
L:
|
|
3421
|
+
F: __dxlog_file14,
|
|
3422
|
+
L: 225,
|
|
3105
3423
|
S: this,
|
|
3106
3424
|
C: (f, a) => f(...a)
|
|
3107
3425
|
});
|
|
@@ -3111,8 +3429,8 @@ var ServiceContext = class {
|
|
|
3111
3429
|
(0, import_log12.log)("space already exists, ignoring space admission", {
|
|
3112
3430
|
details: assertion
|
|
3113
3431
|
}, {
|
|
3114
|
-
F:
|
|
3115
|
-
L:
|
|
3432
|
+
F: __dxlog_file14,
|
|
3433
|
+
L: 229,
|
|
3116
3434
|
S: this,
|
|
3117
3435
|
C: (f, a) => f(...a)
|
|
3118
3436
|
});
|
|
@@ -3122,8 +3440,8 @@ var ServiceContext = class {
|
|
|
3122
3440
|
(0, import_log12.log)("accepting space recorded in halo", {
|
|
3123
3441
|
details: assertion
|
|
3124
3442
|
}, {
|
|
3125
|
-
F:
|
|
3126
|
-
L:
|
|
3443
|
+
F: __dxlog_file14,
|
|
3444
|
+
L: 234,
|
|
3127
3445
|
S: this,
|
|
3128
3446
|
C: (f, a) => f(...a)
|
|
3129
3447
|
});
|
|
@@ -3133,8 +3451,8 @@ var ServiceContext = class {
|
|
|
3133
3451
|
});
|
|
3134
3452
|
} catch (err) {
|
|
3135
3453
|
import_log12.log.catch(err, void 0, {
|
|
3136
|
-
F:
|
|
3137
|
-
L:
|
|
3454
|
+
F: __dxlog_file14,
|
|
3455
|
+
L: 240,
|
|
3138
3456
|
S: this,
|
|
3139
3457
|
C: (f, a) => f(...a)
|
|
3140
3458
|
});
|
|
@@ -3146,11 +3464,11 @@ var ServiceContext = class {
|
|
|
3146
3464
|
};
|
|
3147
3465
|
|
|
3148
3466
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3149
|
-
var import_tiny_invariant13 = __toESM(require("tiny-invariant"));
|
|
3150
3467
|
var import_async17 = require("@dxos/async");
|
|
3151
3468
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
3152
3469
|
var import_document_model = require("@dxos/document-model");
|
|
3153
3470
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
3471
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
3154
3472
|
var import_keys12 = require("@dxos/keys");
|
|
3155
3473
|
var import_log15 = require("@dxos/log");
|
|
3156
3474
|
var import_messaging = require("@dxos/messaging");
|
|
@@ -3521,7 +3839,7 @@ var DevtoolsServiceImpl = class {
|
|
|
3521
3839
|
};
|
|
3522
3840
|
|
|
3523
3841
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
3524
|
-
var
|
|
3842
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
3525
3843
|
var import_lock_file = require("@dxos/lock-file");
|
|
3526
3844
|
var import_log13 = require("@dxos/log");
|
|
3527
3845
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
@@ -3534,7 +3852,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
3534
3852
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3535
3853
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3536
3854
|
}
|
|
3537
|
-
var
|
|
3855
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
3538
3856
|
var Lock = class {
|
|
3539
3857
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
3540
3858
|
this._lockPath = lockPath;
|
|
@@ -3547,7 +3865,7 @@ var Lock = class {
|
|
|
3547
3865
|
async acquire() {
|
|
3548
3866
|
var _a;
|
|
3549
3867
|
(0, import_log13.log)("acquiring lock...", void 0, {
|
|
3550
|
-
F:
|
|
3868
|
+
F: __dxlog_file15,
|
|
3551
3869
|
L: 32,
|
|
3552
3870
|
S: this,
|
|
3553
3871
|
C: (f, a) => f(...a)
|
|
@@ -3555,7 +3873,7 @@ var Lock = class {
|
|
|
3555
3873
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
3556
3874
|
await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
|
|
3557
3875
|
(0, import_log13.log)("acquired lock", void 0, {
|
|
3558
|
-
F:
|
|
3876
|
+
F: __dxlog_file15,
|
|
3559
3877
|
L: 37,
|
|
3560
3878
|
S: this,
|
|
3561
3879
|
C: (f, a) => f(...a)
|
|
@@ -3564,7 +3882,15 @@ var Lock = class {
|
|
|
3564
3882
|
async release() {
|
|
3565
3883
|
var _a;
|
|
3566
3884
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3567
|
-
(0,
|
|
3885
|
+
(0, import_invariant12.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
3886
|
+
F: __dxlog_file15,
|
|
3887
|
+
L: 42,
|
|
3888
|
+
S: this,
|
|
3889
|
+
A: [
|
|
3890
|
+
"this._fileHandle",
|
|
3891
|
+
"'Lock is not acquired'"
|
|
3892
|
+
]
|
|
3893
|
+
});
|
|
3568
3894
|
await import_lock_file.LockFile.release(this._fileHandle);
|
|
3569
3895
|
}
|
|
3570
3896
|
};
|
|
@@ -3843,7 +4169,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3843
4169
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3844
4170
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3845
4171
|
}
|
|
3846
|
-
var
|
|
4172
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
3847
4173
|
var createDefaultModelFactory = () => {
|
|
3848
4174
|
return new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel).registerModel(import_text_model.TextModel);
|
|
3849
4175
|
};
|
|
@@ -3924,9 +4250,25 @@ var ClientServicesHost = class {
|
|
|
3924
4250
|
*/
|
|
3925
4251
|
initialize({ config, ...options }) {
|
|
3926
4252
|
var _a, _b, _c;
|
|
3927
|
-
(0,
|
|
4253
|
+
(0, import_invariant13.invariant)(!this._open, "service host is open", {
|
|
4254
|
+
F: __dxlog_file16,
|
|
4255
|
+
L: 167,
|
|
4256
|
+
S: this,
|
|
4257
|
+
A: [
|
|
4258
|
+
"!this._open",
|
|
4259
|
+
"'service host is open'"
|
|
4260
|
+
]
|
|
4261
|
+
});
|
|
3928
4262
|
if (config) {
|
|
3929
|
-
(0,
|
|
4263
|
+
(0, import_invariant13.invariant)(!this._config, "config already set", {
|
|
4264
|
+
F: __dxlog_file16,
|
|
4265
|
+
L: 170,
|
|
4266
|
+
S: this,
|
|
4267
|
+
A: [
|
|
4268
|
+
"!this._config",
|
|
4269
|
+
"'config already set'"
|
|
4270
|
+
]
|
|
4271
|
+
});
|
|
3930
4272
|
this._config = config;
|
|
3931
4273
|
if (!this._storage) {
|
|
3932
4274
|
this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
|
|
@@ -3936,7 +4278,15 @@ var ClientServicesHost = class {
|
|
|
3936
4278
|
iceServers: (_a = this._config) == null ? void 0 : _a.get("runtime.services.ice")
|
|
3937
4279
|
}), signalManager = new import_messaging.WebsocketSignalManager((_c = (_b = this._config) == null ? void 0 : _b.get("runtime.services.signaling")) != null ? _c : []) } = options;
|
|
3938
4280
|
this._signalManager = signalManager;
|
|
3939
|
-
(0,
|
|
4281
|
+
(0, import_invariant13.invariant)(!this._networkManager, "network manager already set", {
|
|
4282
|
+
F: __dxlog_file16,
|
|
4283
|
+
L: 187,
|
|
4284
|
+
S: this,
|
|
4285
|
+
A: [
|
|
4286
|
+
"!this._networkManager",
|
|
4287
|
+
"'network manager already set'"
|
|
4288
|
+
]
|
|
4289
|
+
});
|
|
3940
4290
|
this._networkManager = new import_network_manager2.NetworkManager({
|
|
3941
4291
|
log: connectionLog,
|
|
3942
4292
|
transportFactory,
|
|
@@ -3952,21 +4302,53 @@ var ClientServicesHost = class {
|
|
|
3952
4302
|
import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.begin({
|
|
3953
4303
|
id: traceId
|
|
3954
4304
|
}), {
|
|
3955
|
-
F:
|
|
3956
|
-
L:
|
|
4305
|
+
F: __dxlog_file16,
|
|
4306
|
+
L: 202,
|
|
3957
4307
|
S: this,
|
|
3958
4308
|
C: (f, a) => f(...a)
|
|
3959
4309
|
});
|
|
3960
|
-
(0,
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
4310
|
+
(0, import_invariant13.invariant)(this._config, "config not set", {
|
|
4311
|
+
F: __dxlog_file16,
|
|
4312
|
+
L: 204,
|
|
4313
|
+
S: this,
|
|
4314
|
+
A: [
|
|
4315
|
+
"this._config",
|
|
4316
|
+
"'config not set'"
|
|
4317
|
+
]
|
|
4318
|
+
});
|
|
4319
|
+
(0, import_invariant13.invariant)(this._storage, "storage not set", {
|
|
4320
|
+
F: __dxlog_file16,
|
|
4321
|
+
L: 205,
|
|
4322
|
+
S: this,
|
|
4323
|
+
A: [
|
|
4324
|
+
"this._storage",
|
|
4325
|
+
"'storage not set'"
|
|
4326
|
+
]
|
|
4327
|
+
});
|
|
4328
|
+
(0, import_invariant13.invariant)(this._signalManager, "signal manager not set", {
|
|
4329
|
+
F: __dxlog_file16,
|
|
4330
|
+
L: 206,
|
|
4331
|
+
S: this,
|
|
4332
|
+
A: [
|
|
4333
|
+
"this._signalManager",
|
|
4334
|
+
"'signal manager not set'"
|
|
4335
|
+
]
|
|
4336
|
+
});
|
|
4337
|
+
(0, import_invariant13.invariant)(this._networkManager, "network manager not set", {
|
|
4338
|
+
F: __dxlog_file16,
|
|
4339
|
+
L: 207,
|
|
4340
|
+
S: this,
|
|
4341
|
+
A: [
|
|
4342
|
+
"this._networkManager",
|
|
4343
|
+
"'network manager not set'"
|
|
4344
|
+
]
|
|
4345
|
+
});
|
|
3964
4346
|
this._opening = true;
|
|
3965
4347
|
(0, import_log15.log)("opening...", {
|
|
3966
4348
|
lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
|
|
3967
4349
|
}, {
|
|
3968
|
-
F:
|
|
3969
|
-
L:
|
|
4350
|
+
F: __dxlog_file16,
|
|
4351
|
+
L: 210,
|
|
3970
4352
|
S: this,
|
|
3971
4353
|
C: (f, a) => f(...a)
|
|
3972
4354
|
});
|
|
@@ -4000,16 +4382,16 @@ var ClientServicesHost = class {
|
|
|
4000
4382
|
(0, import_log15.log)("opened", {
|
|
4001
4383
|
deviceKey
|
|
4002
4384
|
}, {
|
|
4003
|
-
F:
|
|
4004
|
-
L:
|
|
4385
|
+
F: __dxlog_file16,
|
|
4386
|
+
L: 265,
|
|
4005
4387
|
S: this,
|
|
4006
4388
|
C: (f, a) => f(...a)
|
|
4007
4389
|
});
|
|
4008
4390
|
import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.end({
|
|
4009
4391
|
id: traceId
|
|
4010
4392
|
}), {
|
|
4011
|
-
F:
|
|
4012
|
-
L:
|
|
4393
|
+
F: __dxlog_file16,
|
|
4394
|
+
L: 266,
|
|
4013
4395
|
S: this,
|
|
4014
4396
|
C: (f, a) => f(...a)
|
|
4015
4397
|
});
|
|
@@ -4023,8 +4405,8 @@ var ClientServicesHost = class {
|
|
|
4023
4405
|
(0, import_log15.log)("closing...", {
|
|
4024
4406
|
deviceKey
|
|
4025
4407
|
}, {
|
|
4026
|
-
F:
|
|
4027
|
-
L:
|
|
4408
|
+
F: __dxlog_file16,
|
|
4409
|
+
L: 276,
|
|
4028
4410
|
S: this,
|
|
4029
4411
|
C: (f, a) => f(...a)
|
|
4030
4412
|
});
|
|
@@ -4038,8 +4420,8 @@ var ClientServicesHost = class {
|
|
|
4038
4420
|
(0, import_log15.log)("closed", {
|
|
4039
4421
|
deviceKey
|
|
4040
4422
|
}, {
|
|
4041
|
-
F:
|
|
4042
|
-
L:
|
|
4423
|
+
F: __dxlog_file16,
|
|
4424
|
+
L: 282,
|
|
4043
4425
|
S: this,
|
|
4044
4426
|
C: (f, a) => f(...a)
|
|
4045
4427
|
});
|
|
@@ -4050,30 +4432,30 @@ var ClientServicesHost = class {
|
|
|
4050
4432
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.begin({
|
|
4051
4433
|
id: traceId
|
|
4052
4434
|
}), {
|
|
4053
|
-
F:
|
|
4054
|
-
L:
|
|
4435
|
+
F: __dxlog_file16,
|
|
4436
|
+
L: 287,
|
|
4055
4437
|
S: this,
|
|
4056
4438
|
C: (f, a) => f(...a)
|
|
4057
4439
|
});
|
|
4058
4440
|
(0, import_log15.log)("resetting...", void 0, {
|
|
4059
|
-
F:
|
|
4060
|
-
L:
|
|
4441
|
+
F: __dxlog_file16,
|
|
4442
|
+
L: 289,
|
|
4061
4443
|
S: this,
|
|
4062
4444
|
C: (f, a) => f(...a)
|
|
4063
4445
|
});
|
|
4064
4446
|
await ((_a = this._serviceContext) == null ? void 0 : _a.close());
|
|
4065
4447
|
await this._storage.reset();
|
|
4066
4448
|
(0, import_log15.log)("reset", void 0, {
|
|
4067
|
-
F:
|
|
4068
|
-
L:
|
|
4449
|
+
F: __dxlog_file16,
|
|
4450
|
+
L: 292,
|
|
4069
4451
|
S: this,
|
|
4070
4452
|
C: (f, a) => f(...a)
|
|
4071
4453
|
});
|
|
4072
4454
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.end({
|
|
4073
4455
|
id: traceId
|
|
4074
4456
|
}), {
|
|
4075
|
-
F:
|
|
4076
|
-
L:
|
|
4457
|
+
F: __dxlog_file16,
|
|
4458
|
+
L: 293,
|
|
4077
4459
|
S: this,
|
|
4078
4460
|
C: (f, a) => f(...a)
|
|
4079
4461
|
});
|
|
@@ -4088,6 +4470,7 @@ _ts_decorate4([
|
|
|
4088
4470
|
], ClientServicesHost.prototype, "close", null);
|
|
4089
4471
|
|
|
4090
4472
|
// packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
|
|
4473
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/invitation-utils.ts";
|
|
4091
4474
|
var sanitizeInvitation = (invitation) => {
|
|
4092
4475
|
return {
|
|
4093
4476
|
invitationId: invitation.invitationId,
|
|
@@ -4119,7 +4502,15 @@ var performInvitation = ({ host, guest, options, hooks }) => {
|
|
|
4119
4502
|
if ((_b2 = (_a2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _a2.onConnecting) == null ? void 0 : _b2.call(_a2, guestObservable)) {
|
|
4120
4503
|
break;
|
|
4121
4504
|
}
|
|
4122
|
-
(0,
|
|
4505
|
+
(0, import_invariant14.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
|
|
4506
|
+
F: __dxlog_file17,
|
|
4507
|
+
L: 84,
|
|
4508
|
+
S: void 0,
|
|
4509
|
+
A: [
|
|
4510
|
+
"hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!)",
|
|
4511
|
+
""
|
|
4512
|
+
]
|
|
4513
|
+
});
|
|
4123
4514
|
break;
|
|
4124
4515
|
}
|
|
4125
4516
|
case import_services13.Invitation.State.CONNECTED: {
|