@dxos/client-services 0.6.14-main.7bd9c89 → 0.6.14-main.8b352a0
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-URZYQU7T.mjs → chunk-Y5D7T3I7.mjs} +129 -95
- package/dist/lib/browser/chunk-Y5D7T3I7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -2
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-APHU7U5B.cjs → chunk-DARYUWYV.cjs} +132 -90
- package/dist/lib/node/{chunk-APHU7U5B.cjs.map → chunk-DARYUWYV.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-L5NEKNEY.mjs → chunk-RVNJ6XZO.mjs} +129 -87
- package/dist/lib/node-esm/{chunk-L5NEKNEY.mjs.map → chunk-RVNJ6XZO.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.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/version.d.ts +1 -1
- package/package.json +43 -48
- package/src/packlets/invitations/device-invitation-protocol.ts +3 -1
- package/src/packlets/invitations/invitation-state.ts +13 -12
- package/src/packlets/invitations/invitations-handler.ts +34 -5
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -0
- package/src/packlets/services/service-context.ts +3 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-URZYQU7T.mjs.map +0 -7
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
|
|
3
|
-
// inject-globals:@inject-globals
|
|
4
|
-
import {
|
|
5
|
-
global,
|
|
6
|
-
Buffer,
|
|
7
|
-
process
|
|
8
|
-
} from "@dxos/node-std/inject-globals";
|
|
9
|
-
|
|
10
3
|
// packages/sdk/client-services/src/packlets/devtools/feeds.ts
|
|
11
4
|
import { EventSubscriptions } from "@dxos/async";
|
|
12
5
|
import { Stream } from "@dxos/codec-protobuf";
|
|
@@ -404,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
404
397
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
405
398
|
|
|
406
399
|
// packages/sdk/client-services/src/version.ts
|
|
407
|
-
var DXOS_VERSION = "0.6.14-main.
|
|
400
|
+
var DXOS_VERSION = "0.6.14-main.8b352a0";
|
|
408
401
|
|
|
409
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
410
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -4685,7 +4678,9 @@ var DeviceInvitationProtocol = class {
|
|
|
4685
4678
|
this._acceptIdentity = _acceptIdentity;
|
|
4686
4679
|
}
|
|
4687
4680
|
toJSON() {
|
|
4688
|
-
return {
|
|
4681
|
+
return {
|
|
4682
|
+
kind: "device"
|
|
4683
|
+
};
|
|
4689
4684
|
}
|
|
4690
4685
|
checkCanInviteNewMembers() {
|
|
4691
4686
|
return void 0;
|
|
@@ -4704,7 +4699,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4704
4699
|
async admit(_, request) {
|
|
4705
4700
|
invariant10(request.device, void 0, {
|
|
4706
4701
|
F: __dxlog_file16,
|
|
4707
|
-
L:
|
|
4702
|
+
L: 53,
|
|
4708
4703
|
S: this,
|
|
4709
4704
|
A: [
|
|
4710
4705
|
"request.device",
|
|
@@ -4715,7 +4710,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4715
4710
|
const credential = await identity.admitDevice(request.device);
|
|
4716
4711
|
invariant10(getCredentialAssertion4(credential)["@type"] === "dxos.halo.credentials.AuthorizedDevice", void 0, {
|
|
4717
4712
|
F: __dxlog_file16,
|
|
4718
|
-
L:
|
|
4713
|
+
L: 56,
|
|
4719
4714
|
S: this,
|
|
4720
4715
|
A: [
|
|
4721
4716
|
"getCredentialAssertion(credential)['@type'] === 'dxos.halo.credentials.AuthorizedDevice'",
|
|
@@ -4760,7 +4755,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4760
4755
|
async accept(response, request) {
|
|
4761
4756
|
invariant10(response.device, void 0, {
|
|
4762
4757
|
F: __dxlog_file16,
|
|
4763
|
-
L:
|
|
4758
|
+
L: 100,
|
|
4764
4759
|
S: this,
|
|
4765
4760
|
A: [
|
|
4766
4761
|
"response.device",
|
|
@@ -4770,7 +4765,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4770
4765
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
4771
4766
|
invariant10(request.device, void 0, {
|
|
4772
4767
|
F: __dxlog_file16,
|
|
4773
|
-
L:
|
|
4768
|
+
L: 103,
|
|
4774
4769
|
S: this,
|
|
4775
4770
|
A: [
|
|
4776
4771
|
"request.device",
|
|
@@ -5494,6 +5489,7 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5494
5489
|
},
|
|
5495
5490
|
// disposing context prevents any further state updates
|
|
5496
5491
|
complete: (newState) => {
|
|
5492
|
+
logStateUpdate(currentInvitation, void 0, invitation.state);
|
|
5497
5493
|
currentInvitation = {
|
|
5498
5494
|
...currentInvitation,
|
|
5499
5495
|
...newState
|
|
@@ -5516,7 +5512,7 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5516
5512
|
},
|
|
5517
5513
|
error: (lockHolder, error) => {
|
|
5518
5514
|
if (isStateChangeAllowed(lockHolder)) {
|
|
5519
|
-
logStateUpdate(currentInvitation, lockHolder, Invitation6.State.ERROR);
|
|
5515
|
+
logStateUpdate(currentInvitation, lockHolder, Invitation6.State.ERROR, error);
|
|
5520
5516
|
currentInvitation = {
|
|
5521
5517
|
...currentInvitation,
|
|
5522
5518
|
state: Invitation6.State.ERROR
|
|
@@ -5530,26 +5526,26 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
|
5530
5526
|
}
|
|
5531
5527
|
};
|
|
5532
5528
|
};
|
|
5533
|
-
var logStateUpdate = (invitation, actor, newState) => {
|
|
5529
|
+
var logStateUpdate = (invitation, actor, newState, error) => {
|
|
5530
|
+
const logContext = {
|
|
5531
|
+
invitationId: invitation.invitationId,
|
|
5532
|
+
actor: actor?.constructor.name,
|
|
5533
|
+
newState: stateToString(newState),
|
|
5534
|
+
oldState: stateToString(invitation.state),
|
|
5535
|
+
error: error?.message,
|
|
5536
|
+
errorStack: error?.stack
|
|
5537
|
+
};
|
|
5534
5538
|
if (isNonTerminalState(newState)) {
|
|
5535
|
-
log17("
|
|
5536
|
-
actor: actor?.constructor.name,
|
|
5537
|
-
newState: stateToString(newState),
|
|
5538
|
-
oldState: stateToString(invitation.state)
|
|
5539
|
-
}, {
|
|
5539
|
+
log17.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5540
5540
|
F: __dxlog_file20,
|
|
5541
|
-
L:
|
|
5541
|
+
L: 98,
|
|
5542
5542
|
S: void 0,
|
|
5543
5543
|
C: (f, a) => f(...a)
|
|
5544
5544
|
});
|
|
5545
5545
|
} else {
|
|
5546
|
-
log17.info("
|
|
5547
|
-
actor: actor?.constructor.name,
|
|
5548
|
-
newState: stateToString(newState),
|
|
5549
|
-
oldState: stateToString(invitation.state)
|
|
5550
|
-
}, {
|
|
5546
|
+
log17.info("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5551
5547
|
F: __dxlog_file20,
|
|
5552
|
-
L:
|
|
5548
|
+
L: 100,
|
|
5553
5549
|
S: void 0,
|
|
5554
5550
|
C: (f, a) => f(...a)
|
|
5555
5551
|
});
|
|
@@ -5657,6 +5653,17 @@ var InvitationsHandler = class {
|
|
|
5657
5653
|
this._connectionParams = _connectionParams;
|
|
5658
5654
|
}
|
|
5659
5655
|
handleInvitationFlow(ctx, stream, protocol, invitation) {
|
|
5656
|
+
log19.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
|
|
5657
|
+
state: invitation.state,
|
|
5658
|
+
invitationId: invitation.invitationId,
|
|
5659
|
+
kind: invitation.kind,
|
|
5660
|
+
type: invitation.type
|
|
5661
|
+
}, {
|
|
5662
|
+
F: __dxlog_file22,
|
|
5663
|
+
L: 83,
|
|
5664
|
+
S: this,
|
|
5665
|
+
C: (f, a) => f(...a)
|
|
5666
|
+
});
|
|
5660
5667
|
metrics.increment("dxos.invitation.created");
|
|
5661
5668
|
const guardedState = createGuardedInvitationState(ctx, invitation, stream);
|
|
5662
5669
|
const createExtension = () => {
|
|
@@ -5670,10 +5677,19 @@ var InvitationsHandler = class {
|
|
|
5670
5677
|
},
|
|
5671
5678
|
admit: async (admissionRequest) => {
|
|
5672
5679
|
try {
|
|
5680
|
+
log19.verbose("dxos.sdk.invitations-handler.host.admit", {
|
|
5681
|
+
invitationId: invitation.invitationId,
|
|
5682
|
+
...protocol.toJSON()
|
|
5683
|
+
}, {
|
|
5684
|
+
F: __dxlog_file22,
|
|
5685
|
+
L: 105,
|
|
5686
|
+
S: this,
|
|
5687
|
+
C: (f, a) => f(...a)
|
|
5688
|
+
});
|
|
5673
5689
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
5674
5690
|
invariant15(deviceKey, void 0, {
|
|
5675
5691
|
F: __dxlog_file22,
|
|
5676
|
-
L:
|
|
5692
|
+
L: 110,
|
|
5677
5693
|
S: this,
|
|
5678
5694
|
A: [
|
|
5679
5695
|
"deviceKey",
|
|
@@ -5702,7 +5718,7 @@ var InvitationsHandler = class {
|
|
|
5702
5718
|
id: traceId
|
|
5703
5719
|
}), {
|
|
5704
5720
|
F: __dxlog_file22,
|
|
5705
|
-
L:
|
|
5721
|
+
L: 135,
|
|
5706
5722
|
S: this,
|
|
5707
5723
|
C: (f, a) => f(...a)
|
|
5708
5724
|
});
|
|
@@ -5710,7 +5726,7 @@ var InvitationsHandler = class {
|
|
|
5710
5726
|
...protocol.toJSON()
|
|
5711
5727
|
}, {
|
|
5712
5728
|
F: __dxlog_file22,
|
|
5713
|
-
L:
|
|
5729
|
+
L: 136,
|
|
5714
5730
|
S: this,
|
|
5715
5731
|
C: (f, a) => f(...a)
|
|
5716
5732
|
});
|
|
@@ -5722,7 +5738,7 @@ var InvitationsHandler = class {
|
|
|
5722
5738
|
...protocol.toJSON()
|
|
5723
5739
|
}, {
|
|
5724
5740
|
F: __dxlog_file22,
|
|
5725
|
-
L:
|
|
5741
|
+
L: 138,
|
|
5726
5742
|
S: this,
|
|
5727
5743
|
C: (f, a) => f(...a)
|
|
5728
5744
|
});
|
|
@@ -5732,7 +5748,7 @@ var InvitationsHandler = class {
|
|
|
5732
5748
|
id: traceId
|
|
5733
5749
|
}), {
|
|
5734
5750
|
F: __dxlog_file22,
|
|
5735
|
-
L:
|
|
5751
|
+
L: 141,
|
|
5736
5752
|
S: this,
|
|
5737
5753
|
C: (f, a) => f(...a)
|
|
5738
5754
|
});
|
|
@@ -5748,7 +5764,7 @@ var InvitationsHandler = class {
|
|
|
5748
5764
|
...protocol.toJSON()
|
|
5749
5765
|
}, {
|
|
5750
5766
|
F: __dxlog_file22,
|
|
5751
|
-
L:
|
|
5767
|
+
L: 151,
|
|
5752
5768
|
S: this,
|
|
5753
5769
|
C: (f, a) => f(...a)
|
|
5754
5770
|
});
|
|
@@ -5758,7 +5774,7 @@ var InvitationsHandler = class {
|
|
|
5758
5774
|
metrics.increment("dxos.invitation.failed");
|
|
5759
5775
|
log19.error("failed", err, {
|
|
5760
5776
|
F: __dxlog_file22,
|
|
5761
|
-
L:
|
|
5777
|
+
L: 156,
|
|
5762
5778
|
S: this,
|
|
5763
5779
|
C: (f, a) => f(...a)
|
|
5764
5780
|
});
|
|
@@ -5769,7 +5785,7 @@ var InvitationsHandler = class {
|
|
|
5769
5785
|
error: err
|
|
5770
5786
|
}), {
|
|
5771
5787
|
F: __dxlog_file22,
|
|
5772
|
-
L:
|
|
5788
|
+
L: 159,
|
|
5773
5789
|
S: this,
|
|
5774
5790
|
C: (f, a) => f(...a)
|
|
5775
5791
|
});
|
|
@@ -5783,7 +5799,7 @@ var InvitationsHandler = class {
|
|
|
5783
5799
|
...err.context
|
|
5784
5800
|
}, {
|
|
5785
5801
|
F: __dxlog_file22,
|
|
5786
|
-
L:
|
|
5802
|
+
L: 167,
|
|
5787
5803
|
S: this,
|
|
5788
5804
|
C: (f, a) => f(...a)
|
|
5789
5805
|
});
|
|
@@ -5796,7 +5812,7 @@ var InvitationsHandler = class {
|
|
|
5796
5812
|
err
|
|
5797
5813
|
}, {
|
|
5798
5814
|
F: __dxlog_file22,
|
|
5799
|
-
L:
|
|
5815
|
+
L: 173,
|
|
5800
5816
|
S: this,
|
|
5801
5817
|
C: (f, a) => f(...a)
|
|
5802
5818
|
});
|
|
@@ -5806,7 +5822,7 @@ var InvitationsHandler = class {
|
|
|
5806
5822
|
metrics.increment("dxos.invitation.failed");
|
|
5807
5823
|
log19.error("failed", err, {
|
|
5808
5824
|
F: __dxlog_file22,
|
|
5809
|
-
L:
|
|
5825
|
+
L: 178,
|
|
5810
5826
|
S: this,
|
|
5811
5827
|
C: (f, a) => f(...a)
|
|
5812
5828
|
});
|
|
@@ -5820,7 +5836,7 @@ var InvitationsHandler = class {
|
|
|
5820
5836
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
5821
5837
|
log19.warn("invitation has already expired", void 0, {
|
|
5822
5838
|
F: __dxlog_file22,
|
|
5823
|
-
L:
|
|
5839
|
+
L: 189,
|
|
5824
5840
|
S: this,
|
|
5825
5841
|
C: (f, a) => f(...a)
|
|
5826
5842
|
});
|
|
@@ -5840,11 +5856,22 @@ var InvitationsHandler = class {
|
|
|
5840
5856
|
});
|
|
5841
5857
|
}
|
|
5842
5858
|
acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
|
|
5859
|
+
log19.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
|
|
5860
|
+
state: invitation.state,
|
|
5861
|
+
invitationId: invitation.invitationId,
|
|
5862
|
+
kind: invitation.kind,
|
|
5863
|
+
type: invitation.type
|
|
5864
|
+
}, {
|
|
5865
|
+
F: __dxlog_file22,
|
|
5866
|
+
L: 220,
|
|
5867
|
+
S: this,
|
|
5868
|
+
C: (f, a) => f(...a)
|
|
5869
|
+
});
|
|
5843
5870
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
5844
5871
|
if (deviceProfile) {
|
|
5845
5872
|
invariant15(invitation.kind === Invitation7.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5846
5873
|
F: __dxlog_file22,
|
|
5847
|
-
L:
|
|
5874
|
+
L: 229,
|
|
5848
5875
|
S: this,
|
|
5849
5876
|
A: [
|
|
5850
5877
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5862,7 +5889,7 @@ var InvitationsHandler = class {
|
|
|
5862
5889
|
triedPeers: triedPeersIds.size
|
|
5863
5890
|
}, {
|
|
5864
5891
|
F: __dxlog_file22,
|
|
5865
|
-
L:
|
|
5892
|
+
L: 237,
|
|
5866
5893
|
S: this,
|
|
5867
5894
|
C: (f, a) => f(...a)
|
|
5868
5895
|
});
|
|
@@ -5889,7 +5916,7 @@ var InvitationsHandler = class {
|
|
|
5889
5916
|
currentState: guardedState.current.state
|
|
5890
5917
|
}, {
|
|
5891
5918
|
F: __dxlog_file22,
|
|
5892
|
-
L:
|
|
5919
|
+
L: 265,
|
|
5893
5920
|
S: this,
|
|
5894
5921
|
C: (f, a) => f(...a)
|
|
5895
5922
|
});
|
|
@@ -5907,7 +5934,7 @@ var InvitationsHandler = class {
|
|
|
5907
5934
|
id: traceId
|
|
5908
5935
|
}), {
|
|
5909
5936
|
F: __dxlog_file22,
|
|
5910
|
-
L:
|
|
5937
|
+
L: 277,
|
|
5911
5938
|
S: this,
|
|
5912
5939
|
C: (f, a) => f(...a)
|
|
5913
5940
|
});
|
|
@@ -5915,20 +5942,21 @@ var InvitationsHandler = class {
|
|
|
5915
5942
|
guardedState.set(extension, Invitation7.State.TIMEOUT);
|
|
5916
5943
|
extensionCtx.close();
|
|
5917
5944
|
}, timeout);
|
|
5918
|
-
log19("connected", {
|
|
5945
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.connected", {
|
|
5919
5946
|
...protocol.toJSON()
|
|
5920
5947
|
}, {
|
|
5921
5948
|
F: __dxlog_file22,
|
|
5922
|
-
L:
|
|
5949
|
+
L: 288,
|
|
5923
5950
|
S: this,
|
|
5924
5951
|
C: (f, a) => f(...a)
|
|
5925
5952
|
});
|
|
5926
5953
|
guardedState.set(extension, Invitation7.State.CONNECTED);
|
|
5927
|
-
log19("introduce", {
|
|
5954
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.introduce", {
|
|
5955
|
+
invitationId: invitation.invitationId,
|
|
5928
5956
|
...protocol.toJSON()
|
|
5929
5957
|
}, {
|
|
5930
5958
|
F: __dxlog_file22,
|
|
5931
|
-
L:
|
|
5959
|
+
L: 292,
|
|
5932
5960
|
S: this,
|
|
5933
5961
|
C: (f, a) => f(...a)
|
|
5934
5962
|
});
|
|
@@ -5936,12 +5964,13 @@ var InvitationsHandler = class {
|
|
|
5936
5964
|
invitationId: invitation.invitationId,
|
|
5937
5965
|
...protocol.createIntroduction()
|
|
5938
5966
|
});
|
|
5939
|
-
log19("introduce
|
|
5967
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
|
|
5968
|
+
invitationId: invitation.invitationId,
|
|
5940
5969
|
...protocol.toJSON(),
|
|
5941
|
-
|
|
5970
|
+
authMethod: introductionResponse.authMethod
|
|
5942
5971
|
}, {
|
|
5943
5972
|
F: __dxlog_file22,
|
|
5944
|
-
L:
|
|
5973
|
+
L: 300,
|
|
5945
5974
|
S: this,
|
|
5946
5975
|
C: (f, a) => f(...a)
|
|
5947
5976
|
});
|
|
@@ -5958,11 +5987,12 @@ var InvitationsHandler = class {
|
|
|
5958
5987
|
break;
|
|
5959
5988
|
}
|
|
5960
5989
|
}
|
|
5961
|
-
log19("request
|
|
5990
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
|
|
5991
|
+
invitationId: invitation.invitationId,
|
|
5962
5992
|
...protocol.toJSON()
|
|
5963
5993
|
}, {
|
|
5964
5994
|
F: __dxlog_file22,
|
|
5965
|
-
L:
|
|
5995
|
+
L: 330,
|
|
5966
5996
|
S: this,
|
|
5967
5997
|
C: (f, a) => f(...a)
|
|
5968
5998
|
});
|
|
@@ -5970,11 +6000,12 @@ var InvitationsHandler = class {
|
|
|
5970
6000
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
5971
6001
|
admitted = true;
|
|
5972
6002
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
5973
|
-
log19("admitted
|
|
6003
|
+
log19.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
|
|
6004
|
+
invitationId: invitation.invitationId,
|
|
5974
6005
|
...protocol.toJSON()
|
|
5975
6006
|
}, {
|
|
5976
6007
|
F: __dxlog_file22,
|
|
5977
|
-
L:
|
|
6008
|
+
L: 344,
|
|
5978
6009
|
S: this,
|
|
5979
6010
|
C: (f, a) => f(...a)
|
|
5980
6011
|
});
|
|
@@ -5987,7 +6018,7 @@ var InvitationsHandler = class {
|
|
|
5987
6018
|
id: traceId
|
|
5988
6019
|
}), {
|
|
5989
6020
|
F: __dxlog_file22,
|
|
5990
|
-
L:
|
|
6021
|
+
L: 353,
|
|
5991
6022
|
S: this,
|
|
5992
6023
|
C: (f, a) => f(...a)
|
|
5993
6024
|
});
|
|
@@ -5997,7 +6028,7 @@ var InvitationsHandler = class {
|
|
|
5997
6028
|
...protocol.toJSON()
|
|
5998
6029
|
}, {
|
|
5999
6030
|
F: __dxlog_file22,
|
|
6000
|
-
L:
|
|
6031
|
+
L: 356,
|
|
6001
6032
|
S: this,
|
|
6002
6033
|
C: (f, a) => f(...a)
|
|
6003
6034
|
});
|
|
@@ -6005,7 +6036,7 @@ var InvitationsHandler = class {
|
|
|
6005
6036
|
} else {
|
|
6006
6037
|
log19("auth failed", err, {
|
|
6007
6038
|
F: __dxlog_file22,
|
|
6008
|
-
L:
|
|
6039
|
+
L: 359,
|
|
6009
6040
|
S: this,
|
|
6010
6041
|
C: (f, a) => f(...a)
|
|
6011
6042
|
});
|
|
@@ -6017,7 +6048,7 @@ var InvitationsHandler = class {
|
|
|
6017
6048
|
error: err
|
|
6018
6049
|
}), {
|
|
6019
6050
|
F: __dxlog_file22,
|
|
6020
|
-
L:
|
|
6051
|
+
L: 363,
|
|
6021
6052
|
S: this,
|
|
6022
6053
|
C: (f, a) => f(...a)
|
|
6023
6054
|
});
|
|
@@ -6033,7 +6064,7 @@ var InvitationsHandler = class {
|
|
|
6033
6064
|
...protocol.toJSON()
|
|
6034
6065
|
}, {
|
|
6035
6066
|
F: __dxlog_file22,
|
|
6036
|
-
L:
|
|
6067
|
+
L: 372,
|
|
6037
6068
|
S: this,
|
|
6038
6069
|
C: (f, a) => f(...a)
|
|
6039
6070
|
});
|
|
@@ -6041,7 +6072,7 @@ var InvitationsHandler = class {
|
|
|
6041
6072
|
} else {
|
|
6042
6073
|
log19("auth failed", err, {
|
|
6043
6074
|
F: __dxlog_file22,
|
|
6044
|
-
L:
|
|
6075
|
+
L: 375,
|
|
6045
6076
|
S: this,
|
|
6046
6077
|
C: (f, a) => f(...a)
|
|
6047
6078
|
});
|
|
@@ -6058,7 +6089,7 @@ var InvitationsHandler = class {
|
|
|
6058
6089
|
...protocol.toJSON()
|
|
6059
6090
|
}, {
|
|
6060
6091
|
F: __dxlog_file22,
|
|
6061
|
-
L:
|
|
6092
|
+
L: 387,
|
|
6062
6093
|
S: this,
|
|
6063
6094
|
C: (f, a) => f(...a)
|
|
6064
6095
|
});
|
|
@@ -6078,7 +6109,7 @@ var InvitationsHandler = class {
|
|
|
6078
6109
|
} else {
|
|
6079
6110
|
invariant15(invitation.swarmKey, void 0, {
|
|
6080
6111
|
F: __dxlog_file22,
|
|
6081
|
-
L:
|
|
6112
|
+
L: 399,
|
|
6082
6113
|
S: this,
|
|
6083
6114
|
A: [
|
|
6084
6115
|
"invitation.swarmKey",
|
|
@@ -6122,7 +6153,7 @@ var InvitationsHandler = class {
|
|
|
6122
6153
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6123
6154
|
log19("guest waiting for authentication code...", void 0, {
|
|
6124
6155
|
F: __dxlog_file22,
|
|
6125
|
-
L:
|
|
6156
|
+
L: 451,
|
|
6126
6157
|
S: this,
|
|
6127
6158
|
C: (f, a) => f(...a)
|
|
6128
6159
|
});
|
|
@@ -6130,7 +6161,7 @@ var InvitationsHandler = class {
|
|
|
6130
6161
|
const authCode = await authenticated.wait(options);
|
|
6131
6162
|
log19("sending authentication request", void 0, {
|
|
6132
6163
|
F: __dxlog_file22,
|
|
6133
|
-
L:
|
|
6164
|
+
L: 455,
|
|
6134
6165
|
S: this,
|
|
6135
6166
|
C: (f, a) => f(...a)
|
|
6136
6167
|
});
|
|
@@ -6149,7 +6180,7 @@ var InvitationsHandler = class {
|
|
|
6149
6180
|
attempt
|
|
6150
6181
|
}, {
|
|
6151
6182
|
F: __dxlog_file22,
|
|
6152
|
-
L:
|
|
6183
|
+
L: 466,
|
|
6153
6184
|
S: this,
|
|
6154
6185
|
C: (f, a) => f(...a)
|
|
6155
6186
|
});
|
|
@@ -6167,7 +6198,7 @@ var InvitationsHandler = class {
|
|
|
6167
6198
|
}
|
|
6168
6199
|
log19("sending authentication request", void 0, {
|
|
6169
6200
|
F: __dxlog_file22,
|
|
6170
|
-
L:
|
|
6201
|
+
L: 485,
|
|
6171
6202
|
S: this,
|
|
6172
6203
|
C: (f, a) => f(...a)
|
|
6173
6204
|
});
|
|
@@ -6303,6 +6334,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6303
6334
|
}
|
|
6304
6335
|
toJSON() {
|
|
6305
6336
|
return {
|
|
6337
|
+
kind: "space",
|
|
6306
6338
|
deviceKey: this._signingContext.deviceKey,
|
|
6307
6339
|
spaceKey: this._spaceKey
|
|
6308
6340
|
};
|
|
@@ -6323,7 +6355,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6323
6355
|
getInvitationContext() {
|
|
6324
6356
|
invariant16(this._spaceKey, void 0, {
|
|
6325
6357
|
F: __dxlog_file23,
|
|
6326
|
-
L:
|
|
6358
|
+
L: 64,
|
|
6327
6359
|
S: this,
|
|
6328
6360
|
A: [
|
|
6329
6361
|
"this._spaceKey",
|
|
@@ -6333,7 +6365,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6333
6365
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6334
6366
|
invariant16(space, void 0, {
|
|
6335
6367
|
F: __dxlog_file23,
|
|
6336
|
-
L:
|
|
6368
|
+
L: 66,
|
|
6337
6369
|
S: this,
|
|
6338
6370
|
A: [
|
|
6339
6371
|
"space",
|
|
@@ -6349,7 +6381,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6349
6381
|
async admit(invitation, request, guestProfile) {
|
|
6350
6382
|
invariant16(this._spaceKey && request.space, void 0, {
|
|
6351
6383
|
F: __dxlog_file23,
|
|
6352
|
-
L:
|
|
6384
|
+
L: 79,
|
|
6353
6385
|
S: this,
|
|
6354
6386
|
A: [
|
|
6355
6387
|
"this._spaceKey && request.space",
|
|
@@ -6361,7 +6393,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6361
6393
|
guest: request.space.deviceKey
|
|
6362
6394
|
}, {
|
|
6363
6395
|
F: __dxlog_file23,
|
|
6364
|
-
L:
|
|
6396
|
+
L: 80,
|
|
6365
6397
|
S: this,
|
|
6366
6398
|
C: (f, a) => f(...a)
|
|
6367
6399
|
});
|
|
@@ -6383,7 +6415,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6383
6415
|
async delegate(invitation) {
|
|
6384
6416
|
invariant16(this._spaceKey, void 0, {
|
|
6385
6417
|
F: __dxlog_file23,
|
|
6386
|
-
L:
|
|
6418
|
+
L: 100,
|
|
6387
6419
|
S: this,
|
|
6388
6420
|
A: [
|
|
6389
6421
|
"this._spaceKey",
|
|
@@ -6393,7 +6425,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6393
6425
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6394
6426
|
invariant16(space, void 0, {
|
|
6395
6427
|
F: __dxlog_file23,
|
|
6396
|
-
L:
|
|
6428
|
+
L: 102,
|
|
6397
6429
|
S: this,
|
|
6398
6430
|
A: [
|
|
6399
6431
|
"space",
|
|
@@ -6403,7 +6435,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6403
6435
|
if (invitation.authMethod === Invitation8.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6404
6436
|
invariant16(invitation.guestKeypair?.publicKey, void 0, {
|
|
6405
6437
|
F: __dxlog_file23,
|
|
6406
|
-
L:
|
|
6438
|
+
L: 104,
|
|
6407
6439
|
S: this,
|
|
6408
6440
|
A: [
|
|
6409
6441
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6416,7 +6448,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6416
6448
|
id: invitation.invitationId
|
|
6417
6449
|
}, {
|
|
6418
6450
|
F: __dxlog_file23,
|
|
6419
|
-
L:
|
|
6451
|
+
L: 107,
|
|
6420
6452
|
S: this,
|
|
6421
6453
|
C: (f, a) => f(...a)
|
|
6422
6454
|
});
|
|
@@ -6431,7 +6463,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6431
6463
|
});
|
|
6432
6464
|
invariant16(credential.credential, void 0, {
|
|
6433
6465
|
F: __dxlog_file23,
|
|
6434
|
-
L:
|
|
6466
|
+
L: 127,
|
|
6435
6467
|
S: this,
|
|
6436
6468
|
A: [
|
|
6437
6469
|
"credential.credential",
|
|
@@ -6446,7 +6478,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6446
6478
|
async cancelDelegation(invitation) {
|
|
6447
6479
|
invariant16(this._spaceKey, void 0, {
|
|
6448
6480
|
F: __dxlog_file23,
|
|
6449
|
-
L:
|
|
6481
|
+
L: 133,
|
|
6450
6482
|
S: this,
|
|
6451
6483
|
A: [
|
|
6452
6484
|
"this._spaceKey",
|
|
@@ -6455,7 +6487,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6455
6487
|
});
|
|
6456
6488
|
invariant16(invitation.type === Invitation8.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6457
6489
|
F: __dxlog_file23,
|
|
6458
|
-
L:
|
|
6490
|
+
L: 134,
|
|
6459
6491
|
S: this,
|
|
6460
6492
|
A: [
|
|
6461
6493
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6465,7 +6497,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6465
6497
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6466
6498
|
invariant16(space, void 0, {
|
|
6467
6499
|
F: __dxlog_file23,
|
|
6468
|
-
L:
|
|
6500
|
+
L: 136,
|
|
6469
6501
|
S: this,
|
|
6470
6502
|
A: [
|
|
6471
6503
|
"space",
|
|
@@ -6477,14 +6509,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6477
6509
|
id: invitation.invitationId
|
|
6478
6510
|
}, {
|
|
6479
6511
|
F: __dxlog_file23,
|
|
6480
|
-
L:
|
|
6512
|
+
L: 138,
|
|
6481
6513
|
S: this,
|
|
6482
6514
|
C: (f, a) => f(...a)
|
|
6483
6515
|
});
|
|
6484
6516
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6485
6517
|
invariant16(credential.credential, void 0, {
|
|
6486
6518
|
F: __dxlog_file23,
|
|
6487
|
-
L:
|
|
6519
|
+
L: 145,
|
|
6488
6520
|
S: this,
|
|
6489
6521
|
A: [
|
|
6490
6522
|
"credential.credential",
|
|
@@ -6523,7 +6555,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6523
6555
|
async accept(response) {
|
|
6524
6556
|
invariant16(response.space, void 0, {
|
|
6525
6557
|
F: __dxlog_file23,
|
|
6526
|
-
L:
|
|
6558
|
+
L: 180,
|
|
6527
6559
|
S: this,
|
|
6528
6560
|
A: [
|
|
6529
6561
|
"response.space",
|
|
@@ -6534,7 +6566,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6534
6566
|
const assertion = getCredentialAssertion5(credential);
|
|
6535
6567
|
invariant16(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6536
6568
|
F: __dxlog_file23,
|
|
6537
|
-
L:
|
|
6569
|
+
L: 183,
|
|
6538
6570
|
S: this,
|
|
6539
6571
|
A: [
|
|
6540
6572
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6543,7 +6575,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6543
6575
|
});
|
|
6544
6576
|
invariant16(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6545
6577
|
F: __dxlog_file23,
|
|
6546
|
-
L:
|
|
6578
|
+
L: 184,
|
|
6547
6579
|
S: this,
|
|
6548
6580
|
A: [
|
|
6549
6581
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -7752,10 +7784,13 @@ var ServiceContext = class extends Resource7 {
|
|
|
7752
7784
|
return identity;
|
|
7753
7785
|
}
|
|
7754
7786
|
getInvitationHandler(invitation) {
|
|
7787
|
+
if (this.identityManager.identity == null && invitation.kind === Invitation10.Kind.SPACE) {
|
|
7788
|
+
throw new Error("Identity must be created before joining a space.");
|
|
7789
|
+
}
|
|
7755
7790
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
7756
7791
|
invariant20(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
7757
7792
|
F: __dxlog_file28,
|
|
7758
|
-
L:
|
|
7793
|
+
L: 263,
|
|
7759
7794
|
S: this,
|
|
7760
7795
|
A: [
|
|
7761
7796
|
"factory",
|
|
@@ -7781,7 +7816,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7781
7816
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
7782
7817
|
await this._initialize(new Context9(void 0, {
|
|
7783
7818
|
F: __dxlog_file28,
|
|
7784
|
-
L:
|
|
7819
|
+
L: 282
|
|
7785
7820
|
}));
|
|
7786
7821
|
return identity;
|
|
7787
7822
|
}
|
|
@@ -7795,7 +7830,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7795
7830
|
async _initialize(ctx) {
|
|
7796
7831
|
log25("initializing spaces...", void 0, {
|
|
7797
7832
|
F: __dxlog_file28,
|
|
7798
|
-
L:
|
|
7833
|
+
L: 297,
|
|
7799
7834
|
S: this,
|
|
7800
7835
|
C: (f, a) => f(...a)
|
|
7801
7836
|
});
|
|
@@ -7834,7 +7869,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7834
7869
|
this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
|
|
7835
7870
|
invariant20(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
7836
7871
|
F: __dxlog_file28,
|
|
7837
|
-
L:
|
|
7872
|
+
L: 335,
|
|
7838
7873
|
S: this,
|
|
7839
7874
|
A: [
|
|
7840
7875
|
"this.dataSpaceManager",
|
|
@@ -7858,7 +7893,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7858
7893
|
details: assertion
|
|
7859
7894
|
}, {
|
|
7860
7895
|
F: __dxlog_file28,
|
|
7861
|
-
L:
|
|
7896
|
+
L: 351,
|
|
7862
7897
|
S: this,
|
|
7863
7898
|
C: (f, a) => f(...a)
|
|
7864
7899
|
});
|
|
@@ -7869,7 +7904,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7869
7904
|
details: assertion
|
|
7870
7905
|
}, {
|
|
7871
7906
|
F: __dxlog_file28,
|
|
7872
|
-
L:
|
|
7907
|
+
L: 355,
|
|
7873
7908
|
S: this,
|
|
7874
7909
|
C: (f, a) => f(...a)
|
|
7875
7910
|
});
|
|
@@ -7880,7 +7915,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7880
7915
|
details: assertion
|
|
7881
7916
|
}, {
|
|
7882
7917
|
F: __dxlog_file28,
|
|
7883
|
-
L:
|
|
7918
|
+
L: 360,
|
|
7884
7919
|
S: this,
|
|
7885
7920
|
C: (f, a) => f(...a)
|
|
7886
7921
|
});
|
|
@@ -7891,7 +7926,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7891
7926
|
} catch (err) {
|
|
7892
7927
|
log25.catch(err, void 0, {
|
|
7893
7928
|
F: __dxlog_file28,
|
|
7894
|
-
L:
|
|
7929
|
+
L: 366,
|
|
7895
7930
|
S: this,
|
|
7896
7931
|
C: (f, a) => f(...a)
|
|
7897
7932
|
});
|
|
@@ -7912,7 +7947,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7912
7947
|
swarms: this.networkManager.topics
|
|
7913
7948
|
}, {
|
|
7914
7949
|
F: __dxlog_file28,
|
|
7915
|
-
L:
|
|
7950
|
+
L: 380,
|
|
7916
7951
|
S: this,
|
|
7917
7952
|
C: (f, a) => f(...a)
|
|
7918
7953
|
});
|
|
@@ -7926,7 +7961,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7926
7961
|
});
|
|
7927
7962
|
invariant20(identity.deviceCredentialChain, void 0, {
|
|
7928
7963
|
F: __dxlog_file28,
|
|
7929
|
-
L:
|
|
7964
|
+
L: 398,
|
|
7930
7965
|
S: this,
|
|
7931
7966
|
A: [
|
|
7932
7967
|
"identity.deviceCredentialChain",
|
|
@@ -9017,7 +9052,6 @@ ClientServicesHost = _ts_decorate11([
|
|
|
9017
9052
|
], ClientServicesHost);
|
|
9018
9053
|
|
|
9019
9054
|
export {
|
|
9020
|
-
Buffer,
|
|
9021
9055
|
subscribeToFeeds,
|
|
9022
9056
|
subscribeToFeedBlocks,
|
|
9023
9057
|
subscribeToNetworkStatus,
|
|
@@ -9062,4 +9096,4 @@ export {
|
|
|
9062
9096
|
importProfileData,
|
|
9063
9097
|
ClientServicesHost
|
|
9064
9098
|
};
|
|
9065
|
-
//# sourceMappingURL=chunk-
|
|
9099
|
+
//# sourceMappingURL=chunk-Y5D7T3I7.mjs.map
|