@dxos/client-services 0.7.5-main.9d2a38b → 0.7.5-main.e9bb01b
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-RFZHCLFI.mjs → chunk-O46EJ5BJ.mjs} +69 -55
- package/dist/lib/browser/chunk-O46EJ5BJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-WCTGAZLA.cjs → chunk-WFDMSV4I.cjs} +67 -53
- package/dist/lib/node/chunk-WFDMSV4I.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-RSOLUJE6.mjs → chunk-UWR5XM7L.mjs} +69 -55
- package/dist/lib/node-esm/chunk-UWR5XM7L.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/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/invitations/utils.d.ts +1 -0
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +38 -38
- package/src/packlets/invitations/invitations-handler.ts +15 -6
- package/src/packlets/invitations/invitations-manager.ts +1 -1
- package/src/packlets/invitations/space-invitation-protocol.ts +2 -3
- package/src/packlets/invitations/utils.ts +7 -0
- package/src/packlets/spaces/data-space-manager.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-RFZHCLFI.mjs.map +0 -7
- package/dist/lib/node/chunk-WCTGAZLA.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-RSOLUJE6.mjs.map +0 -7
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
InvitationsManager,
|
|
7
7
|
ServiceContext,
|
|
8
8
|
SpaceInvitationProtocol
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-O46EJ5BJ.mjs";
|
|
10
10
|
|
|
11
11
|
// packages/sdk/client-services/src/packlets/testing/credential-utils.ts
|
|
12
12
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -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_WFDMSV4I_exports = {};
|
|
30
|
+
__export(chunk_WFDMSV4I_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,7 +72,7 @@ __export(chunk_WCTGAZLA_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_WFDMSV4I_exports);
|
|
76
76
|
var import_async = require("@dxos/async");
|
|
77
77
|
var import_stream = require("@dxos/codec-protobuf/stream");
|
|
78
78
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -735,7 +735,7 @@ var DevtoolsServiceImpl = class {
|
|
|
735
735
|
});
|
|
736
736
|
}
|
|
737
737
|
};
|
|
738
|
-
var DXOS_VERSION = "0.7.5-main.
|
|
738
|
+
var DXOS_VERSION = "0.7.5-main.e9bb01b";
|
|
739
739
|
var getPlatform = () => {
|
|
740
740
|
if (process.browser) {
|
|
741
741
|
if (typeof window !== "undefined") {
|
|
@@ -2784,7 +2784,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2784
2784
|
guestKeypair: invitation.guestKey ? {
|
|
2785
2785
|
publicKey: invitation.guestKey
|
|
2786
2786
|
} : void 0,
|
|
2787
|
-
lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
|
|
2787
|
+
lifetime: invitation.expiresOn ? (invitation.expiresOn.getTime() - Date.now()) / 1e3 : void 0,
|
|
2788
2788
|
multiUse: invitation.multiUse,
|
|
2789
2789
|
delegationCredentialId: credentialId,
|
|
2790
2790
|
persistent: false
|
|
@@ -4789,6 +4789,12 @@ var DeviceInvitationProtocol = class {
|
|
|
4789
4789
|
var stateToString = (state) => {
|
|
4790
4790
|
return Object.entries(import_services13.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
4791
4791
|
};
|
|
4792
|
+
var computeExpirationTime = (invitation) => {
|
|
4793
|
+
if (!invitation.lifetime) {
|
|
4794
|
+
return;
|
|
4795
|
+
}
|
|
4796
|
+
return new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime * 1e3);
|
|
4797
|
+
};
|
|
4792
4798
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
4793
4799
|
let guard;
|
|
4794
4800
|
return (0, import_context11.cancelWithContext)(ctx, (async () => {
|
|
@@ -5765,18 +5771,19 @@ var InvitationsHandler = class {
|
|
|
5765
5771
|
});
|
|
5766
5772
|
return extension;
|
|
5767
5773
|
};
|
|
5768
|
-
|
|
5769
|
-
|
|
5774
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
5775
|
+
if (expiresOn) {
|
|
5776
|
+
if (expiresOn.getTime() < Date.now()) {
|
|
5770
5777
|
import_log12.log.warn("invitation has already expired", void 0, {
|
|
5771
5778
|
F: __dxlog_file21,
|
|
5772
|
-
L:
|
|
5779
|
+
L: 194,
|
|
5773
5780
|
S: this,
|
|
5774
5781
|
C: (f, a) => f(...a)
|
|
5775
5782
|
});
|
|
5776
5783
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5777
5784
|
void ctx.dispose().catch((err) => import_log12.log.catch(err, void 0, {
|
|
5778
5785
|
F: __dxlog_file21,
|
|
5779
|
-
L:
|
|
5786
|
+
L: 196,
|
|
5780
5787
|
S: this,
|
|
5781
5788
|
C: (f, a) => f(...a)
|
|
5782
5789
|
}));
|
|
@@ -5787,7 +5794,7 @@ var InvitationsHandler = class {
|
|
|
5787
5794
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5788
5795
|
metrics.increment("dxos.invitation.expired");
|
|
5789
5796
|
await ctx.dispose();
|
|
5790
|
-
},
|
|
5797
|
+
}, expiresOn.getTime() - Date.now());
|
|
5791
5798
|
}
|
|
5792
5799
|
let swarmConnection;
|
|
5793
5800
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
@@ -5803,7 +5810,7 @@ var InvitationsHandler = class {
|
|
|
5803
5810
|
type: invitation.type
|
|
5804
5811
|
}, {
|
|
5805
5812
|
F: __dxlog_file21,
|
|
5806
|
-
L:
|
|
5813
|
+
L: 227,
|
|
5807
5814
|
S: this,
|
|
5808
5815
|
C: (f, a) => f(...a)
|
|
5809
5816
|
});
|
|
@@ -5811,7 +5818,7 @@ var InvitationsHandler = class {
|
|
|
5811
5818
|
if (deviceProfile) {
|
|
5812
5819
|
(0, import_invariant12.invariant)(invitation.kind === import_services11.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5813
5820
|
F: __dxlog_file21,
|
|
5814
|
-
L:
|
|
5821
|
+
L: 236,
|
|
5815
5822
|
S: this,
|
|
5816
5823
|
A: [
|
|
5817
5824
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5829,7 +5836,7 @@ var InvitationsHandler = class {
|
|
|
5829
5836
|
triedPeers: triedPeersIds.size
|
|
5830
5837
|
}, {
|
|
5831
5838
|
F: __dxlog_file21,
|
|
5832
|
-
L:
|
|
5839
|
+
L: 244,
|
|
5833
5840
|
S: this,
|
|
5834
5841
|
C: (f, a) => f(...a)
|
|
5835
5842
|
});
|
|
@@ -5856,7 +5863,7 @@ var InvitationsHandler = class {
|
|
|
5856
5863
|
currentState: guardedState.current.state
|
|
5857
5864
|
}, {
|
|
5858
5865
|
F: __dxlog_file21,
|
|
5859
|
-
L:
|
|
5866
|
+
L: 272,
|
|
5860
5867
|
S: this,
|
|
5861
5868
|
C: (f, a) => f(...a)
|
|
5862
5869
|
});
|
|
@@ -5874,7 +5881,7 @@ var InvitationsHandler = class {
|
|
|
5874
5881
|
id: traceId
|
|
5875
5882
|
}), {
|
|
5876
5883
|
F: __dxlog_file21,
|
|
5877
|
-
L:
|
|
5884
|
+
L: 284,
|
|
5878
5885
|
S: this,
|
|
5879
5886
|
C: (f, a) => f(...a)
|
|
5880
5887
|
});
|
|
@@ -5886,7 +5893,7 @@ var InvitationsHandler = class {
|
|
|
5886
5893
|
...protocol.toJSON()
|
|
5887
5894
|
}, {
|
|
5888
5895
|
F: __dxlog_file21,
|
|
5889
|
-
L:
|
|
5896
|
+
L: 295,
|
|
5890
5897
|
S: this,
|
|
5891
5898
|
C: (f, a) => f(...a)
|
|
5892
5899
|
});
|
|
@@ -5896,7 +5903,7 @@ var InvitationsHandler = class {
|
|
|
5896
5903
|
...protocol.toJSON()
|
|
5897
5904
|
}, {
|
|
5898
5905
|
F: __dxlog_file21,
|
|
5899
|
-
L:
|
|
5906
|
+
L: 299,
|
|
5900
5907
|
S: this,
|
|
5901
5908
|
C: (f, a) => f(...a)
|
|
5902
5909
|
});
|
|
@@ -5910,7 +5917,7 @@ var InvitationsHandler = class {
|
|
|
5910
5917
|
authMethod: introductionResponse.authMethod
|
|
5911
5918
|
}, {
|
|
5912
5919
|
F: __dxlog_file21,
|
|
5913
|
-
L:
|
|
5920
|
+
L: 307,
|
|
5914
5921
|
S: this,
|
|
5915
5922
|
C: (f, a) => f(...a)
|
|
5916
5923
|
});
|
|
@@ -5932,7 +5939,7 @@ var InvitationsHandler = class {
|
|
|
5932
5939
|
...protocol.toJSON()
|
|
5933
5940
|
}, {
|
|
5934
5941
|
F: __dxlog_file21,
|
|
5935
|
-
L:
|
|
5942
|
+
L: 337,
|
|
5936
5943
|
S: this,
|
|
5937
5944
|
C: (f, a) => f(...a)
|
|
5938
5945
|
});
|
|
@@ -5945,7 +5952,7 @@ var InvitationsHandler = class {
|
|
|
5945
5952
|
...protocol.toJSON()
|
|
5946
5953
|
}, {
|
|
5947
5954
|
F: __dxlog_file21,
|
|
5948
|
-
L:
|
|
5955
|
+
L: 351,
|
|
5949
5956
|
S: this,
|
|
5950
5957
|
C: (f, a) => f(...a)
|
|
5951
5958
|
});
|
|
@@ -5958,7 +5965,7 @@ var InvitationsHandler = class {
|
|
|
5958
5965
|
id: traceId
|
|
5959
5966
|
}), {
|
|
5960
5967
|
F: __dxlog_file21,
|
|
5961
|
-
L:
|
|
5968
|
+
L: 360,
|
|
5962
5969
|
S: this,
|
|
5963
5970
|
C: (f, a) => f(...a)
|
|
5964
5971
|
});
|
|
@@ -5968,7 +5975,7 @@ var InvitationsHandler = class {
|
|
|
5968
5975
|
...protocol.toJSON()
|
|
5969
5976
|
}, {
|
|
5970
5977
|
F: __dxlog_file21,
|
|
5971
|
-
L:
|
|
5978
|
+
L: 363,
|
|
5972
5979
|
S: this,
|
|
5973
5980
|
C: (f, a) => f(...a)
|
|
5974
5981
|
});
|
|
@@ -5976,7 +5983,7 @@ var InvitationsHandler = class {
|
|
|
5976
5983
|
} else {
|
|
5977
5984
|
import_log12.log.verbose("auth failed", err, {
|
|
5978
5985
|
F: __dxlog_file21,
|
|
5979
|
-
L:
|
|
5986
|
+
L: 366,
|
|
5980
5987
|
S: this,
|
|
5981
5988
|
C: (f, a) => f(...a)
|
|
5982
5989
|
});
|
|
@@ -5988,7 +5995,7 @@ var InvitationsHandler = class {
|
|
|
5988
5995
|
error: err
|
|
5989
5996
|
}), {
|
|
5990
5997
|
F: __dxlog_file21,
|
|
5991
|
-
L:
|
|
5998
|
+
L: 370,
|
|
5992
5999
|
S: this,
|
|
5993
6000
|
C: (f, a) => f(...a)
|
|
5994
6001
|
});
|
|
@@ -6004,7 +6011,7 @@ var InvitationsHandler = class {
|
|
|
6004
6011
|
...protocol.toJSON()
|
|
6005
6012
|
}, {
|
|
6006
6013
|
F: __dxlog_file21,
|
|
6007
|
-
L:
|
|
6014
|
+
L: 379,
|
|
6008
6015
|
S: this,
|
|
6009
6016
|
C: (f, a) => f(...a)
|
|
6010
6017
|
});
|
|
@@ -6012,7 +6019,7 @@ var InvitationsHandler = class {
|
|
|
6012
6019
|
} else {
|
|
6013
6020
|
import_log12.log.verbose("auth failed", err, {
|
|
6014
6021
|
F: __dxlog_file21,
|
|
6015
|
-
L:
|
|
6022
|
+
L: 382,
|
|
6016
6023
|
S: this,
|
|
6017
6024
|
C: (f, a) => f(...a)
|
|
6018
6025
|
});
|
|
@@ -6029,7 +6036,7 @@ var InvitationsHandler = class {
|
|
|
6029
6036
|
...protocol.toJSON()
|
|
6030
6037
|
}, {
|
|
6031
6038
|
F: __dxlog_file21,
|
|
6032
|
-
L:
|
|
6039
|
+
L: 394,
|
|
6033
6040
|
S: this,
|
|
6034
6041
|
C: (f, a) => f(...a)
|
|
6035
6042
|
});
|
|
@@ -6042,14 +6049,14 @@ var InvitationsHandler = class {
|
|
|
6042
6049
|
});
|
|
6043
6050
|
edgeInvitationHandler.handle(ctx, guardedState, protocol, deviceProfile);
|
|
6044
6051
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6045
|
-
const error =
|
|
6052
|
+
const error = checkInvitation(protocol, invitation);
|
|
6046
6053
|
if (error) {
|
|
6047
6054
|
stream.error(error);
|
|
6048
6055
|
await ctx.dispose();
|
|
6049
6056
|
} else {
|
|
6050
6057
|
(0, import_invariant12.invariant)(invitation.swarmKey, void 0, {
|
|
6051
6058
|
F: __dxlog_file21,
|
|
6052
|
-
L:
|
|
6059
|
+
L: 406,
|
|
6053
6060
|
S: this,
|
|
6054
6061
|
A: [
|
|
6055
6062
|
"invitation.swarmKey",
|
|
@@ -6093,7 +6100,7 @@ var InvitationsHandler = class {
|
|
|
6093
6100
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6094
6101
|
(0, import_log12.log)("guest waiting for authentication code...", void 0, {
|
|
6095
6102
|
F: __dxlog_file21,
|
|
6096
|
-
L:
|
|
6103
|
+
L: 458,
|
|
6097
6104
|
S: this,
|
|
6098
6105
|
C: (f, a) => f(...a)
|
|
6099
6106
|
});
|
|
@@ -6101,7 +6108,7 @@ var InvitationsHandler = class {
|
|
|
6101
6108
|
const authCode = await authenticated.wait(options);
|
|
6102
6109
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6103
6110
|
F: __dxlog_file21,
|
|
6104
|
-
L:
|
|
6111
|
+
L: 462,
|
|
6105
6112
|
S: this,
|
|
6106
6113
|
C: (f, a) => f(...a)
|
|
6107
6114
|
});
|
|
@@ -6120,7 +6127,7 @@ var InvitationsHandler = class {
|
|
|
6120
6127
|
attempt
|
|
6121
6128
|
}, {
|
|
6122
6129
|
F: __dxlog_file21,
|
|
6123
|
-
L:
|
|
6130
|
+
L: 473,
|
|
6124
6131
|
S: this,
|
|
6125
6132
|
C: (f, a) => f(...a)
|
|
6126
6133
|
});
|
|
@@ -6138,7 +6145,7 @@ var InvitationsHandler = class {
|
|
|
6138
6145
|
}
|
|
6139
6146
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6140
6147
|
F: __dxlog_file21,
|
|
6141
|
-
L:
|
|
6148
|
+
L: 492,
|
|
6142
6149
|
S: this,
|
|
6143
6150
|
C: (f, a) => f(...a)
|
|
6144
6151
|
});
|
|
@@ -6151,6 +6158,13 @@ var InvitationsHandler = class {
|
|
|
6151
6158
|
}
|
|
6152
6159
|
}
|
|
6153
6160
|
};
|
|
6161
|
+
var checkInvitation = (protocol, invitation) => {
|
|
6162
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
6163
|
+
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
6164
|
+
return new import_protocols9.InvalidInvitationError("Invitation already expired.");
|
|
6165
|
+
}
|
|
6166
|
+
return protocol.checkInvitation(invitation);
|
|
6167
|
+
};
|
|
6154
6168
|
var createAdmissionKeypair = () => {
|
|
6155
6169
|
const keypair = (0, import_crypto.createKeyPair)();
|
|
6156
6170
|
return {
|
|
@@ -6285,7 +6299,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6285
6299
|
getInvitationContext() {
|
|
6286
6300
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6287
6301
|
F: __dxlog_file22,
|
|
6288
|
-
L:
|
|
6302
|
+
L: 65,
|
|
6289
6303
|
S: this,
|
|
6290
6304
|
A: [
|
|
6291
6305
|
"this._spaceKey",
|
|
@@ -6295,7 +6309,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6295
6309
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6296
6310
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6297
6311
|
F: __dxlog_file22,
|
|
6298
|
-
L:
|
|
6312
|
+
L: 67,
|
|
6299
6313
|
S: this,
|
|
6300
6314
|
A: [
|
|
6301
6315
|
"space",
|
|
@@ -6311,7 +6325,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6311
6325
|
async admit(invitation, request, guestProfile) {
|
|
6312
6326
|
(0, import_invariant17.invariant)(this._spaceKey && request.space, void 0, {
|
|
6313
6327
|
F: __dxlog_file22,
|
|
6314
|
-
L:
|
|
6328
|
+
L: 80,
|
|
6315
6329
|
S: this,
|
|
6316
6330
|
A: [
|
|
6317
6331
|
"this._spaceKey && request.space",
|
|
@@ -6323,7 +6337,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6323
6337
|
guest: request.space.deviceKey
|
|
6324
6338
|
}, {
|
|
6325
6339
|
F: __dxlog_file22,
|
|
6326
|
-
L:
|
|
6340
|
+
L: 81,
|
|
6327
6341
|
S: this,
|
|
6328
6342
|
C: (f, a) => f(...a)
|
|
6329
6343
|
});
|
|
@@ -6345,7 +6359,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6345
6359
|
async delegate(invitation) {
|
|
6346
6360
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6347
6361
|
F: __dxlog_file22,
|
|
6348
|
-
L:
|
|
6362
|
+
L: 101,
|
|
6349
6363
|
S: this,
|
|
6350
6364
|
A: [
|
|
6351
6365
|
"this._spaceKey",
|
|
@@ -6355,7 +6369,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6355
6369
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6356
6370
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6357
6371
|
F: __dxlog_file22,
|
|
6358
|
-
L:
|
|
6372
|
+
L: 103,
|
|
6359
6373
|
S: this,
|
|
6360
6374
|
A: [
|
|
6361
6375
|
"space",
|
|
@@ -6365,7 +6379,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6365
6379
|
if (invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6366
6380
|
(0, import_invariant17.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6367
6381
|
F: __dxlog_file22,
|
|
6368
|
-
L:
|
|
6382
|
+
L: 105,
|
|
6369
6383
|
S: this,
|
|
6370
6384
|
A: [
|
|
6371
6385
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6378,7 +6392,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6378
6392
|
id: invitation.invitationId
|
|
6379
6393
|
}, {
|
|
6380
6394
|
F: __dxlog_file22,
|
|
6381
|
-
L:
|
|
6395
|
+
L: 108,
|
|
6382
6396
|
S: this,
|
|
6383
6397
|
C: (f, a) => f(...a)
|
|
6384
6398
|
});
|
|
@@ -6387,13 +6401,13 @@ var SpaceInvitationProtocol = class {
|
|
|
6387
6401
|
authMethod: invitation.authMethod,
|
|
6388
6402
|
swarmKey: invitation.swarmKey,
|
|
6389
6403
|
role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
|
|
6390
|
-
expiresOn:
|
|
6404
|
+
expiresOn: computeExpirationTime(invitation),
|
|
6391
6405
|
multiUse: invitation.multiUse ?? false,
|
|
6392
6406
|
guestKey: invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6393
6407
|
});
|
|
6394
6408
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6395
6409
|
F: __dxlog_file22,
|
|
6396
|
-
L:
|
|
6410
|
+
L: 126,
|
|
6397
6411
|
S: this,
|
|
6398
6412
|
A: [
|
|
6399
6413
|
"credential.credential",
|
|
@@ -6408,7 +6422,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6408
6422
|
async cancelDelegation(invitation) {
|
|
6409
6423
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6410
6424
|
F: __dxlog_file22,
|
|
6411
|
-
L:
|
|
6425
|
+
L: 132,
|
|
6412
6426
|
S: this,
|
|
6413
6427
|
A: [
|
|
6414
6428
|
"this._spaceKey",
|
|
@@ -6417,7 +6431,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6417
6431
|
});
|
|
6418
6432
|
(0, import_invariant17.invariant)(invitation.type === import_services17.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6419
6433
|
F: __dxlog_file22,
|
|
6420
|
-
L:
|
|
6434
|
+
L: 133,
|
|
6421
6435
|
S: this,
|
|
6422
6436
|
A: [
|
|
6423
6437
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6427,7 +6441,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6427
6441
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6428
6442
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6429
6443
|
F: __dxlog_file22,
|
|
6430
|
-
L:
|
|
6444
|
+
L: 135,
|
|
6431
6445
|
S: this,
|
|
6432
6446
|
A: [
|
|
6433
6447
|
"space",
|
|
@@ -6439,14 +6453,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6439
6453
|
id: invitation.invitationId
|
|
6440
6454
|
}, {
|
|
6441
6455
|
F: __dxlog_file22,
|
|
6442
|
-
L:
|
|
6456
|
+
L: 137,
|
|
6443
6457
|
S: this,
|
|
6444
6458
|
C: (f, a) => f(...a)
|
|
6445
6459
|
});
|
|
6446
6460
|
const credential = await (0, import_credentials18.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6447
6461
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6448
6462
|
F: __dxlog_file22,
|
|
6449
|
-
L:
|
|
6463
|
+
L: 144,
|
|
6450
6464
|
S: this,
|
|
6451
6465
|
A: [
|
|
6452
6466
|
"credential.credential",
|
|
@@ -6485,7 +6499,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6485
6499
|
async accept(response) {
|
|
6486
6500
|
(0, import_invariant17.invariant)(response.space, void 0, {
|
|
6487
6501
|
F: __dxlog_file22,
|
|
6488
|
-
L:
|
|
6502
|
+
L: 179,
|
|
6489
6503
|
S: this,
|
|
6490
6504
|
A: [
|
|
6491
6505
|
"response.space",
|
|
@@ -6496,7 +6510,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6496
6510
|
const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
|
|
6497
6511
|
(0, import_invariant17.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6498
6512
|
F: __dxlog_file22,
|
|
6499
|
-
L:
|
|
6513
|
+
L: 182,
|
|
6500
6514
|
S: this,
|
|
6501
6515
|
A: [
|
|
6502
6516
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6505,7 +6519,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6505
6519
|
});
|
|
6506
6520
|
(0, import_invariant17.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6507
6521
|
F: __dxlog_file22,
|
|
6508
|
-
L:
|
|
6522
|
+
L: 183,
|
|
6509
6523
|
S: this,
|
|
6510
6524
|
A: [
|
|
6511
6525
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -6729,7 +6743,7 @@ var InvitationsManager = class {
|
|
|
6729
6743
|
}
|
|
6730
6744
|
}
|
|
6731
6745
|
_createInvitation(protocol, _options) {
|
|
6732
|
-
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false, ...options } = _options ?? {};
|
|
6746
|
+
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400 * 7, multiUse = false, ...options } = _options ?? {};
|
|
6733
6747
|
const authCode = options?.authCode ?? (authMethod === import_services18.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6734
6748
|
return {
|
|
6735
6749
|
invitationId,
|
|
@@ -8893,4 +8907,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
8893
8907
|
subscribeToSpaces,
|
|
8894
8908
|
subscribeToSwarmInfo
|
|
8895
8909
|
});
|
|
8896
|
-
//# sourceMappingURL=chunk-
|
|
8910
|
+
//# sourceMappingURL=chunk-WFDMSV4I.cjs.map
|