@dxos/client-services 0.4.10-main.c42bfdb → 0.4.10-main.c75170d
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-W7UANCHR.mjs → chunk-JP7F2IH3.mjs} +513 -403
- package/dist/lib/browser/chunk-JP7F2IH3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -3
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +9 -4
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-JSVLZGJM.cjs → chunk-34EZSH65.cjs} +520 -411
- package/dist/lib/node/chunk-34EZSH65.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -43
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +14 -9
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/indexing/util.d.ts +2 -1
- package/dist/types/src/packlets/indexing/util.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/index.d.ts +1 -0
- package/dist/types/src/packlets/invitations/index.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts +1 -0
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -2
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts +42 -0
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +7 -23
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +2 -0
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +3 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +3 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +34 -34
- package/src/packlets/indexing/util.ts +2 -2
- package/src/packlets/invitations/index.ts +1 -0
- package/src/packlets/invitations/invitation-extension.ts +28 -1
- package/src/packlets/invitations/invitations-handler.ts +74 -34
- package/src/packlets/invitations/invitations-manager.ts +197 -0
- package/src/packlets/invitations/invitations-service.ts +21 -168
- package/src/packlets/services/automerge-host.test.ts +9 -3
- package/src/packlets/services/service-context.test.ts +4 -1
- package/src/packlets/services/service-context.ts +16 -3
- package/src/packlets/services/service-host.ts +15 -13
- package/src/packlets/spaces/data-space-manager.test.ts +4 -4
- package/src/packlets/storage/level.ts +1 -1
- package/src/packlets/testing/test-builder.ts +20 -4
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-W7UANCHR.mjs.map +0 -7
- package/dist/lib/node/chunk-JSVLZGJM.cjs.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_34EZSH65_exports = {};
|
|
30
|
+
__export(chunk_34EZSH65_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -41,6 +41,7 @@ __export(chunk_JSVLZGJM_exports, {
|
|
|
41
41
|
IdentityManager: () => IdentityManager,
|
|
42
42
|
IdentityServiceImpl: () => IdentityServiceImpl,
|
|
43
43
|
InvitationsHandler: () => InvitationsHandler,
|
|
44
|
+
InvitationsManager: () => InvitationsManager,
|
|
44
45
|
InvitationsServiceImpl: () => InvitationsServiceImpl,
|
|
45
46
|
Lock: () => Lock,
|
|
46
47
|
ServiceContext: () => ServiceContext,
|
|
@@ -48,6 +49,7 @@ __export(chunk_JSVLZGJM_exports, {
|
|
|
48
49
|
SpaceInvitationProtocol: () => SpaceInvitationProtocol,
|
|
49
50
|
SpacesServiceImpl: () => SpacesServiceImpl,
|
|
50
51
|
TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
|
|
52
|
+
createAdmissionKeypair: () => createAdmissionKeypair,
|
|
51
53
|
createAuthProvider: () => createAuthProvider,
|
|
52
54
|
createCollectDiagnosticsBroadcastHandler: () => createCollectDiagnosticsBroadcastHandler,
|
|
53
55
|
createCollectDiagnosticsBroadcastSender: () => createCollectDiagnosticsBroadcastSender,
|
|
@@ -55,7 +57,6 @@ __export(chunk_JSVLZGJM_exports, {
|
|
|
55
57
|
createLevel: () => createLevel,
|
|
56
58
|
createStorageObjects: () => createStorageObjects,
|
|
57
59
|
getNetworkPeers: () => getNetworkPeers,
|
|
58
|
-
invitationExpired: () => invitationExpired,
|
|
59
60
|
isLocked: () => isLocked,
|
|
60
61
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
61
62
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -65,7 +66,7 @@ __export(chunk_JSVLZGJM_exports, {
|
|
|
65
66
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
66
67
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
67
68
|
});
|
|
68
|
-
module.exports = __toCommonJS(
|
|
69
|
+
module.exports = __toCommonJS(chunk_34EZSH65_exports);
|
|
69
70
|
var import_async = require("@dxos/async");
|
|
70
71
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
71
72
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -120,6 +121,7 @@ var import_async7 = require("@dxos/async");
|
|
|
120
121
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
121
122
|
var import_context4 = require("@dxos/context");
|
|
122
123
|
var import_credentials7 = require("@dxos/credentials");
|
|
124
|
+
var import_crypto = require("@dxos/crypto");
|
|
123
125
|
var import_invariant5 = require("@dxos/invariant");
|
|
124
126
|
var import_keys5 = require("@dxos/keys");
|
|
125
127
|
var import_log4 = require("@dxos/log");
|
|
@@ -129,6 +131,7 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
129
131
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
130
132
|
var import_async8 = require("@dxos/async");
|
|
131
133
|
var import_context5 = require("@dxos/context");
|
|
134
|
+
var import_crypto2 = require("@dxos/crypto");
|
|
132
135
|
var import_invariant6 = require("@dxos/invariant");
|
|
133
136
|
var import_keys6 = require("@dxos/keys");
|
|
134
137
|
var import_log5 = require("@dxos/log");
|
|
@@ -136,29 +139,29 @@ var import_protocols5 = require("@dxos/protocols");
|
|
|
136
139
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
137
140
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
138
141
|
var import_teleport = require("@dxos/teleport");
|
|
139
|
-
var import_async9 = require("@dxos/async");
|
|
140
142
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
141
|
-
var import_context6 = require("@dxos/context");
|
|
142
|
-
var import_invariant7 = require("@dxos/invariant");
|
|
143
|
-
var import_log6 = require("@dxos/log");
|
|
144
143
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
145
144
|
var import_credentials8 = require("@dxos/credentials");
|
|
146
145
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
147
|
-
var
|
|
148
|
-
var
|
|
146
|
+
var import_invariant7 = require("@dxos/invariant");
|
|
147
|
+
var import_log6 = require("@dxos/log");
|
|
149
148
|
var import_protocols6 = require("@dxos/protocols");
|
|
150
149
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
150
|
+
var import_async9 = require("@dxos/async");
|
|
151
|
+
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
152
|
+
var import_invariant8 = require("@dxos/invariant");
|
|
153
|
+
var import_log7 = require("@dxos/log");
|
|
151
154
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
152
155
|
var import_debug2 = require("@dxos/debug");
|
|
153
156
|
var import_rpc = require("@dxos/rpc");
|
|
154
157
|
var import_tracing3 = require("@dxos/tracing");
|
|
155
158
|
var import_async10 = require("@dxos/async");
|
|
156
159
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
157
|
-
var
|
|
160
|
+
var import_context6 = require("@dxos/context");
|
|
158
161
|
var import_debug3 = require("@dxos/debug");
|
|
159
162
|
var import_echo_db = require("@dxos/echo-db");
|
|
160
|
-
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
161
163
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
164
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
162
165
|
var import_invariant9 = require("@dxos/invariant");
|
|
163
166
|
var import_keys7 = require("@dxos/keys");
|
|
164
167
|
var import_log8 = require("@dxos/log");
|
|
@@ -171,7 +174,7 @@ var import_util4 = require("@dxos/util");
|
|
|
171
174
|
var import_async11 = require("@dxos/async");
|
|
172
175
|
var import_credentials10 = require("@dxos/credentials");
|
|
173
176
|
var import_async12 = require("@dxos/async");
|
|
174
|
-
var
|
|
177
|
+
var import_context7 = require("@dxos/context");
|
|
175
178
|
var import_invariant10 = require("@dxos/invariant");
|
|
176
179
|
var import_keys8 = require("@dxos/keys");
|
|
177
180
|
var import_log9 = require("@dxos/log");
|
|
@@ -179,7 +182,7 @@ var import_protocols8 = require("@dxos/protocols");
|
|
|
179
182
|
var import_teleport2 = require("@dxos/teleport");
|
|
180
183
|
var import_util5 = require("@dxos/util");
|
|
181
184
|
var import_async13 = require("@dxos/async");
|
|
182
|
-
var
|
|
185
|
+
var import_context8 = require("@dxos/context");
|
|
183
186
|
var import_credentials11 = require("@dxos/credentials");
|
|
184
187
|
var import_invariant11 = require("@dxos/invariant");
|
|
185
188
|
var import_keys9 = require("@dxos/keys");
|
|
@@ -200,10 +203,10 @@ var import_log11 = require("@dxos/log");
|
|
|
200
203
|
var import_protocols10 = require("@dxos/protocols");
|
|
201
204
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
202
205
|
var import_async15 = require("@dxos/async");
|
|
203
|
-
var
|
|
206
|
+
var import_context9 = require("@dxos/context");
|
|
204
207
|
var import_credentials14 = require("@dxos/credentials");
|
|
205
208
|
var import_debug6 = require("@dxos/debug");
|
|
206
|
-
var
|
|
209
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
207
210
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
208
211
|
var import_indexing = require("@dxos/indexing");
|
|
209
212
|
var import_invariant13 = require("@dxos/invariant");
|
|
@@ -231,9 +234,9 @@ var import_tracing7 = require("@dxos/tracing");
|
|
|
231
234
|
var import_util8 = require("@dxos/util");
|
|
232
235
|
var import_async16 = require("@dxos/async");
|
|
233
236
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
234
|
-
var
|
|
235
|
-
var
|
|
236
|
-
var
|
|
237
|
+
var import_context10 = require("@dxos/context");
|
|
238
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
239
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
237
240
|
var import_indexing2 = require("@dxos/indexing");
|
|
238
241
|
var import_invariant15 = require("@dxos/invariant");
|
|
239
242
|
var import_keys11 = require("@dxos/keys");
|
|
@@ -1485,6 +1488,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1485
1488
|
this._callbacks = _callbacks;
|
|
1486
1489
|
this._ctx = new import_context5.Context();
|
|
1487
1490
|
this._remoteOptionsTrigger = new import_async8.Trigger();
|
|
1491
|
+
this._challenge = void 0;
|
|
1488
1492
|
this.invitation = void 0;
|
|
1489
1493
|
this.guestProfile = void 0;
|
|
1490
1494
|
this.authenticationPassed = false;
|
|
@@ -1499,7 +1503,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1499
1503
|
options: async (options) => {
|
|
1500
1504
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1501
1505
|
F: __dxlog_file6,
|
|
1502
|
-
L:
|
|
1506
|
+
L: 90,
|
|
1503
1507
|
S: this,
|
|
1504
1508
|
A: [
|
|
1505
1509
|
"!this._remoteOptions",
|
|
@@ -1516,7 +1520,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1516
1520
|
id: traceId
|
|
1517
1521
|
}), {
|
|
1518
1522
|
F: __dxlog_file6,
|
|
1519
|
-
L:
|
|
1523
|
+
L: 99,
|
|
1520
1524
|
S: this,
|
|
1521
1525
|
C: (f, a) => f(...a)
|
|
1522
1526
|
});
|
|
@@ -1526,7 +1530,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1526
1530
|
invitationId
|
|
1527
1531
|
}, {
|
|
1528
1532
|
F: __dxlog_file6,
|
|
1529
|
-
L:
|
|
1533
|
+
L: 103,
|
|
1530
1534
|
S: this,
|
|
1531
1535
|
C: (f, a) => f(...a)
|
|
1532
1536
|
});
|
|
@@ -1540,7 +1544,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1540
1544
|
guestProfile: profile
|
|
1541
1545
|
}, {
|
|
1542
1546
|
F: __dxlog_file6,
|
|
1543
|
-
L:
|
|
1547
|
+
L: 112,
|
|
1544
1548
|
S: this,
|
|
1545
1549
|
C: (f, a) => f(...a)
|
|
1546
1550
|
});
|
|
@@ -1549,25 +1553,27 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1549
1553
|
...this.invitation,
|
|
1550
1554
|
state: import_services4.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1551
1555
|
});
|
|
1556
|
+
this._challenge = this.invitation.authMethod === import_services4.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
1552
1557
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1553
1558
|
id: traceId
|
|
1554
1559
|
}), {
|
|
1555
1560
|
F: __dxlog_file6,
|
|
1556
|
-
L:
|
|
1561
|
+
L: 122,
|
|
1557
1562
|
S: this,
|
|
1558
1563
|
C: (f, a) => f(...a)
|
|
1559
1564
|
});
|
|
1560
1565
|
return {
|
|
1561
|
-
authMethod: this.invitation.authMethod
|
|
1566
|
+
authMethod: this.invitation.authMethod,
|
|
1567
|
+
challenge: this._challenge
|
|
1562
1568
|
};
|
|
1563
1569
|
},
|
|
1564
|
-
authenticate: async ({ authCode: code }) => {
|
|
1570
|
+
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
1565
1571
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1566
1572
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.begin({
|
|
1567
1573
|
id: traceId
|
|
1568
1574
|
}), {
|
|
1569
1575
|
F: __dxlog_file6,
|
|
1570
|
-
L:
|
|
1576
|
+
L: 131,
|
|
1571
1577
|
S: this,
|
|
1572
1578
|
C: (f, a) => f(...a)
|
|
1573
1579
|
});
|
|
@@ -1575,14 +1581,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1575
1581
|
authCode: code
|
|
1576
1582
|
}, {
|
|
1577
1583
|
F: __dxlog_file6,
|
|
1578
|
-
L:
|
|
1584
|
+
L: 132,
|
|
1579
1585
|
S: this,
|
|
1580
1586
|
C: (f, a) => f(...a)
|
|
1581
1587
|
});
|
|
1582
1588
|
let status = import_invitations2.AuthenticationResponse.Status.OK;
|
|
1583
1589
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1584
1590
|
F: __dxlog_file6,
|
|
1585
|
-
L:
|
|
1591
|
+
L: 135,
|
|
1586
1592
|
S: this,
|
|
1587
1593
|
A: [
|
|
1588
1594
|
"this.invitation",
|
|
@@ -1593,7 +1599,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1593
1599
|
case import_services4.Invitation.AuthMethod.NONE: {
|
|
1594
1600
|
(0, import_log5.log)("authentication not required", void 0, {
|
|
1595
1601
|
F: __dxlog_file6,
|
|
1596
|
-
L:
|
|
1602
|
+
L: 138,
|
|
1597
1603
|
S: this,
|
|
1598
1604
|
C: (f, a) => f(...a)
|
|
1599
1605
|
});
|
|
@@ -1613,12 +1619,25 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1613
1619
|
}
|
|
1614
1620
|
break;
|
|
1615
1621
|
}
|
|
1622
|
+
case import_services4.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
|
|
1623
|
+
if (!this.invitation.guestKeypair) {
|
|
1624
|
+
status = import_invitations2.AuthenticationResponse.Status.INTERNAL_ERROR;
|
|
1625
|
+
break;
|
|
1626
|
+
}
|
|
1627
|
+
const isSignatureValid = this._challenge && (0, import_crypto2.verify)(this._challenge, Buffer.from(signedChallenge ?? []), this.invitation.guestKeypair.publicKey.asBuffer());
|
|
1628
|
+
if (isSignatureValid) {
|
|
1629
|
+
this.authenticationPassed = true;
|
|
1630
|
+
} else {
|
|
1631
|
+
status = import_invitations2.AuthenticationResponse.Status.INVALID_SIGNATURE;
|
|
1632
|
+
}
|
|
1633
|
+
break;
|
|
1634
|
+
}
|
|
1616
1635
|
default: {
|
|
1617
1636
|
import_log5.log.error("invalid authentication method", {
|
|
1618
1637
|
authMethod: this.invitation.authMethod
|
|
1619
1638
|
}, {
|
|
1620
1639
|
F: __dxlog_file6,
|
|
1621
|
-
L:
|
|
1640
|
+
L: 176,
|
|
1622
1641
|
S: this,
|
|
1623
1642
|
C: (f, a) => f(...a)
|
|
1624
1643
|
});
|
|
@@ -1633,7 +1652,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1633
1652
|
}
|
|
1634
1653
|
}), {
|
|
1635
1654
|
F: __dxlog_file6,
|
|
1636
|
-
L:
|
|
1655
|
+
L: 182,
|
|
1637
1656
|
S: this,
|
|
1638
1657
|
C: (f, a) => f(...a)
|
|
1639
1658
|
});
|
|
@@ -1647,14 +1666,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1647
1666
|
id: traceId
|
|
1648
1667
|
}), {
|
|
1649
1668
|
F: __dxlog_file6,
|
|
1650
|
-
L:
|
|
1669
|
+
L: 188,
|
|
1651
1670
|
S: this,
|
|
1652
1671
|
C: (f, a) => f(...a)
|
|
1653
1672
|
});
|
|
1654
1673
|
try {
|
|
1655
1674
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1656
1675
|
F: __dxlog_file6,
|
|
1657
|
-
L:
|
|
1676
|
+
L: 191,
|
|
1658
1677
|
S: this,
|
|
1659
1678
|
A: [
|
|
1660
1679
|
"this.invitation",
|
|
@@ -1669,7 +1688,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1669
1688
|
id: traceId
|
|
1670
1689
|
}), {
|
|
1671
1690
|
F: __dxlog_file6,
|
|
1672
|
-
L:
|
|
1691
|
+
L: 199,
|
|
1673
1692
|
S: this,
|
|
1674
1693
|
C: (f, a) => f(...a)
|
|
1675
1694
|
});
|
|
@@ -1726,7 +1745,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1726
1745
|
options: async (options) => {
|
|
1727
1746
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1728
1747
|
F: __dxlog_file6,
|
|
1729
|
-
L:
|
|
1748
|
+
L: 266,
|
|
1730
1749
|
S: this,
|
|
1731
1750
|
A: [
|
|
1732
1751
|
"!this._remoteOptions",
|
|
@@ -1753,7 +1772,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1753
1772
|
try {
|
|
1754
1773
|
(0, import_log5.log)("begin options", void 0, {
|
|
1755
1774
|
F: __dxlog_file6,
|
|
1756
|
-
L:
|
|
1775
|
+
L: 287,
|
|
1757
1776
|
S: this,
|
|
1758
1777
|
C: (f, a) => f(...a)
|
|
1759
1778
|
});
|
|
@@ -1765,7 +1784,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1765
1784
|
}));
|
|
1766
1785
|
(0, import_log5.log)("end options", void 0, {
|
|
1767
1786
|
F: __dxlog_file6,
|
|
1768
|
-
L:
|
|
1787
|
+
L: 290,
|
|
1769
1788
|
S: this,
|
|
1770
1789
|
C: (f, a) => f(...a)
|
|
1771
1790
|
});
|
|
@@ -1779,7 +1798,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1779
1798
|
} catch (err) {
|
|
1780
1799
|
(0, import_log5.log)("openError", err, {
|
|
1781
1800
|
F: __dxlog_file6,
|
|
1782
|
-
L:
|
|
1801
|
+
L: 300,
|
|
1783
1802
|
S: this,
|
|
1784
1803
|
C: (f, a) => f(...a)
|
|
1785
1804
|
});
|
|
@@ -1789,7 +1808,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1789
1808
|
async onClose() {
|
|
1790
1809
|
(0, import_log5.log)("onClose", void 0, {
|
|
1791
1810
|
F: __dxlog_file6,
|
|
1792
|
-
L:
|
|
1811
|
+
L: 306,
|
|
1793
1812
|
S: this,
|
|
1794
1813
|
C: (f, a) => f(...a)
|
|
1795
1814
|
});
|
|
@@ -1806,11 +1825,11 @@ var InvitationsHandler = class {
|
|
|
1806
1825
|
this._networkManager = _networkManager;
|
|
1807
1826
|
}
|
|
1808
1827
|
createInvitation(protocol, options) {
|
|
1809
|
-
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random(), persistent =
|
|
1828
|
+
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random(), persistent = options?.authMethod !== import_services3.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, lifetime = 86400, multiUse = false } = options ?? {};
|
|
1810
1829
|
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1811
1830
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
1812
1831
|
F: __dxlog_file7,
|
|
1813
|
-
L:
|
|
1832
|
+
L: 87,
|
|
1814
1833
|
S: this,
|
|
1815
1834
|
A: [
|
|
1816
1835
|
"protocol",
|
|
@@ -1825,9 +1844,11 @@ var InvitationsHandler = class {
|
|
|
1825
1844
|
swarmKey,
|
|
1826
1845
|
authCode,
|
|
1827
1846
|
timeout,
|
|
1828
|
-
persistent,
|
|
1847
|
+
persistent: persistent && type !== import_services3.Invitation.Type.DELEGATED,
|
|
1848
|
+
guestKeypair: guestKeypair ?? (authMethod === import_services3.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
|
|
1829
1849
|
created,
|
|
1830
1850
|
lifetime,
|
|
1851
|
+
multiUse,
|
|
1831
1852
|
...protocol.getInvitationContext()
|
|
1832
1853
|
};
|
|
1833
1854
|
const stream = new import_async7.PushStream();
|
|
@@ -1842,7 +1863,7 @@ var InvitationsHandler = class {
|
|
|
1842
1863
|
...protocol.toJSON()
|
|
1843
1864
|
}, {
|
|
1844
1865
|
F: __dxlog_file7,
|
|
1845
|
-
L:
|
|
1866
|
+
L: 115,
|
|
1846
1867
|
S: this,
|
|
1847
1868
|
C: (f, a) => f(...a)
|
|
1848
1869
|
});
|
|
@@ -1867,7 +1888,7 @@ var InvitationsHandler = class {
|
|
|
1867
1888
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
1868
1889
|
(0, import_invariant5.invariant)(deviceKey, void 0, {
|
|
1869
1890
|
F: __dxlog_file7,
|
|
1870
|
-
L:
|
|
1891
|
+
L: 136,
|
|
1871
1892
|
S: this,
|
|
1872
1893
|
A: [
|
|
1873
1894
|
"deviceKey",
|
|
@@ -1890,7 +1911,7 @@ var InvitationsHandler = class {
|
|
|
1890
1911
|
id: traceId
|
|
1891
1912
|
}), {
|
|
1892
1913
|
F: __dxlog_file7,
|
|
1893
|
-
L:
|
|
1914
|
+
L: 154,
|
|
1894
1915
|
S: this,
|
|
1895
1916
|
C: (f, a) => f(...a)
|
|
1896
1917
|
});
|
|
@@ -1898,7 +1919,7 @@ var InvitationsHandler = class {
|
|
|
1898
1919
|
...protocol.toJSON()
|
|
1899
1920
|
}, {
|
|
1900
1921
|
F: __dxlog_file7,
|
|
1901
|
-
L:
|
|
1922
|
+
L: 155,
|
|
1902
1923
|
S: this,
|
|
1903
1924
|
C: (f, a) => f(...a)
|
|
1904
1925
|
});
|
|
@@ -1914,7 +1935,7 @@ var InvitationsHandler = class {
|
|
|
1914
1935
|
...protocol.toJSON()
|
|
1915
1936
|
}, {
|
|
1916
1937
|
F: __dxlog_file7,
|
|
1917
|
-
L:
|
|
1938
|
+
L: 158,
|
|
1918
1939
|
S: this,
|
|
1919
1940
|
C: (f, a) => f(...a)
|
|
1920
1941
|
});
|
|
@@ -1926,7 +1947,7 @@ var InvitationsHandler = class {
|
|
|
1926
1947
|
id: traceId
|
|
1927
1948
|
}), {
|
|
1928
1949
|
F: __dxlog_file7,
|
|
1929
|
-
L:
|
|
1950
|
+
L: 160,
|
|
1930
1951
|
S: this,
|
|
1931
1952
|
C: (f, a) => f(...a)
|
|
1932
1953
|
});
|
|
@@ -1936,7 +1957,7 @@ var InvitationsHandler = class {
|
|
|
1936
1957
|
...protocol.toJSON()
|
|
1937
1958
|
}, {
|
|
1938
1959
|
F: __dxlog_file7,
|
|
1939
|
-
L:
|
|
1960
|
+
L: 163,
|
|
1940
1961
|
S: this,
|
|
1941
1962
|
C: (f, a) => f(...a)
|
|
1942
1963
|
});
|
|
@@ -1947,7 +1968,7 @@ var InvitationsHandler = class {
|
|
|
1947
1968
|
} else {
|
|
1948
1969
|
import_log4.log.error("failed", err, {
|
|
1949
1970
|
F: __dxlog_file7,
|
|
1950
|
-
L:
|
|
1971
|
+
L: 166,
|
|
1951
1972
|
S: this,
|
|
1952
1973
|
C: (f, a) => f(...a)
|
|
1953
1974
|
});
|
|
@@ -1958,12 +1979,12 @@ var InvitationsHandler = class {
|
|
|
1958
1979
|
error: err
|
|
1959
1980
|
}), {
|
|
1960
1981
|
F: __dxlog_file7,
|
|
1961
|
-
L:
|
|
1982
|
+
L: 169,
|
|
1962
1983
|
S: this,
|
|
1963
1984
|
C: (f, a) => f(...a)
|
|
1964
1985
|
});
|
|
1965
1986
|
} finally {
|
|
1966
|
-
if (
|
|
1987
|
+
if (!multiUse) {
|
|
1967
1988
|
await swarmConnection.close();
|
|
1968
1989
|
await ctx.dispose();
|
|
1969
1990
|
}
|
|
@@ -1979,7 +2000,7 @@ var InvitationsHandler = class {
|
|
|
1979
2000
|
...protocol.toJSON()
|
|
1980
2001
|
}, {
|
|
1981
2002
|
F: __dxlog_file7,
|
|
1982
|
-
L:
|
|
2003
|
+
L: 184,
|
|
1983
2004
|
S: this,
|
|
1984
2005
|
C: (f, a) => f(...a)
|
|
1985
2006
|
});
|
|
@@ -1990,7 +2011,7 @@ var InvitationsHandler = class {
|
|
|
1990
2011
|
} else {
|
|
1991
2012
|
import_log4.log.error("failed", err, {
|
|
1992
2013
|
F: __dxlog_file7,
|
|
1993
|
-
L:
|
|
2014
|
+
L: 187,
|
|
1994
2015
|
S: this,
|
|
1995
2016
|
C: (f, a) => f(...a)
|
|
1996
2017
|
});
|
|
@@ -2000,11 +2021,11 @@ var InvitationsHandler = class {
|
|
|
2000
2021
|
});
|
|
2001
2022
|
return extension;
|
|
2002
2023
|
};
|
|
2003
|
-
if (invitation.lifetime && invitation.created
|
|
2024
|
+
if (invitation.lifetime && invitation.created) {
|
|
2004
2025
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2005
2026
|
import_log4.log.warn("invitation has already expired", void 0, {
|
|
2006
2027
|
F: __dxlog_file7,
|
|
2007
|
-
L:
|
|
2028
|
+
L: 198,
|
|
2008
2029
|
S: this,
|
|
2009
2030
|
C: (f, a) => f(...a)
|
|
2010
2031
|
});
|
|
@@ -2055,7 +2076,7 @@ var InvitationsHandler = class {
|
|
|
2055
2076
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2056
2077
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
2057
2078
|
F: __dxlog_file7,
|
|
2058
|
-
L:
|
|
2079
|
+
L: 252,
|
|
2059
2080
|
S: this,
|
|
2060
2081
|
A: [
|
|
2061
2082
|
"protocol",
|
|
@@ -2065,7 +2086,7 @@ var InvitationsHandler = class {
|
|
|
2065
2086
|
if (deviceProfile) {
|
|
2066
2087
|
(0, import_invariant5.invariant)(invitation.kind === import_services3.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2067
2088
|
F: __dxlog_file7,
|
|
2068
|
-
L:
|
|
2089
|
+
L: 255,
|
|
2069
2090
|
S: this,
|
|
2070
2091
|
A: [
|
|
2071
2092
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -2080,7 +2101,7 @@ var InvitationsHandler = class {
|
|
|
2080
2101
|
const setState = (newData) => {
|
|
2081
2102
|
(0, import_invariant5.invariant)(newData.state !== void 0, void 0, {
|
|
2082
2103
|
F: __dxlog_file7,
|
|
2083
|
-
L:
|
|
2104
|
+
L: 266,
|
|
2084
2105
|
S: this,
|
|
2085
2106
|
A: [
|
|
2086
2107
|
"newData.state !== undefined",
|
|
@@ -2100,7 +2121,7 @@ var InvitationsHandler = class {
|
|
|
2100
2121
|
...protocol.toJSON()
|
|
2101
2122
|
}, {
|
|
2102
2123
|
F: __dxlog_file7,
|
|
2103
|
-
L:
|
|
2124
|
+
L: 274,
|
|
2104
2125
|
S: this,
|
|
2105
2126
|
C: (f, a) => f(...a)
|
|
2106
2127
|
});
|
|
@@ -2110,7 +2131,7 @@ var InvitationsHandler = class {
|
|
|
2110
2131
|
} else {
|
|
2111
2132
|
import_log4.log.warn("auth failed", err, {
|
|
2112
2133
|
F: __dxlog_file7,
|
|
2113
|
-
L:
|
|
2134
|
+
L: 277,
|
|
2114
2135
|
S: this,
|
|
2115
2136
|
C: (f, a) => f(...a)
|
|
2116
2137
|
});
|
|
@@ -2124,7 +2145,7 @@ var InvitationsHandler = class {
|
|
|
2124
2145
|
...protocol.toJSON()
|
|
2125
2146
|
}, {
|
|
2126
2147
|
F: __dxlog_file7,
|
|
2127
|
-
L:
|
|
2148
|
+
L: 285,
|
|
2128
2149
|
S: this,
|
|
2129
2150
|
C: (f, a) => f(...a)
|
|
2130
2151
|
});
|
|
@@ -2139,7 +2160,7 @@ var InvitationsHandler = class {
|
|
|
2139
2160
|
currentState
|
|
2140
2161
|
}, {
|
|
2141
2162
|
F: __dxlog_file7,
|
|
2142
|
-
L:
|
|
2163
|
+
L: 295,
|
|
2143
2164
|
S: this,
|
|
2144
2165
|
C: (f, a) => f(...a)
|
|
2145
2166
|
});
|
|
@@ -2154,7 +2175,7 @@ var InvitationsHandler = class {
|
|
|
2154
2175
|
id: traceId
|
|
2155
2176
|
}), {
|
|
2156
2177
|
F: __dxlog_file7,
|
|
2157
|
-
L:
|
|
2178
|
+
L: 304,
|
|
2158
2179
|
S: this,
|
|
2159
2180
|
C: (f, a) => f(...a)
|
|
2160
2181
|
});
|
|
@@ -2166,7 +2187,7 @@ var InvitationsHandler = class {
|
|
|
2166
2187
|
...protocol.toJSON()
|
|
2167
2188
|
}, {
|
|
2168
2189
|
F: __dxlog_file7,
|
|
2169
|
-
L:
|
|
2190
|
+
L: 312,
|
|
2170
2191
|
S: this,
|
|
2171
2192
|
C: (f, a) => f(...a)
|
|
2172
2193
|
});
|
|
@@ -2177,7 +2198,7 @@ var InvitationsHandler = class {
|
|
|
2177
2198
|
...protocol.toJSON()
|
|
2178
2199
|
}, {
|
|
2179
2200
|
F: __dxlog_file7,
|
|
2180
|
-
L:
|
|
2201
|
+
L: 316,
|
|
2181
2202
|
S: this,
|
|
2182
2203
|
C: (f, a) => f(...a)
|
|
2183
2204
|
});
|
|
@@ -2187,62 +2208,28 @@ var InvitationsHandler = class {
|
|
|
2187
2208
|
response: introductionResponse
|
|
2188
2209
|
}, {
|
|
2189
2210
|
F: __dxlog_file7,
|
|
2190
|
-
L:
|
|
2211
|
+
L: 320,
|
|
2191
2212
|
S: this,
|
|
2192
2213
|
C: (f, a) => f(...a)
|
|
2193
2214
|
});
|
|
2194
2215
|
invitation.authMethod = introductionResponse.authMethod;
|
|
2195
2216
|
if (isAuthenticationRequired(invitation)) {
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2205
|
-
});
|
|
2206
|
-
const authCode = await authenticated.wait({
|
|
2207
|
-
timeout
|
|
2208
|
-
});
|
|
2209
|
-
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2210
|
-
F: __dxlog_file7,
|
|
2211
|
-
L: 325,
|
|
2212
|
-
S: this,
|
|
2213
|
-
C: (f, a) => f(...a)
|
|
2214
|
-
});
|
|
2215
|
-
setState({
|
|
2216
|
-
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2217
|
-
});
|
|
2218
|
-
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2219
|
-
authCode
|
|
2220
|
-
});
|
|
2221
|
-
if (response.status === void 0 || response.status === import_invitations.AuthenticationResponse.Status.OK) {
|
|
2217
|
+
switch (invitation.authMethod) {
|
|
2218
|
+
case import_services3.Invitation.AuthMethod.SHARED_SECRET:
|
|
2219
|
+
await this._handleGuestOtpAuth(extension, setState, authenticated, {
|
|
2220
|
+
timeout
|
|
2221
|
+
});
|
|
2222
|
+
break;
|
|
2223
|
+
case import_services3.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
|
|
2224
|
+
await this._handleGuestKpkAuth(extension, setState, invitation, introductionResponse);
|
|
2222
2225
|
break;
|
|
2223
|
-
}
|
|
2224
|
-
if (response.status === import_invitations.AuthenticationResponse.Status.INVALID_OTP) {
|
|
2225
|
-
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2226
|
-
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2227
|
-
} else {
|
|
2228
|
-
(0, import_log4.log)("retrying invalid code", {
|
|
2229
|
-
attempt
|
|
2230
|
-
}, {
|
|
2231
|
-
F: __dxlog_file7,
|
|
2232
|
-
L: 336,
|
|
2233
|
-
S: this,
|
|
2234
|
-
C: (f, a) => f(...a)
|
|
2235
|
-
});
|
|
2236
|
-
authenticated.reset();
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
2226
|
}
|
|
2240
2227
|
}
|
|
2241
2228
|
(0, import_log4.log)("request admission", {
|
|
2242
2229
|
...protocol.toJSON()
|
|
2243
2230
|
}, {
|
|
2244
2231
|
F: __dxlog_file7,
|
|
2245
|
-
L:
|
|
2232
|
+
L: 336,
|
|
2246
2233
|
S: this,
|
|
2247
2234
|
C: (f, a) => f(...a)
|
|
2248
2235
|
});
|
|
@@ -2254,7 +2241,7 @@ var InvitationsHandler = class {
|
|
|
2254
2241
|
...protocol.toJSON()
|
|
2255
2242
|
}, {
|
|
2256
2243
|
F: __dxlog_file7,
|
|
2257
|
-
L:
|
|
2244
|
+
L: 347,
|
|
2258
2245
|
S: this,
|
|
2259
2246
|
C: (f, a) => f(...a)
|
|
2260
2247
|
});
|
|
@@ -2267,7 +2254,7 @@ var InvitationsHandler = class {
|
|
|
2267
2254
|
id: traceId
|
|
2268
2255
|
}), {
|
|
2269
2256
|
F: __dxlog_file7,
|
|
2270
|
-
L:
|
|
2257
|
+
L: 349,
|
|
2271
2258
|
S: this,
|
|
2272
2259
|
C: (f, a) => f(...a)
|
|
2273
2260
|
});
|
|
@@ -2277,7 +2264,7 @@ var InvitationsHandler = class {
|
|
|
2277
2264
|
...protocol.toJSON()
|
|
2278
2265
|
}, {
|
|
2279
2266
|
F: __dxlog_file7,
|
|
2280
|
-
L:
|
|
2267
|
+
L: 352,
|
|
2281
2268
|
S: this,
|
|
2282
2269
|
C: (f, a) => f(...a)
|
|
2283
2270
|
});
|
|
@@ -2287,7 +2274,7 @@ var InvitationsHandler = class {
|
|
|
2287
2274
|
} else {
|
|
2288
2275
|
(0, import_log4.log)("auth failed", err, {
|
|
2289
2276
|
F: __dxlog_file7,
|
|
2290
|
-
L:
|
|
2277
|
+
L: 355,
|
|
2291
2278
|
S: this,
|
|
2292
2279
|
C: (f, a) => f(...a)
|
|
2293
2280
|
});
|
|
@@ -2298,7 +2285,7 @@ var InvitationsHandler = class {
|
|
|
2298
2285
|
error: err
|
|
2299
2286
|
}), {
|
|
2300
2287
|
F: __dxlog_file7,
|
|
2301
|
-
L:
|
|
2288
|
+
L: 358,
|
|
2302
2289
|
S: this,
|
|
2303
2290
|
C: (f, a) => f(...a)
|
|
2304
2291
|
});
|
|
@@ -2316,7 +2303,7 @@ var InvitationsHandler = class {
|
|
|
2316
2303
|
...protocol.toJSON()
|
|
2317
2304
|
}, {
|
|
2318
2305
|
F: __dxlog_file7,
|
|
2319
|
-
L:
|
|
2306
|
+
L: 369,
|
|
2320
2307
|
S: this,
|
|
2321
2308
|
C: (f, a) => f(...a)
|
|
2322
2309
|
});
|
|
@@ -2326,7 +2313,7 @@ var InvitationsHandler = class {
|
|
|
2326
2313
|
} else {
|
|
2327
2314
|
(0, import_log4.log)("auth failed", err, {
|
|
2328
2315
|
F: __dxlog_file7,
|
|
2329
|
-
L:
|
|
2316
|
+
L: 372,
|
|
2330
2317
|
S: this,
|
|
2331
2318
|
C: (f, a) => f(...a)
|
|
2332
2319
|
});
|
|
@@ -2343,7 +2330,7 @@ var InvitationsHandler = class {
|
|
|
2343
2330
|
} else {
|
|
2344
2331
|
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2345
2332
|
F: __dxlog_file7,
|
|
2346
|
-
L:
|
|
2333
|
+
L: 386,
|
|
2347
2334
|
S: this,
|
|
2348
2335
|
A: [
|
|
2349
2336
|
"invitation.swarmKey",
|
|
@@ -2381,198 +2368,111 @@ var InvitationsHandler = class {
|
|
|
2381
2368
|
});
|
|
2382
2369
|
return observable;
|
|
2383
2370
|
}
|
|
2371
|
+
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2372
|
+
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2373
|
+
(0, import_log4.log)("guest waiting for authentication code...", void 0, {
|
|
2374
|
+
F: __dxlog_file7,
|
|
2375
|
+
L: 426,
|
|
2376
|
+
S: this,
|
|
2377
|
+
C: (f, a) => f(...a)
|
|
2378
|
+
});
|
|
2379
|
+
setState({
|
|
2380
|
+
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2381
|
+
});
|
|
2382
|
+
const authCode = await authenticated.wait(options);
|
|
2383
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2384
|
+
F: __dxlog_file7,
|
|
2385
|
+
L: 430,
|
|
2386
|
+
S: this,
|
|
2387
|
+
C: (f, a) => f(...a)
|
|
2388
|
+
});
|
|
2389
|
+
setState({
|
|
2390
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2391
|
+
});
|
|
2392
|
+
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2393
|
+
authCode
|
|
2394
|
+
});
|
|
2395
|
+
if (response.status === void 0 || response.status === import_invitations.AuthenticationResponse.Status.OK) {
|
|
2396
|
+
break;
|
|
2397
|
+
}
|
|
2398
|
+
if (response.status === import_invitations.AuthenticationResponse.Status.INVALID_OTP) {
|
|
2399
|
+
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2400
|
+
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2401
|
+
} else {
|
|
2402
|
+
(0, import_log4.log)("retrying invalid code", {
|
|
2403
|
+
attempt
|
|
2404
|
+
}, {
|
|
2405
|
+
F: __dxlog_file7,
|
|
2406
|
+
L: 441,
|
|
2407
|
+
S: this,
|
|
2408
|
+
C: (f, a) => f(...a)
|
|
2409
|
+
});
|
|
2410
|
+
authenticated.reset();
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
async _handleGuestKpkAuth(extension, setState, invitation, introductionResponse) {
|
|
2416
|
+
if (invitation.guestKeypair?.privateKey == null) {
|
|
2417
|
+
throw new Error("keypair missing in the invitation");
|
|
2418
|
+
}
|
|
2419
|
+
if (introductionResponse.challenge == null) {
|
|
2420
|
+
throw new Error("challenge missing in the introduction");
|
|
2421
|
+
}
|
|
2422
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2423
|
+
F: __dxlog_file7,
|
|
2424
|
+
L: 460,
|
|
2425
|
+
S: this,
|
|
2426
|
+
C: (f, a) => f(...a)
|
|
2427
|
+
});
|
|
2428
|
+
setState({
|
|
2429
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2430
|
+
});
|
|
2431
|
+
const signature = (0, import_crypto.sign)(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
|
|
2432
|
+
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2433
|
+
signedChallenge: signature
|
|
2434
|
+
});
|
|
2435
|
+
if (response.status !== import_invitations.AuthenticationResponse.Status.OK) {
|
|
2436
|
+
throw new Error(`Authentication failed with code: ${response.status}`);
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2384
2439
|
};
|
|
2385
|
-
var
|
|
2386
|
-
|
|
2440
|
+
var createAdmissionKeypair = () => {
|
|
2441
|
+
const keypair = (0, import_crypto.createKeyPair)();
|
|
2442
|
+
return {
|
|
2443
|
+
publicKey: import_keys5.PublicKey.from(keypair.publicKey),
|
|
2444
|
+
privateKey: keypair.secretKey
|
|
2445
|
+
};
|
|
2387
2446
|
};
|
|
2388
|
-
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
2389
2447
|
var InvitationsServiceImpl = class {
|
|
2390
|
-
constructor(
|
|
2391
|
-
this.
|
|
2392
|
-
this._getHandler = _getHandler;
|
|
2393
|
-
this._metadataStore = _metadataStore;
|
|
2394
|
-
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2395
|
-
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2396
|
-
this._invitationCreated = new import_async9.Event();
|
|
2397
|
-
this._invitationAccepted = new import_async9.Event();
|
|
2398
|
-
this._removedCreated = new import_async9.Event();
|
|
2399
|
-
this._removedAccepted = new import_async9.Event();
|
|
2400
|
-
this._saved = new import_async9.Event();
|
|
2401
|
-
this._persistentInvitationsLoadedEvent = new import_async9.Event();
|
|
2402
|
-
this._persistentInvitationsLoaded = false;
|
|
2448
|
+
constructor(_invitationsManager) {
|
|
2449
|
+
this._invitationsManager = _invitationsManager;
|
|
2403
2450
|
}
|
|
2404
2451
|
// TODO(burdon): Guest/host label.
|
|
2405
2452
|
getLoggingContext() {
|
|
2406
2453
|
return {};
|
|
2407
2454
|
}
|
|
2408
2455
|
createInvitation(options) {
|
|
2409
|
-
|
|
2410
|
-
const savePersistentInvitationCtx = new import_context6.Context();
|
|
2411
|
-
const existingInvitation = this._createInvitations.get(options.invitationId);
|
|
2412
|
-
if (existingInvitation) {
|
|
2413
|
-
invitation = existingInvitation;
|
|
2414
|
-
} else {
|
|
2415
|
-
const handler = this._getHandler(options);
|
|
2416
|
-
invitation = this._invitationsHandler.createInvitation(handler, options);
|
|
2417
|
-
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
2418
|
-
this._invitationCreated.emit(invitation.get());
|
|
2419
|
-
}
|
|
2456
|
+
const invitation = this._invitationsManager.createInvitation(options);
|
|
2420
2457
|
return new import_codec_protobuf8.Stream(({ next, close }) => {
|
|
2421
|
-
|
|
2422
|
-
(0, import_async9.scheduleTask)(savePersistentInvitationCtx, async () => {
|
|
2423
|
-
try {
|
|
2424
|
-
await this._metadataStore.addInvitation(invitation.get());
|
|
2425
|
-
this._saved.emit(invitation.get());
|
|
2426
|
-
} catch (err) {
|
|
2427
|
-
close(err);
|
|
2428
|
-
}
|
|
2429
|
-
});
|
|
2430
|
-
}
|
|
2431
|
-
invitation.subscribe((invitation2) => {
|
|
2432
|
-
next(invitation2);
|
|
2433
|
-
}, async (err) => {
|
|
2434
|
-
await savePersistentInvitationCtx.dispose();
|
|
2435
|
-
close(err);
|
|
2436
|
-
}, async () => {
|
|
2437
|
-
close();
|
|
2438
|
-
if (invitation.get().persistent) {
|
|
2439
|
-
await savePersistentInvitationCtx.dispose();
|
|
2440
|
-
await this._metadataStore.removeInvitation(invitation.get().invitationId);
|
|
2441
|
-
}
|
|
2442
|
-
this._createInvitations.delete(invitation.get().invitationId);
|
|
2443
|
-
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2444
|
-
this._removedCreated.emit(invitation.get());
|
|
2445
|
-
}
|
|
2446
|
-
});
|
|
2458
|
+
invitation.subscribe(next, close, close);
|
|
2447
2459
|
});
|
|
2448
2460
|
}
|
|
2449
|
-
|
|
2450
|
-
const
|
|
2451
|
-
const freshInvitations = persistentInvitations.filter(async (invitation) => !invitationExpired(invitation));
|
|
2452
|
-
const cInvitations = freshInvitations.map((persistentInvitation) => {
|
|
2453
|
-
(0, import_invariant7.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2454
|
-
F: __dxlog_file8,
|
|
2455
|
-
L: 109,
|
|
2456
|
-
S: this,
|
|
2457
|
-
A: [
|
|
2458
|
-
"!this._createInvitations.get(persistentInvitation.invitationId)",
|
|
2459
|
-
"'invitation already exists'"
|
|
2460
|
-
]
|
|
2461
|
-
});
|
|
2462
|
-
const handler = this._getHandler(persistentInvitation);
|
|
2463
|
-
const invitation = this._invitationsHandler.createInvitation(handler, persistentInvitation);
|
|
2464
|
-
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
2465
|
-
this._invitationCreated.emit(invitation.get());
|
|
2466
|
-
return persistentInvitation;
|
|
2467
|
-
});
|
|
2468
|
-
this._persistentInvitationsLoadedEvent.emit();
|
|
2469
|
-
this._persistentInvitationsLoaded = true;
|
|
2470
|
-
return {
|
|
2471
|
-
invitations: cInvitations
|
|
2472
|
-
};
|
|
2473
|
-
}
|
|
2474
|
-
acceptInvitation({ invitation: options, deviceProfile }) {
|
|
2475
|
-
let invitation;
|
|
2476
|
-
if (deviceProfile) {
|
|
2477
|
-
(0, import_invariant7.invariant)(options.kind === import_services5.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2478
|
-
F: __dxlog_file8,
|
|
2479
|
-
L: 127,
|
|
2480
|
-
S: this,
|
|
2481
|
-
A: [
|
|
2482
|
-
"options.kind === Invitation.Kind.DEVICE",
|
|
2483
|
-
"'deviceProfile provided for non-device invitation'"
|
|
2484
|
-
]
|
|
2485
|
-
});
|
|
2486
|
-
}
|
|
2487
|
-
const existingInvitation = this._acceptInvitations.get(options.invitationId);
|
|
2488
|
-
if (existingInvitation) {
|
|
2489
|
-
invitation = existingInvitation;
|
|
2490
|
-
} else {
|
|
2491
|
-
const handler = this._getHandler(options);
|
|
2492
|
-
invitation = this._invitationsHandler.acceptInvitation(handler, options, deviceProfile);
|
|
2493
|
-
this._acceptInvitations.set(invitation.get().invitationId, invitation);
|
|
2494
|
-
this._invitationAccepted.emit(invitation.get());
|
|
2495
|
-
}
|
|
2461
|
+
acceptInvitation(request) {
|
|
2462
|
+
const invitation = this._invitationsManager.acceptInvitation(request);
|
|
2496
2463
|
return new import_codec_protobuf8.Stream(({ next, close }) => {
|
|
2497
|
-
invitation.subscribe(
|
|
2498
|
-
next(invitation2);
|
|
2499
|
-
}, (err) => {
|
|
2500
|
-
close(err);
|
|
2501
|
-
}, () => {
|
|
2502
|
-
close();
|
|
2503
|
-
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2504
|
-
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2505
|
-
this._removedAccepted.emit(invitation.get());
|
|
2506
|
-
}
|
|
2507
|
-
});
|
|
2464
|
+
invitation.subscribe(next, close, close);
|
|
2508
2465
|
});
|
|
2509
2466
|
}
|
|
2510
|
-
async authenticate(
|
|
2511
|
-
|
|
2512
|
-
F: __dxlog_file8,
|
|
2513
|
-
L: 160,
|
|
2514
|
-
S: this,
|
|
2515
|
-
C: (f, a) => f(...a)
|
|
2516
|
-
});
|
|
2517
|
-
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2518
|
-
F: __dxlog_file8,
|
|
2519
|
-
L: 161,
|
|
2520
|
-
S: this,
|
|
2521
|
-
A: [
|
|
2522
|
-
"invitationId",
|
|
2523
|
-
""
|
|
2524
|
-
]
|
|
2525
|
-
});
|
|
2526
|
-
const observable = this._acceptInvitations.get(invitationId);
|
|
2527
|
-
if (!observable) {
|
|
2528
|
-
import_log6.log.warn("invalid invitation", {
|
|
2529
|
-
invitationId
|
|
2530
|
-
}, {
|
|
2531
|
-
F: __dxlog_file8,
|
|
2532
|
-
L: 164,
|
|
2533
|
-
S: this,
|
|
2534
|
-
C: (f, a) => f(...a)
|
|
2535
|
-
});
|
|
2536
|
-
} else {
|
|
2537
|
-
await observable.authenticate(authCode);
|
|
2538
|
-
}
|
|
2467
|
+
async authenticate(request) {
|
|
2468
|
+
return this._invitationsManager.authenticate(request);
|
|
2539
2469
|
}
|
|
2540
|
-
async cancelInvitation(
|
|
2541
|
-
|
|
2542
|
-
invitationId
|
|
2543
|
-
}, {
|
|
2544
|
-
F: __dxlog_file8,
|
|
2545
|
-
L: 171,
|
|
2546
|
-
S: this,
|
|
2547
|
-
C: (f, a) => f(...a)
|
|
2548
|
-
});
|
|
2549
|
-
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2550
|
-
F: __dxlog_file8,
|
|
2551
|
-
L: 172,
|
|
2552
|
-
S: this,
|
|
2553
|
-
A: [
|
|
2554
|
-
"invitationId",
|
|
2555
|
-
""
|
|
2556
|
-
]
|
|
2557
|
-
});
|
|
2558
|
-
const created = this._createInvitations.get(invitationId);
|
|
2559
|
-
const accepted = this._acceptInvitations.get(invitationId);
|
|
2560
|
-
if (created) {
|
|
2561
|
-
await created.cancel();
|
|
2562
|
-
this._createInvitations.delete(invitationId);
|
|
2563
|
-
this._removedCreated.emit(created.get());
|
|
2564
|
-
if (created.get().persistent) {
|
|
2565
|
-
await this._metadataStore.removeInvitation(created.get().invitationId);
|
|
2566
|
-
}
|
|
2567
|
-
} else if (accepted) {
|
|
2568
|
-
await accepted.cancel();
|
|
2569
|
-
this._acceptInvitations.delete(invitationId);
|
|
2570
|
-
this._removedAccepted.emit(accepted.get());
|
|
2571
|
-
}
|
|
2470
|
+
async cancelInvitation(request) {
|
|
2471
|
+
return this._invitationsManager.cancelInvitation(request);
|
|
2572
2472
|
}
|
|
2573
2473
|
queryInvitations() {
|
|
2574
2474
|
return new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
2575
|
-
this.
|
|
2475
|
+
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
2576
2476
|
next({
|
|
2577
2477
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2578
2478
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
@@ -2581,7 +2481,7 @@ var InvitationsServiceImpl = class {
|
|
|
2581
2481
|
]
|
|
2582
2482
|
});
|
|
2583
2483
|
});
|
|
2584
|
-
this.
|
|
2484
|
+
this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
|
|
2585
2485
|
next({
|
|
2586
2486
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2587
2487
|
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
@@ -2590,7 +2490,7 @@ var InvitationsServiceImpl = class {
|
|
|
2590
2490
|
]
|
|
2591
2491
|
});
|
|
2592
2492
|
});
|
|
2593
|
-
this.
|
|
2493
|
+
this._invitationsManager.removedCreated.on(ctx, (invitation) => {
|
|
2594
2494
|
next({
|
|
2595
2495
|
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2596
2496
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
@@ -2599,7 +2499,7 @@ var InvitationsServiceImpl = class {
|
|
|
2599
2499
|
]
|
|
2600
2500
|
});
|
|
2601
2501
|
});
|
|
2602
|
-
this.
|
|
2502
|
+
this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
|
|
2603
2503
|
next({
|
|
2604
2504
|
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2605
2505
|
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
@@ -2608,7 +2508,7 @@ var InvitationsServiceImpl = class {
|
|
|
2608
2508
|
]
|
|
2609
2509
|
});
|
|
2610
2510
|
});
|
|
2611
|
-
this.
|
|
2511
|
+
this._invitationsManager.saved.on(ctx, (invitation) => {
|
|
2612
2512
|
next({
|
|
2613
2513
|
action: import_services5.QueryInvitationsResponse.Action.SAVED,
|
|
2614
2514
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
@@ -2620,32 +2520,25 @@ var InvitationsServiceImpl = class {
|
|
|
2620
2520
|
next({
|
|
2621
2521
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2622
2522
|
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2623
|
-
invitations:
|
|
2523
|
+
invitations: this._invitationsManager.getCreatedInvitations(),
|
|
2624
2524
|
existing: true
|
|
2625
2525
|
});
|
|
2626
2526
|
next({
|
|
2627
2527
|
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2628
2528
|
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2629
|
-
invitations:
|
|
2529
|
+
invitations: this._invitationsManager.getAcceptedInvitations(),
|
|
2630
2530
|
existing: true
|
|
2631
2531
|
});
|
|
2632
|
-
|
|
2532
|
+
this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
|
|
2633
2533
|
next({
|
|
2634
2534
|
action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
2635
2535
|
type: import_services5.QueryInvitationsResponse.Type.CREATED
|
|
2636
2536
|
});
|
|
2637
|
-
}
|
|
2638
|
-
this._persistentInvitationsLoadedEvent.on(ctx, () => {
|
|
2639
|
-
next({
|
|
2640
|
-
action: import_services5.QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
2641
|
-
type: import_services5.QueryInvitationsResponse.Type.CREATED
|
|
2642
|
-
});
|
|
2643
|
-
});
|
|
2644
|
-
}
|
|
2537
|
+
});
|
|
2645
2538
|
});
|
|
2646
2539
|
}
|
|
2647
2540
|
};
|
|
2648
|
-
var
|
|
2541
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
2649
2542
|
var SpaceInvitationProtocol = class {
|
|
2650
2543
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
2651
2544
|
this._spaceManager = _spaceManager;
|
|
@@ -2666,8 +2559,8 @@ var SpaceInvitationProtocol = class {
|
|
|
2666
2559
|
};
|
|
2667
2560
|
}
|
|
2668
2561
|
async admit(request, guestProfile) {
|
|
2669
|
-
(0,
|
|
2670
|
-
F:
|
|
2562
|
+
(0, import_invariant7.invariant)(this._spaceKey, void 0, {
|
|
2563
|
+
F: __dxlog_file8,
|
|
2671
2564
|
L: 47,
|
|
2672
2565
|
S: this,
|
|
2673
2566
|
A: [
|
|
@@ -2676,8 +2569,8 @@ var SpaceInvitationProtocol = class {
|
|
|
2676
2569
|
]
|
|
2677
2570
|
});
|
|
2678
2571
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2679
|
-
(0,
|
|
2680
|
-
F:
|
|
2572
|
+
(0, import_invariant7.invariant)(space, void 0, {
|
|
2573
|
+
F: __dxlog_file8,
|
|
2681
2574
|
L: 49,
|
|
2682
2575
|
S: this,
|
|
2683
2576
|
A: [
|
|
@@ -2685,8 +2578,8 @@ var SpaceInvitationProtocol = class {
|
|
|
2685
2578
|
""
|
|
2686
2579
|
]
|
|
2687
2580
|
});
|
|
2688
|
-
(0,
|
|
2689
|
-
F:
|
|
2581
|
+
(0, import_invariant7.invariant)(request.space, void 0, {
|
|
2582
|
+
F: __dxlog_file8,
|
|
2690
2583
|
L: 51,
|
|
2691
2584
|
S: this,
|
|
2692
2585
|
A: [
|
|
@@ -2695,18 +2588,18 @@ var SpaceInvitationProtocol = class {
|
|
|
2695
2588
|
]
|
|
2696
2589
|
});
|
|
2697
2590
|
const { identityKey, deviceKey } = request.space;
|
|
2698
|
-
(0,
|
|
2591
|
+
(0, import_log6.log)("writing guest credentials", {
|
|
2699
2592
|
host: this._signingContext.deviceKey,
|
|
2700
2593
|
guest: deviceKey
|
|
2701
2594
|
}, {
|
|
2702
|
-
F:
|
|
2595
|
+
F: __dxlog_file8,
|
|
2703
2596
|
L: 54,
|
|
2704
2597
|
S: this,
|
|
2705
2598
|
C: (f, a) => f(...a)
|
|
2706
2599
|
});
|
|
2707
2600
|
const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
2708
|
-
(0,
|
|
2709
|
-
F:
|
|
2601
|
+
(0, import_invariant7.invariant)(credentials[0].credential, void 0, {
|
|
2602
|
+
F: __dxlog_file8,
|
|
2710
2603
|
L: 65,
|
|
2711
2604
|
S: this,
|
|
2712
2605
|
A: [
|
|
@@ -2715,8 +2608,8 @@ var SpaceInvitationProtocol = class {
|
|
|
2715
2608
|
]
|
|
2716
2609
|
});
|
|
2717
2610
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2718
|
-
(0,
|
|
2719
|
-
F:
|
|
2611
|
+
(0, import_invariant7.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2612
|
+
F: __dxlog_file8,
|
|
2720
2613
|
L: 67,
|
|
2721
2614
|
S: this,
|
|
2722
2615
|
A: [
|
|
@@ -2755,8 +2648,8 @@ var SpaceInvitationProtocol = class {
|
|
|
2755
2648
|
};
|
|
2756
2649
|
}
|
|
2757
2650
|
async accept(response) {
|
|
2758
|
-
(0,
|
|
2759
|
-
F:
|
|
2651
|
+
(0, import_invariant7.invariant)(response.space, void 0, {
|
|
2652
|
+
F: __dxlog_file8,
|
|
2760
2653
|
L: 107,
|
|
2761
2654
|
S: this,
|
|
2762
2655
|
A: [
|
|
@@ -2766,8 +2659,8 @@ var SpaceInvitationProtocol = class {
|
|
|
2766
2659
|
});
|
|
2767
2660
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
2768
2661
|
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
2769
|
-
(0,
|
|
2770
|
-
F:
|
|
2662
|
+
(0, import_invariant7.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2663
|
+
F: __dxlog_file8,
|
|
2771
2664
|
L: 110,
|
|
2772
2665
|
S: this,
|
|
2773
2666
|
A: [
|
|
@@ -2775,8 +2668,8 @@ var SpaceInvitationProtocol = class {
|
|
|
2775
2668
|
"'Invalid credential'"
|
|
2776
2669
|
]
|
|
2777
2670
|
});
|
|
2778
|
-
(0,
|
|
2779
|
-
F:
|
|
2671
|
+
(0, import_invariant7.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2672
|
+
F: __dxlog_file8,
|
|
2780
2673
|
L: 111,
|
|
2781
2674
|
S: this,
|
|
2782
2675
|
A: [
|
|
@@ -2799,6 +2692,221 @@ var SpaceInvitationProtocol = class {
|
|
|
2799
2692
|
};
|
|
2800
2693
|
}
|
|
2801
2694
|
};
|
|
2695
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
2696
|
+
var InvitationsManager = class {
|
|
2697
|
+
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
2698
|
+
this._invitationsHandler = _invitationsHandler;
|
|
2699
|
+
this._getHandler = _getHandler;
|
|
2700
|
+
this._metadataStore = _metadataStore;
|
|
2701
|
+
this._createInvitations = /* @__PURE__ */ new Map();
|
|
2702
|
+
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
2703
|
+
this.invitationCreated = new import_async9.Event();
|
|
2704
|
+
this.invitationAccepted = new import_async9.Event();
|
|
2705
|
+
this.removedCreated = new import_async9.Event();
|
|
2706
|
+
this.removedAccepted = new import_async9.Event();
|
|
2707
|
+
this.saved = new import_async9.Event();
|
|
2708
|
+
this._persistentInvitationsLoadedEvent = new import_async9.Event();
|
|
2709
|
+
this._persistentInvitationsLoaded = false;
|
|
2710
|
+
}
|
|
2711
|
+
createInvitation(options) {
|
|
2712
|
+
const existingInvitation = this._createInvitations.get(options.invitationId);
|
|
2713
|
+
if (existingInvitation) {
|
|
2714
|
+
return existingInvitation;
|
|
2715
|
+
}
|
|
2716
|
+
const handler = this._getHandler(options);
|
|
2717
|
+
const invitation = this._invitationsHandler.createInvitation(handler, options);
|
|
2718
|
+
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
2719
|
+
this.invitationCreated.emit(invitation.get());
|
|
2720
|
+
const saveInvitationTask = invitation.get().persistent ? this._safePersistInBackground(invitation) : Promise.resolve();
|
|
2721
|
+
this._onInvitationComplete(invitation, async () => {
|
|
2722
|
+
this._createInvitations.delete(invitation.get().invitationId);
|
|
2723
|
+
this.removedCreated.emit(invitation.get());
|
|
2724
|
+
if (invitation.get().persistent) {
|
|
2725
|
+
await saveInvitationTask;
|
|
2726
|
+
await this._safeDeleteInvitation(invitation.get());
|
|
2727
|
+
}
|
|
2728
|
+
});
|
|
2729
|
+
return invitation;
|
|
2730
|
+
}
|
|
2731
|
+
async loadPersistentInvitations() {
|
|
2732
|
+
if (this._persistentInvitationsLoaded) {
|
|
2733
|
+
const invitations = this.getCreatedInvitations().filter((i) => i.persistent);
|
|
2734
|
+
return {
|
|
2735
|
+
invitations
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2738
|
+
try {
|
|
2739
|
+
const persistentInvitations = this._metadataStore.getInvitations();
|
|
2740
|
+
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
2741
|
+
const cInvitations = freshInvitations.map((persistentInvitation) => {
|
|
2742
|
+
(0, import_invariant8.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2743
|
+
F: __dxlog_file9,
|
|
2744
|
+
L: 82,
|
|
2745
|
+
S: this,
|
|
2746
|
+
A: [
|
|
2747
|
+
"!this._createInvitations.get(persistentInvitation.invitationId)",
|
|
2748
|
+
"'invitation already exists'"
|
|
2749
|
+
]
|
|
2750
|
+
});
|
|
2751
|
+
return this.createInvitation({
|
|
2752
|
+
...persistentInvitation,
|
|
2753
|
+
persistent: false
|
|
2754
|
+
}).get();
|
|
2755
|
+
});
|
|
2756
|
+
return {
|
|
2757
|
+
invitations: cInvitations
|
|
2758
|
+
};
|
|
2759
|
+
} catch (err) {
|
|
2760
|
+
import_log7.log.catch(err, void 0, {
|
|
2761
|
+
F: __dxlog_file9,
|
|
2762
|
+
L: 88,
|
|
2763
|
+
S: this,
|
|
2764
|
+
C: (f, a) => f(...a)
|
|
2765
|
+
});
|
|
2766
|
+
return {
|
|
2767
|
+
invitations: []
|
|
2768
|
+
};
|
|
2769
|
+
} finally {
|
|
2770
|
+
this._persistentInvitationsLoadedEvent.emit();
|
|
2771
|
+
this._persistentInvitationsLoaded = true;
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
acceptInvitation(request) {
|
|
2775
|
+
const options = request.invitation;
|
|
2776
|
+
const existingInvitation = this._acceptInvitations.get(options.invitationId);
|
|
2777
|
+
if (existingInvitation) {
|
|
2778
|
+
return existingInvitation;
|
|
2779
|
+
}
|
|
2780
|
+
const handler = this._getHandler(options);
|
|
2781
|
+
const invitation = this._invitationsHandler.acceptInvitation(handler, options, request.deviceProfile);
|
|
2782
|
+
this._acceptInvitations.set(invitation.get().invitationId, invitation);
|
|
2783
|
+
this.invitationAccepted.emit(invitation.get());
|
|
2784
|
+
this._onInvitationComplete(invitation, () => {
|
|
2785
|
+
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2786
|
+
this.removedAccepted.emit(invitation.get());
|
|
2787
|
+
});
|
|
2788
|
+
return invitation;
|
|
2789
|
+
}
|
|
2790
|
+
async authenticate({ invitationId, authCode }) {
|
|
2791
|
+
(0, import_log7.log)("authenticating...", void 0, {
|
|
2792
|
+
F: __dxlog_file9,
|
|
2793
|
+
L: 117,
|
|
2794
|
+
S: this,
|
|
2795
|
+
C: (f, a) => f(...a)
|
|
2796
|
+
});
|
|
2797
|
+
(0, import_invariant8.invariant)(invitationId, void 0, {
|
|
2798
|
+
F: __dxlog_file9,
|
|
2799
|
+
L: 118,
|
|
2800
|
+
S: this,
|
|
2801
|
+
A: [
|
|
2802
|
+
"invitationId",
|
|
2803
|
+
""
|
|
2804
|
+
]
|
|
2805
|
+
});
|
|
2806
|
+
const observable = this._acceptInvitations.get(invitationId);
|
|
2807
|
+
if (!observable) {
|
|
2808
|
+
import_log7.log.warn("invalid invitation", {
|
|
2809
|
+
invitationId
|
|
2810
|
+
}, {
|
|
2811
|
+
F: __dxlog_file9,
|
|
2812
|
+
L: 121,
|
|
2813
|
+
S: this,
|
|
2814
|
+
C: (f, a) => f(...a)
|
|
2815
|
+
});
|
|
2816
|
+
} else {
|
|
2817
|
+
await observable.authenticate(authCode);
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
async cancelInvitation({ invitationId }) {
|
|
2821
|
+
(0, import_log7.log)("cancelInvitation...", {
|
|
2822
|
+
invitationId
|
|
2823
|
+
}, {
|
|
2824
|
+
F: __dxlog_file9,
|
|
2825
|
+
L: 128,
|
|
2826
|
+
S: this,
|
|
2827
|
+
C: (f, a) => f(...a)
|
|
2828
|
+
});
|
|
2829
|
+
(0, import_invariant8.invariant)(invitationId, void 0, {
|
|
2830
|
+
F: __dxlog_file9,
|
|
2831
|
+
L: 129,
|
|
2832
|
+
S: this,
|
|
2833
|
+
A: [
|
|
2834
|
+
"invitationId",
|
|
2835
|
+
""
|
|
2836
|
+
]
|
|
2837
|
+
});
|
|
2838
|
+
const created = this._createInvitations.get(invitationId);
|
|
2839
|
+
if (created) {
|
|
2840
|
+
if (created.get().persistent) {
|
|
2841
|
+
await this._metadataStore.removeInvitation(invitationId);
|
|
2842
|
+
}
|
|
2843
|
+
await created.cancel();
|
|
2844
|
+
this._createInvitations.delete(invitationId);
|
|
2845
|
+
this.removedCreated.emit(created.get());
|
|
2846
|
+
return;
|
|
2847
|
+
}
|
|
2848
|
+
const accepted = this._acceptInvitations.get(invitationId);
|
|
2849
|
+
if (accepted) {
|
|
2850
|
+
await accepted.cancel();
|
|
2851
|
+
this._acceptInvitations.delete(invitationId);
|
|
2852
|
+
this.removedAccepted.emit(accepted.get());
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
getCreatedInvitations() {
|
|
2856
|
+
return [
|
|
2857
|
+
...this._createInvitations.values()
|
|
2858
|
+
].map((i) => i.get());
|
|
2859
|
+
}
|
|
2860
|
+
getAcceptedInvitations() {
|
|
2861
|
+
return [
|
|
2862
|
+
...this._acceptInvitations.values()
|
|
2863
|
+
].map((i) => i.get());
|
|
2864
|
+
}
|
|
2865
|
+
onPersistentInvitationsLoaded(ctx, callback) {
|
|
2866
|
+
if (this._persistentInvitationsLoaded) {
|
|
2867
|
+
callback();
|
|
2868
|
+
} else {
|
|
2869
|
+
this._persistentInvitationsLoadedEvent.once(ctx, () => callback());
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
_safePersistInBackground(invitation) {
|
|
2873
|
+
return new Promise((resolve) => {
|
|
2874
|
+
setTimeout(async () => {
|
|
2875
|
+
try {
|
|
2876
|
+
await this._metadataStore.addInvitation(invitation.get());
|
|
2877
|
+
this.saved.emit(invitation.get());
|
|
2878
|
+
} catch (err) {
|
|
2879
|
+
import_log7.log.catch(err, void 0, {
|
|
2880
|
+
F: __dxlog_file9,
|
|
2881
|
+
L: 173,
|
|
2882
|
+
S: this,
|
|
2883
|
+
C: (f, a) => f(...a)
|
|
2884
|
+
});
|
|
2885
|
+
await invitation.cancel();
|
|
2886
|
+
} finally {
|
|
2887
|
+
resolve();
|
|
2888
|
+
}
|
|
2889
|
+
});
|
|
2890
|
+
});
|
|
2891
|
+
}
|
|
2892
|
+
async _safeDeleteInvitation(invitation) {
|
|
2893
|
+
try {
|
|
2894
|
+
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
2895
|
+
} catch (err) {
|
|
2896
|
+
import_log7.log.catch(err, void 0, {
|
|
2897
|
+
F: __dxlog_file9,
|
|
2898
|
+
L: 186,
|
|
2899
|
+
S: this,
|
|
2900
|
+
C: (f, a) => f(...a)
|
|
2901
|
+
});
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
_onInvitationComplete(invitation, callback) {
|
|
2905
|
+
invitation.subscribe(() => {
|
|
2906
|
+
}, () => {
|
|
2907
|
+
}, callback);
|
|
2908
|
+
}
|
|
2909
|
+
};
|
|
2802
2910
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
2803
2911
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2804
2912
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -2915,7 +3023,7 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
|
2915
3023
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
2916
3024
|
var NotarizationPlugin = class {
|
|
2917
3025
|
constructor() {
|
|
2918
|
-
this._ctx = new
|
|
3026
|
+
this._ctx = new import_context7.Context();
|
|
2919
3027
|
this._extensionOpened = new import_async12.Event();
|
|
2920
3028
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2921
3029
|
this._processedCredentials = new import_util5.ComplexSet(import_keys8.PublicKey.hash);
|
|
@@ -3040,7 +3148,7 @@ var NotarizationPlugin = class {
|
|
|
3040
3148
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
3041
3149
|
try {
|
|
3042
3150
|
await Promise.race([
|
|
3043
|
-
(0,
|
|
3151
|
+
(0, import_context7.rejectOnDispose)(ctx),
|
|
3044
3152
|
allNotarized,
|
|
3045
3153
|
errors.wait()
|
|
3046
3154
|
]);
|
|
@@ -3179,7 +3287,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3179
3287
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
3180
3288
|
var DataSpace = class {
|
|
3181
3289
|
constructor(params) {
|
|
3182
|
-
this._ctx = new
|
|
3290
|
+
this._ctx = new import_context6.Context();
|
|
3183
3291
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3184
3292
|
this._cache = void 0;
|
|
3185
3293
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
@@ -3252,7 +3360,7 @@ var DataSpace = class {
|
|
|
3252
3360
|
await this._notarizationPlugin.open();
|
|
3253
3361
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3254
3362
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3255
|
-
await this._inner.open(new
|
|
3363
|
+
await this._inner.open(new import_context6.Context());
|
|
3256
3364
|
this._state = import_services7.SpaceState.CONTROL_ONLY;
|
|
3257
3365
|
(0, import_log8.log)("new state", {
|
|
3258
3366
|
state: import_services7.SpaceState[this._state]
|
|
@@ -3281,7 +3389,7 @@ var DataSpace = class {
|
|
|
3281
3389
|
C: (f, a) => f(...a)
|
|
3282
3390
|
});
|
|
3283
3391
|
await this._ctx.dispose();
|
|
3284
|
-
this._ctx = new
|
|
3392
|
+
this._ctx = new import_context6.Context();
|
|
3285
3393
|
await this.authVerifier.close();
|
|
3286
3394
|
await this._inner.close();
|
|
3287
3395
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -3305,7 +3413,7 @@ var DataSpace = class {
|
|
|
3305
3413
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3306
3414
|
await this.initializeDataPipeline();
|
|
3307
3415
|
} catch (err) {
|
|
3308
|
-
if (err instanceof import_protocols7.CancelledError || err instanceof
|
|
3416
|
+
if (err instanceof import_protocols7.CancelledError || err instanceof import_context6.ContextDisposedError) {
|
|
3309
3417
|
(0, import_log8.log)("data pipeline initialization cancelled", err, {
|
|
3310
3418
|
F: __dxlog_file11,
|
|
3311
3419
|
L: 245,
|
|
@@ -3352,7 +3460,7 @@ var DataSpace = class {
|
|
|
3352
3460
|
await this._initializeAndReadControlPipeline();
|
|
3353
3461
|
await (0, import_async10.sleep)(1);
|
|
3354
3462
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
3355
|
-
await (0,
|
|
3463
|
+
await (0, import_context6.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3356
3464
|
(0, import_log8.log)("data pipeline ready", void 0, {
|
|
3357
3465
|
F: __dxlog_file11,
|
|
3358
3466
|
L: 279,
|
|
@@ -3387,7 +3495,7 @@ var DataSpace = class {
|
|
|
3387
3495
|
});
|
|
3388
3496
|
this.stateUpdate.emit();
|
|
3389
3497
|
if (!this.notarizationPlugin.hasWriter) {
|
|
3390
|
-
this.notarizationPlugin.setWriter((0,
|
|
3498
|
+
this.notarizationPlugin.setWriter((0, import_echo_pipeline2.createMappedFeedWriter)((credential) => ({
|
|
3391
3499
|
credential: {
|
|
3392
3500
|
credential
|
|
3393
3501
|
}
|
|
@@ -3453,7 +3561,7 @@ var DataSpace = class {
|
|
|
3453
3561
|
queueMicrotask(async () => {
|
|
3454
3562
|
try {
|
|
3455
3563
|
await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
3456
|
-
await (0,
|
|
3564
|
+
await (0, import_context6.cancelWithContext)(this._ctx, handle.whenReady());
|
|
3457
3565
|
});
|
|
3458
3566
|
if (this._ctx.disposed) {
|
|
3459
3567
|
return;
|
|
@@ -3467,7 +3575,7 @@ var DataSpace = class {
|
|
|
3467
3575
|
});
|
|
3468
3576
|
}
|
|
3469
3577
|
} catch (err) {
|
|
3470
|
-
if (err instanceof
|
|
3578
|
+
if (err instanceof import_context6.ContextDisposedError) {
|
|
3471
3579
|
return;
|
|
3472
3580
|
}
|
|
3473
3581
|
import_log8.log.warn("error loading automerge root doc", {
|
|
@@ -3527,7 +3635,7 @@ var DataSpace = class {
|
|
|
3527
3635
|
{
|
|
3528
3636
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3529
3637
|
const rootHandle = this._automergeHost.repo.find(currentRootUrl);
|
|
3530
|
-
await (0,
|
|
3638
|
+
await (0, import_context6.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3531
3639
|
const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
|
|
3532
3640
|
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3533
3641
|
F: __dxlog_file11,
|
|
@@ -3556,7 +3664,7 @@ var DataSpace = class {
|
|
|
3556
3664
|
});
|
|
3557
3665
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3558
3666
|
const rootHandle = this._automergeHost.repo.find(currentRootUrl);
|
|
3559
|
-
await (0,
|
|
3667
|
+
await (0, import_context6.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3560
3668
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3561
3669
|
const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_db.TYPE_PROPERTIES);
|
|
3562
3670
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
@@ -3585,7 +3693,7 @@ var DataSpace = class {
|
|
|
3585
3693
|
""
|
|
3586
3694
|
]
|
|
3587
3695
|
});
|
|
3588
|
-
const docLoader = new
|
|
3696
|
+
const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(this.key, this._automergeHost.repo);
|
|
3589
3697
|
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
3590
3698
|
rootUrl: newRoot.url
|
|
3591
3699
|
});
|
|
@@ -3784,7 +3892,7 @@ var DataSpaceManager = class {
|
|
|
3784
3892
|
this._signingContext = _signingContext;
|
|
3785
3893
|
this._feedStore = _feedStore;
|
|
3786
3894
|
this._automergeHost = _automergeHost;
|
|
3787
|
-
this._ctx = new
|
|
3895
|
+
this._ctx = new import_context8.Context();
|
|
3788
3896
|
this.updated = new import_async13.Event();
|
|
3789
3897
|
this._spaces = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
|
|
3790
3898
|
this._isOpen = false;
|
|
@@ -3973,7 +4081,7 @@ var DataSpaceManager = class {
|
|
|
3973
4081
|
* TODO(dmaretskyi): Consider removing.
|
|
3974
4082
|
*/
|
|
3975
4083
|
async waitUntilSpaceReady(spaceKey) {
|
|
3976
|
-
await (0,
|
|
4084
|
+
await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3977
4085
|
const space = this._spaces.get(spaceKey);
|
|
3978
4086
|
return !!space && space.state === import_services8.SpaceState.READY;
|
|
3979
4087
|
}));
|
|
@@ -4396,7 +4504,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4396
4504
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4397
4505
|
}
|
|
4398
4506
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4399
|
-
var ServiceContext = class extends
|
|
4507
|
+
var ServiceContext = class extends import_context9.Resource {
|
|
4400
4508
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
4401
4509
|
super();
|
|
4402
4510
|
this.storage = storage;
|
|
@@ -4407,8 +4515,8 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4407
4515
|
this.initialized = new import_async15.Trigger();
|
|
4408
4516
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4409
4517
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
4410
|
-
this.metadataStore = new
|
|
4411
|
-
this.snapshotStore = new
|
|
4518
|
+
this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
|
|
4519
|
+
this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4412
4520
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
4413
4521
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
4414
4522
|
this.feedStore = new import_feed_store4.FeedStore({
|
|
@@ -4416,12 +4524,12 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4416
4524
|
root: storage.createDirectory("feeds"),
|
|
4417
4525
|
signer: this.keyring,
|
|
4418
4526
|
hypercore: {
|
|
4419
|
-
valueEncoding:
|
|
4527
|
+
valueEncoding: import_echo_pipeline4.valueEncoding,
|
|
4420
4528
|
stats: true
|
|
4421
4529
|
}
|
|
4422
4530
|
})
|
|
4423
4531
|
});
|
|
4424
|
-
this.spaceManager = new
|
|
4532
|
+
this.spaceManager = new import_echo_pipeline4.SpaceManager({
|
|
4425
4533
|
feedStore: this.feedStore,
|
|
4426
4534
|
networkManager: this.networkManager,
|
|
4427
4535
|
blobStore: this.blobStore,
|
|
@@ -4432,26 +4540,31 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4432
4540
|
this.indexMetadata = new import_indexing.IndexMetadataStore({
|
|
4433
4541
|
db: level.sublevel("index-metadata")
|
|
4434
4542
|
});
|
|
4435
|
-
this.automergeHost = new
|
|
4543
|
+
this.automergeHost = new import_echo_pipeline4.AutomergeHost({
|
|
4436
4544
|
directory: storage.createDirectory("automerge"),
|
|
4437
|
-
|
|
4545
|
+
db: level.sublevel("automerge"),
|
|
4546
|
+
storageCallbacks: (0, import_indexing.createStorageCallbacks)({
|
|
4547
|
+
host: () => this.automergeHost,
|
|
4548
|
+
metadata: this.indexMetadata
|
|
4549
|
+
})
|
|
4438
4550
|
});
|
|
4439
4551
|
this.indexer = new import_indexing.Indexer({
|
|
4440
4552
|
indexStore: new import_indexing.IndexStore({
|
|
4441
|
-
|
|
4553
|
+
db: level.sublevel("index-storage")
|
|
4442
4554
|
}),
|
|
4443
4555
|
metadataStore: this.indexMetadata,
|
|
4444
4556
|
loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
|
|
4445
4557
|
getAllDocuments: createDocumentsIterator(this.automergeHost)
|
|
4446
4558
|
});
|
|
4447
4559
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4560
|
+
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
4448
4561
|
this._handlerFactories.set(import_services10.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4449
4562
|
}
|
|
4450
4563
|
async _open(ctx) {
|
|
4451
4564
|
await this._checkStorageVersion();
|
|
4452
4565
|
(0, import_log12.log)("opening...", void 0, {
|
|
4453
4566
|
F: __dxlog_file14,
|
|
4454
|
-
L:
|
|
4567
|
+
L: 164,
|
|
4455
4568
|
S: this,
|
|
4456
4569
|
C: (f, a) => f(...a)
|
|
4457
4570
|
});
|
|
@@ -4459,29 +4572,39 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4459
4572
|
id: this._instanceId
|
|
4460
4573
|
}), {
|
|
4461
4574
|
F: __dxlog_file14,
|
|
4462
|
-
L:
|
|
4575
|
+
L: 165,
|
|
4463
4576
|
S: this,
|
|
4464
4577
|
C: (f, a) => f(...a)
|
|
4465
4578
|
});
|
|
4466
4579
|
await this.signalManager.open();
|
|
4467
4580
|
await this.networkManager.open();
|
|
4581
|
+
await this.automergeHost.open();
|
|
4468
4582
|
await this.metadataStore.load();
|
|
4469
4583
|
await this.spaceManager.open();
|
|
4470
4584
|
await this.identityManager.open(ctx);
|
|
4471
4585
|
if (this.identityManager.identity) {
|
|
4472
4586
|
await this._initialize(ctx);
|
|
4473
4587
|
}
|
|
4588
|
+
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
4589
|
+
(0, import_log12.log)("loaded persistent invitations", {
|
|
4590
|
+
count: loadedInvitations.invitations?.length
|
|
4591
|
+
}, {
|
|
4592
|
+
F: __dxlog_file14,
|
|
4593
|
+
L: 178,
|
|
4594
|
+
S: this,
|
|
4595
|
+
C: (f, a) => f(...a)
|
|
4596
|
+
});
|
|
4474
4597
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols11.trace.end({
|
|
4475
4598
|
id: this._instanceId
|
|
4476
4599
|
}), {
|
|
4477
4600
|
F: __dxlog_file14,
|
|
4478
|
-
L:
|
|
4601
|
+
L: 180,
|
|
4479
4602
|
S: this,
|
|
4480
4603
|
C: (f, a) => f(...a)
|
|
4481
4604
|
});
|
|
4482
4605
|
(0, import_log12.log)("opened", void 0, {
|
|
4483
4606
|
F: __dxlog_file14,
|
|
4484
|
-
L:
|
|
4607
|
+
L: 181,
|
|
4485
4608
|
S: this,
|
|
4486
4609
|
C: (f, a) => f(...a)
|
|
4487
4610
|
});
|
|
@@ -4489,7 +4612,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4489
4612
|
async _close() {
|
|
4490
4613
|
(0, import_log12.log)("closing...", void 0, {
|
|
4491
4614
|
F: __dxlog_file14,
|
|
4492
|
-
L:
|
|
4615
|
+
L: 185,
|
|
4493
4616
|
S: this,
|
|
4494
4617
|
C: (f, a) => f(...a)
|
|
4495
4618
|
});
|
|
@@ -4507,21 +4630,21 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4507
4630
|
await this.indexer.destroy();
|
|
4508
4631
|
(0, import_log12.log)("closed", void 0, {
|
|
4509
4632
|
F: __dxlog_file14,
|
|
4510
|
-
L:
|
|
4633
|
+
L: 198,
|
|
4511
4634
|
S: this,
|
|
4512
4635
|
C: (f, a) => f(...a)
|
|
4513
4636
|
});
|
|
4514
4637
|
}
|
|
4515
4638
|
async createIdentity(params = {}) {
|
|
4516
4639
|
const identity = await this.identityManager.createIdentity(params);
|
|
4517
|
-
await this._initialize(new
|
|
4640
|
+
await this._initialize(new import_context9.Context());
|
|
4518
4641
|
return identity;
|
|
4519
4642
|
}
|
|
4520
4643
|
getInvitationHandler(invitation) {
|
|
4521
4644
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4522
4645
|
(0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4523
4646
|
F: __dxlog_file14,
|
|
4524
|
-
L:
|
|
4647
|
+
L: 209,
|
|
4525
4648
|
S: this,
|
|
4526
4649
|
A: [
|
|
4527
4650
|
"factory",
|
|
@@ -4540,7 +4663,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4540
4663
|
}
|
|
4541
4664
|
async _acceptIdentity(params) {
|
|
4542
4665
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
4543
|
-
await this._initialize(new
|
|
4666
|
+
await this._initialize(new import_context9.Context());
|
|
4544
4667
|
return identity;
|
|
4545
4668
|
}
|
|
4546
4669
|
async _checkStorageVersion() {
|
|
@@ -4553,7 +4676,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4553
4676
|
async _initialize(ctx) {
|
|
4554
4677
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
4555
4678
|
F: __dxlog_file14,
|
|
4556
|
-
L:
|
|
4679
|
+
L: 240,
|
|
4557
4680
|
S: this,
|
|
4558
4681
|
C: (f, a) => f(...a)
|
|
4559
4682
|
});
|
|
@@ -4576,7 +4699,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4576
4699
|
this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
|
|
4577
4700
|
(0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4578
4701
|
F: __dxlog_file14,
|
|
4579
|
-
L:
|
|
4702
|
+
L: 264,
|
|
4580
4703
|
S: this,
|
|
4581
4704
|
A: [
|
|
4582
4705
|
"this.dataSpaceManager",
|
|
@@ -4600,7 +4723,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4600
4723
|
details: assertion
|
|
4601
4724
|
}, {
|
|
4602
4725
|
F: __dxlog_file14,
|
|
4603
|
-
L:
|
|
4726
|
+
L: 280,
|
|
4604
4727
|
S: this,
|
|
4605
4728
|
C: (f, a) => f(...a)
|
|
4606
4729
|
});
|
|
@@ -4611,7 +4734,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4611
4734
|
details: assertion
|
|
4612
4735
|
}, {
|
|
4613
4736
|
F: __dxlog_file14,
|
|
4614
|
-
L:
|
|
4737
|
+
L: 284,
|
|
4615
4738
|
S: this,
|
|
4616
4739
|
C: (f, a) => f(...a)
|
|
4617
4740
|
});
|
|
@@ -4622,7 +4745,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4622
4745
|
details: assertion
|
|
4623
4746
|
}, {
|
|
4624
4747
|
F: __dxlog_file14,
|
|
4625
|
-
L:
|
|
4748
|
+
L: 289,
|
|
4626
4749
|
S: this,
|
|
4627
4750
|
C: (f, a) => f(...a)
|
|
4628
4751
|
});
|
|
@@ -4633,7 +4756,7 @@ var ServiceContext = class extends import_context10.Resource {
|
|
|
4633
4756
|
} catch (err) {
|
|
4634
4757
|
import_log12.log.catch(err, void 0, {
|
|
4635
4758
|
F: __dxlog_file14,
|
|
4636
|
-
L:
|
|
4759
|
+
L: 295,
|
|
4637
4760
|
S: this,
|
|
4638
4761
|
C: (f, a) => f(...a)
|
|
4639
4762
|
});
|
|
@@ -4675,7 +4798,7 @@ var ServiceRegistry = class {
|
|
|
4675
4798
|
delete this._handlers[name];
|
|
4676
4799
|
}
|
|
4677
4800
|
};
|
|
4678
|
-
var DXOS_VERSION = "0.4.10-main.
|
|
4801
|
+
var DXOS_VERSION = "0.4.10-main.c75170d";
|
|
4679
4802
|
var getPlatform = () => {
|
|
4680
4803
|
if (process.browser) {
|
|
4681
4804
|
if (typeof window !== "undefined") {
|
|
@@ -5151,7 +5274,7 @@ var toStorageType = (type) => {
|
|
|
5151
5274
|
};
|
|
5152
5275
|
var createLevel = async (config) => {
|
|
5153
5276
|
const persistent = isPersistent(config);
|
|
5154
|
-
const storagePath = persistent ?
|
|
5277
|
+
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys13.PublicKey.random().toHex()}`;
|
|
5155
5278
|
const level = new import_level.Level(storagePath);
|
|
5156
5279
|
await level.open();
|
|
5157
5280
|
return level;
|
|
@@ -5225,6 +5348,7 @@ var ClientServicesHost = class {
|
|
|
5225
5348
|
transportFactory,
|
|
5226
5349
|
signalManager,
|
|
5227
5350
|
storage,
|
|
5351
|
+
level,
|
|
5228
5352
|
// TODO(wittjosiah): Turn this on by default.
|
|
5229
5353
|
lockKey,
|
|
5230
5354
|
callbacks,
|
|
@@ -5235,6 +5359,7 @@ var ClientServicesHost = class {
|
|
|
5235
5359
|
this._opening = false;
|
|
5236
5360
|
this._open = false;
|
|
5237
5361
|
this._storage = storage;
|
|
5362
|
+
this._level = level;
|
|
5238
5363
|
this._callbacks = callbacks;
|
|
5239
5364
|
this._runtimeParams = runtimeParams;
|
|
5240
5365
|
if (config) {
|
|
@@ -5249,7 +5374,7 @@ var ClientServicesHost = class {
|
|
|
5249
5374
|
lockKey,
|
|
5250
5375
|
onAcquire: () => {
|
|
5251
5376
|
if (!this._opening) {
|
|
5252
|
-
void this.open(new
|
|
5377
|
+
void this.open(new import_context10.Context());
|
|
5253
5378
|
}
|
|
5254
5379
|
},
|
|
5255
5380
|
onRelease: () => this.close()
|
|
@@ -5306,7 +5431,7 @@ var ClientServicesHost = class {
|
|
|
5306
5431
|
initialize({ config, ...options }) {
|
|
5307
5432
|
(0, import_invariant15.invariant)(!this._open, "service host is open", {
|
|
5308
5433
|
F: __dxlog_file18,
|
|
5309
|
-
L:
|
|
5434
|
+
L: 197,
|
|
5310
5435
|
S: this,
|
|
5311
5436
|
A: [
|
|
5312
5437
|
"!this._open",
|
|
@@ -5315,14 +5440,14 @@ var ClientServicesHost = class {
|
|
|
5315
5440
|
});
|
|
5316
5441
|
(0, import_log13.log)("initializing...", void 0, {
|
|
5317
5442
|
F: __dxlog_file18,
|
|
5318
|
-
L:
|
|
5443
|
+
L: 198,
|
|
5319
5444
|
S: this,
|
|
5320
5445
|
C: (f, a) => f(...a)
|
|
5321
5446
|
});
|
|
5322
5447
|
if (config) {
|
|
5323
5448
|
(0, import_invariant15.invariant)(!this._config, "config already set", {
|
|
5324
5449
|
F: __dxlog_file18,
|
|
5325
|
-
L:
|
|
5450
|
+
L: 201,
|
|
5326
5451
|
S: this,
|
|
5327
5452
|
A: [
|
|
5328
5453
|
"!this._config",
|
|
@@ -5337,7 +5462,7 @@ var ClientServicesHost = class {
|
|
|
5337
5462
|
if (!options.signalManager) {
|
|
5338
5463
|
import_log13.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
5339
5464
|
F: __dxlog_file18,
|
|
5340
|
-
L:
|
|
5465
|
+
L: 209,
|
|
5341
5466
|
S: this,
|
|
5342
5467
|
C: (f, a) => f(...a)
|
|
5343
5468
|
});
|
|
@@ -5348,7 +5473,7 @@ var ClientServicesHost = class {
|
|
|
5348
5473
|
this._signalManager = signalManager;
|
|
5349
5474
|
(0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
|
|
5350
5475
|
F: __dxlog_file18,
|
|
5351
|
-
L:
|
|
5476
|
+
L: 220,
|
|
5352
5477
|
S: this,
|
|
5353
5478
|
A: [
|
|
5354
5479
|
"!this._networkManager",
|
|
@@ -5362,7 +5487,7 @@ var ClientServicesHost = class {
|
|
|
5362
5487
|
});
|
|
5363
5488
|
(0, import_log13.log)("initialized", void 0, {
|
|
5364
5489
|
F: __dxlog_file18,
|
|
5365
|
-
L:
|
|
5490
|
+
L: 227,
|
|
5366
5491
|
S: this,
|
|
5367
5492
|
C: (f, a) => f(...a)
|
|
5368
5493
|
});
|
|
@@ -5376,13 +5501,13 @@ var ClientServicesHost = class {
|
|
|
5376
5501
|
id: traceId
|
|
5377
5502
|
}), {
|
|
5378
5503
|
F: __dxlog_file18,
|
|
5379
|
-
L:
|
|
5504
|
+
L: 238,
|
|
5380
5505
|
S: this,
|
|
5381
5506
|
C: (f, a) => f(...a)
|
|
5382
5507
|
});
|
|
5383
5508
|
(0, import_invariant15.invariant)(this._config, "config not set", {
|
|
5384
5509
|
F: __dxlog_file18,
|
|
5385
|
-
L:
|
|
5510
|
+
L: 240,
|
|
5386
5511
|
S: this,
|
|
5387
5512
|
A: [
|
|
5388
5513
|
"this._config",
|
|
@@ -5391,7 +5516,7 @@ var ClientServicesHost = class {
|
|
|
5391
5516
|
});
|
|
5392
5517
|
(0, import_invariant15.invariant)(this._storage, "storage not set", {
|
|
5393
5518
|
F: __dxlog_file18,
|
|
5394
|
-
L:
|
|
5519
|
+
L: 241,
|
|
5395
5520
|
S: this,
|
|
5396
5521
|
A: [
|
|
5397
5522
|
"this._storage",
|
|
@@ -5400,7 +5525,7 @@ var ClientServicesHost = class {
|
|
|
5400
5525
|
});
|
|
5401
5526
|
(0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
|
|
5402
5527
|
F: __dxlog_file18,
|
|
5403
|
-
L:
|
|
5528
|
+
L: 242,
|
|
5404
5529
|
S: this,
|
|
5405
5530
|
A: [
|
|
5406
5531
|
"this._signalManager",
|
|
@@ -5409,7 +5534,7 @@ var ClientServicesHost = class {
|
|
|
5409
5534
|
});
|
|
5410
5535
|
(0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
|
|
5411
5536
|
F: __dxlog_file18,
|
|
5412
|
-
L:
|
|
5537
|
+
L: 243,
|
|
5413
5538
|
S: this,
|
|
5414
5539
|
A: [
|
|
5415
5540
|
"this._networkManager",
|
|
@@ -5421,26 +5546,27 @@ var ClientServicesHost = class {
|
|
|
5421
5546
|
lockKey: this._resourceLock?.lockKey
|
|
5422
5547
|
}, {
|
|
5423
5548
|
F: __dxlog_file18,
|
|
5424
|
-
L:
|
|
5549
|
+
L: 246,
|
|
5425
5550
|
S: this,
|
|
5426
5551
|
C: (f, a) => f(...a)
|
|
5427
5552
|
});
|
|
5428
5553
|
if (!this._level) {
|
|
5429
5554
|
this._level = await createLevel(this._config.get("runtime.client.storage", {}));
|
|
5430
5555
|
}
|
|
5556
|
+
await this._level.open();
|
|
5431
5557
|
await this._resourceLock?.acquire();
|
|
5432
5558
|
await this._loggingService.open();
|
|
5433
5559
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
5434
5560
|
this._serviceRegistry.setServices({
|
|
5435
5561
|
SystemService: this._systemService,
|
|
5436
5562
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
5437
|
-
InvitationsService: new InvitationsServiceImpl(this._serviceContext.
|
|
5563
|
+
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
5438
5564
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
5439
5565
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
|
|
5440
5566
|
await this._serviceContext.initialized.wait();
|
|
5441
5567
|
return this._serviceContext.dataSpaceManager;
|
|
5442
5568
|
}),
|
|
5443
|
-
DataService: new
|
|
5569
|
+
DataService: new import_echo_pipeline5.DataServiceImpl(this._serviceContext.automergeHost),
|
|
5444
5570
|
IndexService: new import_indexing2.IndexServiceImpl({
|
|
5445
5571
|
indexer: this._serviceContext.indexer,
|
|
5446
5572
|
automergeHost: this._serviceContext.automergeHost
|
|
@@ -5456,24 +5582,6 @@ var ClientServicesHost = class {
|
|
|
5456
5582
|
})
|
|
5457
5583
|
});
|
|
5458
5584
|
await this._serviceContext.open(ctx);
|
|
5459
|
-
(0, import_invariant15.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
|
|
5460
|
-
F: __dxlog_file18,
|
|
5461
|
-
L: 303,
|
|
5462
|
-
S: this,
|
|
5463
|
-
A: [
|
|
5464
|
-
"this.serviceRegistry.services.InvitationsService",
|
|
5465
|
-
""
|
|
5466
|
-
]
|
|
5467
|
-
});
|
|
5468
|
-
const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
|
|
5469
|
-
(0, import_log13.log)("loaded persistent invitations", {
|
|
5470
|
-
count: loadedInvitations.invitations?.length
|
|
5471
|
-
}, {
|
|
5472
|
-
F: __dxlog_file18,
|
|
5473
|
-
L: 306,
|
|
5474
|
-
S: this,
|
|
5475
|
-
C: (f, a) => f(...a)
|
|
5476
|
-
});
|
|
5477
5585
|
const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
|
|
5478
5586
|
if (devtoolsProxy) {
|
|
5479
5587
|
this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
|
|
@@ -5493,7 +5601,7 @@ var ClientServicesHost = class {
|
|
|
5493
5601
|
deviceKey
|
|
5494
5602
|
}, {
|
|
5495
5603
|
F: __dxlog_file18,
|
|
5496
|
-
L:
|
|
5604
|
+
L: 326,
|
|
5497
5605
|
S: this,
|
|
5498
5606
|
C: (f, a) => f(...a)
|
|
5499
5607
|
});
|
|
@@ -5501,7 +5609,7 @@ var ClientServicesHost = class {
|
|
|
5501
5609
|
id: traceId
|
|
5502
5610
|
}), {
|
|
5503
5611
|
F: __dxlog_file18,
|
|
5504
|
-
L:
|
|
5612
|
+
L: 327,
|
|
5505
5613
|
S: this,
|
|
5506
5614
|
C: (f, a) => f(...a)
|
|
5507
5615
|
});
|
|
@@ -5515,7 +5623,7 @@ var ClientServicesHost = class {
|
|
|
5515
5623
|
deviceKey
|
|
5516
5624
|
}, {
|
|
5517
5625
|
F: __dxlog_file18,
|
|
5518
|
-
L:
|
|
5626
|
+
L: 338,
|
|
5519
5627
|
S: this,
|
|
5520
5628
|
C: (f, a) => f(...a)
|
|
5521
5629
|
});
|
|
@@ -5533,7 +5641,7 @@ var ClientServicesHost = class {
|
|
|
5533
5641
|
deviceKey
|
|
5534
5642
|
}, {
|
|
5535
5643
|
F: __dxlog_file18,
|
|
5536
|
-
L:
|
|
5644
|
+
L: 347,
|
|
5537
5645
|
S: this,
|
|
5538
5646
|
C: (f, a) => f(...a)
|
|
5539
5647
|
});
|
|
@@ -5544,13 +5652,13 @@ var ClientServicesHost = class {
|
|
|
5544
5652
|
id: traceId
|
|
5545
5653
|
}), {
|
|
5546
5654
|
F: __dxlog_file18,
|
|
5547
|
-
L:
|
|
5655
|
+
L: 352,
|
|
5548
5656
|
S: this,
|
|
5549
5657
|
C: (f, a) => f(...a)
|
|
5550
5658
|
});
|
|
5551
5659
|
(0, import_log13.log)("resetting...", void 0, {
|
|
5552
5660
|
F: __dxlog_file18,
|
|
5553
|
-
L:
|
|
5661
|
+
L: 354,
|
|
5554
5662
|
S: this,
|
|
5555
5663
|
C: (f, a) => f(...a)
|
|
5556
5664
|
});
|
|
@@ -5558,7 +5666,7 @@ var ClientServicesHost = class {
|
|
|
5558
5666
|
await this._storage.reset();
|
|
5559
5667
|
(0, import_log13.log)("reset", void 0, {
|
|
5560
5668
|
F: __dxlog_file18,
|
|
5561
|
-
L:
|
|
5669
|
+
L: 357,
|
|
5562
5670
|
S: this,
|
|
5563
5671
|
C: (f, a) => f(...a)
|
|
5564
5672
|
});
|
|
@@ -5566,7 +5674,7 @@ var ClientServicesHost = class {
|
|
|
5566
5674
|
id: traceId
|
|
5567
5675
|
}), {
|
|
5568
5676
|
F: __dxlog_file18,
|
|
5569
|
-
L:
|
|
5677
|
+
L: 358,
|
|
5570
5678
|
S: this,
|
|
5571
5679
|
C: (f, a) => f(...a)
|
|
5572
5680
|
});
|
|
@@ -5579,7 +5687,7 @@ var ClientServicesHost = class {
|
|
|
5579
5687
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5580
5688
|
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5581
5689
|
F: __dxlog_file18,
|
|
5582
|
-
L:
|
|
5690
|
+
L: 370,
|
|
5583
5691
|
S: this,
|
|
5584
5692
|
A: [
|
|
5585
5693
|
"automergeIndex",
|
|
@@ -5590,7 +5698,7 @@ var ClientServicesHost = class {
|
|
|
5590
5698
|
await document.whenReady();
|
|
5591
5699
|
const properties = {
|
|
5592
5700
|
system: {
|
|
5593
|
-
type: (0,
|
|
5701
|
+
type: (0, import_echo_pipeline5.encodeReference)((0, import_echo_schema.getTypeReference)(import_client_protocol4.Properties))
|
|
5594
5702
|
},
|
|
5595
5703
|
data: {
|
|
5596
5704
|
[import_client_protocol4.defaultKey]: identity.identityKey.toHex()
|
|
@@ -5674,6 +5782,7 @@ var findConfigs = () => {
|
|
|
5674
5782
|
IdentityManager,
|
|
5675
5783
|
IdentityServiceImpl,
|
|
5676
5784
|
InvitationsHandler,
|
|
5785
|
+
InvitationsManager,
|
|
5677
5786
|
InvitationsServiceImpl,
|
|
5678
5787
|
Lock,
|
|
5679
5788
|
ServiceContext,
|
|
@@ -5681,6 +5790,7 @@ var findConfigs = () => {
|
|
|
5681
5790
|
SpaceInvitationProtocol,
|
|
5682
5791
|
SpacesServiceImpl,
|
|
5683
5792
|
TrustedKeySetAuthVerifier,
|
|
5793
|
+
createAdmissionKeypair,
|
|
5684
5794
|
createAuthProvider,
|
|
5685
5795
|
createCollectDiagnosticsBroadcastHandler,
|
|
5686
5796
|
createCollectDiagnosticsBroadcastSender,
|
|
@@ -5688,7 +5798,6 @@ var findConfigs = () => {
|
|
|
5688
5798
|
createLevel,
|
|
5689
5799
|
createStorageObjects,
|
|
5690
5800
|
getNetworkPeers,
|
|
5691
|
-
invitationExpired,
|
|
5692
5801
|
isLocked,
|
|
5693
5802
|
subscribeToFeedBlocks,
|
|
5694
5803
|
subscribeToFeeds,
|
|
@@ -5698,4 +5807,4 @@ var findConfigs = () => {
|
|
|
5698
5807
|
subscribeToSpaces,
|
|
5699
5808
|
subscribeToSwarmInfo
|
|
5700
5809
|
});
|
|
5701
|
-
//# sourceMappingURL=chunk-
|
|
5810
|
+
//# sourceMappingURL=chunk-34EZSH65.cjs.map
|