@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.
Files changed (30) hide show
  1. package/dist/lib/browser/{chunk-RFZHCLFI.mjs → chunk-O46EJ5BJ.mjs} +69 -55
  2. package/dist/lib/browser/chunk-O46EJ5BJ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-WCTGAZLA.cjs → chunk-WFDMSV4I.cjs} +67 -53
  7. package/dist/lib/node/chunk-WFDMSV4I.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +47 -47
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +8 -8
  11. package/dist/lib/node-esm/{chunk-RSOLUJE6.mjs → chunk-UWR5XM7L.mjs} +69 -55
  12. package/dist/lib/node-esm/chunk-UWR5XM7L.mjs.map +7 -0
  13. package/dist/lib/node-esm/index.mjs +1 -1
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/testing/index.mjs +1 -1
  16. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/utils.d.ts +1 -0
  19. package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
  20. package/dist/types/src/version.d.ts +1 -1
  21. package/package.json +38 -38
  22. package/src/packlets/invitations/invitations-handler.ts +15 -6
  23. package/src/packlets/invitations/invitations-manager.ts +1 -1
  24. package/src/packlets/invitations/space-invitation-protocol.ts +2 -3
  25. package/src/packlets/invitations/utils.ts +7 -0
  26. package/src/packlets/spaces/data-space-manager.ts +1 -1
  27. package/src/version.ts +1 -1
  28. package/dist/lib/browser/chunk-RFZHCLFI.mjs.map +0 -7
  29. package/dist/lib/node/chunk-WCTGAZLA.cjs.map +0 -7
  30. package/dist/lib/node-esm/chunk-RSOLUJE6.mjs.map +0 -7
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
397
397
  import { TRACE_PROCESSOR } from "@dxos/tracing";
398
398
 
399
399
  // packages/sdk/client-services/src/version.ts
400
- var DXOS_VERSION = "0.7.5-main.9d2a38b";
400
+ var DXOS_VERSION = "0.7.5-main.e9bb01b";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -2648,7 +2648,7 @@ var DataSpaceManager = class extends Resource4 {
2648
2648
  guestKeypair: invitation.guestKey ? {
2649
2649
  publicKey: invitation.guestKey
2650
2650
  } : void 0,
2651
- lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
2651
+ lifetime: invitation.expiresOn ? (invitation.expiresOn.getTime() - Date.now()) / 1e3 : void 0,
2652
2652
  multiUse: invitation.multiUse,
2653
2653
  delegationCredentialId: credentialId,
2654
2654
  persistent: false
@@ -4705,14 +4705,14 @@ var DeviceInvitationProtocol = class {
4705
4705
 
4706
4706
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
4707
4707
  import { scheduleTask as scheduleTask7, TimeoutError as TimeoutError2 } from "@dxos/async";
4708
- import { INVITATION_TIMEOUT } from "@dxos/client-protocol";
4708
+ import { INVITATION_TIMEOUT, getExpirationTime } from "@dxos/client-protocol";
4709
4709
  import { ContextDisposedError as ContextDisposedError3 } from "@dxos/context";
4710
4710
  import { createKeyPair, sign as sign2 } from "@dxos/crypto";
4711
4711
  import { invariant as invariant15 } from "@dxos/invariant";
4712
4712
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4713
4713
  import { log as log18 } from "@dxos/log";
4714
4714
  import { createTeleportProtocolFactory } from "@dxos/network-manager";
4715
- import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace7 } from "@dxos/protocols";
4715
+ import { InvalidInvitationError, InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace7 } from "@dxos/protocols";
4716
4716
  import { Invitation as Invitation7 } from "@dxos/protocols/proto/dxos/client/services";
4717
4717
  import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protocols/proto/dxos/halo/invitations";
4718
4718
  import { InvitationOptions as InvitationOptions4 } from "@dxos/protocols/proto/dxos/halo/invitations";
@@ -4735,6 +4735,12 @@ import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/ser
4735
4735
  var stateToString = (state) => {
4736
4736
  return Object.entries(Invitation3.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
4737
4737
  };
4738
+ var computeExpirationTime = (invitation) => {
4739
+ if (!invitation.lifetime) {
4740
+ return;
4741
+ }
4742
+ return new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime * 1e3);
4743
+ };
4738
4744
  var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
4739
4745
  let guard;
4740
4746
  return cancelWithContext3(ctx, (async () => {
@@ -5750,18 +5756,19 @@ var InvitationsHandler = class {
5750
5756
  });
5751
5757
  return extension;
5752
5758
  };
5753
- if (invitation.lifetime && invitation.created) {
5754
- if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
5759
+ const expiresOn = getExpirationTime(invitation);
5760
+ if (expiresOn) {
5761
+ if (expiresOn.getTime() < Date.now()) {
5755
5762
  log18.warn("invitation has already expired", void 0, {
5756
5763
  F: __dxlog_file22,
5757
- L: 193,
5764
+ L: 194,
5758
5765
  S: this,
5759
5766
  C: (f, a) => f(...a)
5760
5767
  });
5761
5768
  guardedState.set(null, Invitation7.State.EXPIRED);
5762
5769
  void ctx.dispose().catch((err) => log18.catch(err, void 0, {
5763
5770
  F: __dxlog_file22,
5764
- L: 195,
5771
+ L: 196,
5765
5772
  S: this,
5766
5773
  C: (f, a) => f(...a)
5767
5774
  }));
@@ -5772,7 +5779,7 @@ var InvitationsHandler = class {
5772
5779
  guardedState.set(null, Invitation7.State.EXPIRED);
5773
5780
  metrics.increment("dxos.invitation.expired");
5774
5781
  await ctx.dispose();
5775
- }, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
5782
+ }, expiresOn.getTime() - Date.now());
5776
5783
  }
5777
5784
  let swarmConnection;
5778
5785
  scheduleTask7(ctx, async () => {
@@ -5788,7 +5795,7 @@ var InvitationsHandler = class {
5788
5795
  type: invitation.type
5789
5796
  }, {
5790
5797
  F: __dxlog_file22,
5791
- L: 226,
5798
+ L: 227,
5792
5799
  S: this,
5793
5800
  C: (f, a) => f(...a)
5794
5801
  });
@@ -5796,7 +5803,7 @@ var InvitationsHandler = class {
5796
5803
  if (deviceProfile) {
5797
5804
  invariant15(invitation.kind === Invitation7.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
5798
5805
  F: __dxlog_file22,
5799
- L: 235,
5806
+ L: 236,
5800
5807
  S: this,
5801
5808
  A: [
5802
5809
  "invitation.kind === Invitation.Kind.DEVICE",
@@ -5814,7 +5821,7 @@ var InvitationsHandler = class {
5814
5821
  triedPeers: triedPeersIds.size
5815
5822
  }, {
5816
5823
  F: __dxlog_file22,
5817
- L: 243,
5824
+ L: 244,
5818
5825
  S: this,
5819
5826
  C: (f, a) => f(...a)
5820
5827
  });
@@ -5841,7 +5848,7 @@ var InvitationsHandler = class {
5841
5848
  currentState: guardedState.current.state
5842
5849
  }, {
5843
5850
  F: __dxlog_file22,
5844
- L: 271,
5851
+ L: 272,
5845
5852
  S: this,
5846
5853
  C: (f, a) => f(...a)
5847
5854
  });
@@ -5859,7 +5866,7 @@ var InvitationsHandler = class {
5859
5866
  id: traceId
5860
5867
  }), {
5861
5868
  F: __dxlog_file22,
5862
- L: 283,
5869
+ L: 284,
5863
5870
  S: this,
5864
5871
  C: (f, a) => f(...a)
5865
5872
  });
@@ -5871,7 +5878,7 @@ var InvitationsHandler = class {
5871
5878
  ...protocol.toJSON()
5872
5879
  }, {
5873
5880
  F: __dxlog_file22,
5874
- L: 294,
5881
+ L: 295,
5875
5882
  S: this,
5876
5883
  C: (f, a) => f(...a)
5877
5884
  });
@@ -5881,7 +5888,7 @@ var InvitationsHandler = class {
5881
5888
  ...protocol.toJSON()
5882
5889
  }, {
5883
5890
  F: __dxlog_file22,
5884
- L: 298,
5891
+ L: 299,
5885
5892
  S: this,
5886
5893
  C: (f, a) => f(...a)
5887
5894
  });
@@ -5895,7 +5902,7 @@ var InvitationsHandler = class {
5895
5902
  authMethod: introductionResponse.authMethod
5896
5903
  }, {
5897
5904
  F: __dxlog_file22,
5898
- L: 306,
5905
+ L: 307,
5899
5906
  S: this,
5900
5907
  C: (f, a) => f(...a)
5901
5908
  });
@@ -5917,7 +5924,7 @@ var InvitationsHandler = class {
5917
5924
  ...protocol.toJSON()
5918
5925
  }, {
5919
5926
  F: __dxlog_file22,
5920
- L: 336,
5927
+ L: 337,
5921
5928
  S: this,
5922
5929
  C: (f, a) => f(...a)
5923
5930
  });
@@ -5930,7 +5937,7 @@ var InvitationsHandler = class {
5930
5937
  ...protocol.toJSON()
5931
5938
  }, {
5932
5939
  F: __dxlog_file22,
5933
- L: 350,
5940
+ L: 351,
5934
5941
  S: this,
5935
5942
  C: (f, a) => f(...a)
5936
5943
  });
@@ -5943,7 +5950,7 @@ var InvitationsHandler = class {
5943
5950
  id: traceId
5944
5951
  }), {
5945
5952
  F: __dxlog_file22,
5946
- L: 359,
5953
+ L: 360,
5947
5954
  S: this,
5948
5955
  C: (f, a) => f(...a)
5949
5956
  });
@@ -5953,7 +5960,7 @@ var InvitationsHandler = class {
5953
5960
  ...protocol.toJSON()
5954
5961
  }, {
5955
5962
  F: __dxlog_file22,
5956
- L: 362,
5963
+ L: 363,
5957
5964
  S: this,
5958
5965
  C: (f, a) => f(...a)
5959
5966
  });
@@ -5961,7 +5968,7 @@ var InvitationsHandler = class {
5961
5968
  } else {
5962
5969
  log18.verbose("auth failed", err, {
5963
5970
  F: __dxlog_file22,
5964
- L: 365,
5971
+ L: 366,
5965
5972
  S: this,
5966
5973
  C: (f, a) => f(...a)
5967
5974
  });
@@ -5973,7 +5980,7 @@ var InvitationsHandler = class {
5973
5980
  error: err
5974
5981
  }), {
5975
5982
  F: __dxlog_file22,
5976
- L: 369,
5983
+ L: 370,
5977
5984
  S: this,
5978
5985
  C: (f, a) => f(...a)
5979
5986
  });
@@ -5989,7 +5996,7 @@ var InvitationsHandler = class {
5989
5996
  ...protocol.toJSON()
5990
5997
  }, {
5991
5998
  F: __dxlog_file22,
5992
- L: 378,
5999
+ L: 379,
5993
6000
  S: this,
5994
6001
  C: (f, a) => f(...a)
5995
6002
  });
@@ -5997,7 +6004,7 @@ var InvitationsHandler = class {
5997
6004
  } else {
5998
6005
  log18.verbose("auth failed", err, {
5999
6006
  F: __dxlog_file22,
6000
- L: 381,
6007
+ L: 382,
6001
6008
  S: this,
6002
6009
  C: (f, a) => f(...a)
6003
6010
  });
@@ -6014,7 +6021,7 @@ var InvitationsHandler = class {
6014
6021
  ...protocol.toJSON()
6015
6022
  }, {
6016
6023
  F: __dxlog_file22,
6017
- L: 393,
6024
+ L: 394,
6018
6025
  S: this,
6019
6026
  C: (f, a) => f(...a)
6020
6027
  });
@@ -6027,14 +6034,14 @@ var InvitationsHandler = class {
6027
6034
  });
6028
6035
  edgeInvitationHandler.handle(ctx, guardedState, protocol, deviceProfile);
6029
6036
  scheduleTask7(ctx, async () => {
6030
- const error = protocol.checkInvitation(invitation);
6037
+ const error = checkInvitation(protocol, invitation);
6031
6038
  if (error) {
6032
6039
  stream.error(error);
6033
6040
  await ctx.dispose();
6034
6041
  } else {
6035
6042
  invariant15(invitation.swarmKey, void 0, {
6036
6043
  F: __dxlog_file22,
6037
- L: 405,
6044
+ L: 406,
6038
6045
  S: this,
6039
6046
  A: [
6040
6047
  "invitation.swarmKey",
@@ -6078,7 +6085,7 @@ var InvitationsHandler = class {
6078
6085
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
6079
6086
  log18("guest waiting for authentication code...", void 0, {
6080
6087
  F: __dxlog_file22,
6081
- L: 457,
6088
+ L: 458,
6082
6089
  S: this,
6083
6090
  C: (f, a) => f(...a)
6084
6091
  });
@@ -6086,7 +6093,7 @@ var InvitationsHandler = class {
6086
6093
  const authCode = await authenticated.wait(options);
6087
6094
  log18("sending authentication request", void 0, {
6088
6095
  F: __dxlog_file22,
6089
- L: 461,
6096
+ L: 462,
6090
6097
  S: this,
6091
6098
  C: (f, a) => f(...a)
6092
6099
  });
@@ -6105,7 +6112,7 @@ var InvitationsHandler = class {
6105
6112
  attempt
6106
6113
  }, {
6107
6114
  F: __dxlog_file22,
6108
- L: 472,
6115
+ L: 473,
6109
6116
  S: this,
6110
6117
  C: (f, a) => f(...a)
6111
6118
  });
@@ -6123,7 +6130,7 @@ var InvitationsHandler = class {
6123
6130
  }
6124
6131
  log18("sending authentication request", void 0, {
6125
6132
  F: __dxlog_file22,
6126
- L: 491,
6133
+ L: 492,
6127
6134
  S: this,
6128
6135
  C: (f, a) => f(...a)
6129
6136
  });
@@ -6136,6 +6143,13 @@ var InvitationsHandler = class {
6136
6143
  }
6137
6144
  }
6138
6145
  };
6146
+ var checkInvitation = (protocol, invitation) => {
6147
+ const expiresOn = getExpirationTime(invitation);
6148
+ if (expiresOn && expiresOn.getTime() < Date.now()) {
6149
+ return new InvalidInvitationError("Invitation already expired.");
6150
+ }
6151
+ return protocol.checkInvitation(invitation);
6152
+ };
6139
6153
  var createAdmissionKeypair = () => {
6140
6154
  const keypair = createKeyPair();
6141
6155
  return {
@@ -6250,7 +6264,7 @@ import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInv
6250
6264
  import { writeMessages as writeMessages4 } from "@dxos/feed-store";
6251
6265
  import { invariant as invariant16 } from "@dxos/invariant";
6252
6266
  import { log as log19 } from "@dxos/log";
6253
- import { AlreadyJoinedError as AlreadyJoinedError3, AuthorizationError as AuthorizationError2, InvalidInvitationError, SpaceNotFoundError as SpaceNotFoundError2 } from "@dxos/protocols";
6267
+ import { AlreadyJoinedError as AlreadyJoinedError3, AuthorizationError as AuthorizationError2, InvalidInvitationError as InvalidInvitationError2, SpaceNotFoundError as SpaceNotFoundError2 } from "@dxos/protocols";
6254
6268
  import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
6255
6269
  import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
6256
6270
  var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
@@ -6270,7 +6284,7 @@ var SpaceInvitationProtocol = class {
6270
6284
  }
6271
6285
  checkCanInviteNewMembers() {
6272
6286
  if (this._spaceKey == null) {
6273
- return new InvalidInvitationError("No spaceKey was provided for a space invitation.");
6287
+ return new InvalidInvitationError2("No spaceKey was provided for a space invitation.");
6274
6288
  }
6275
6289
  const space = this._spaceManager.spaces.get(this._spaceKey);
6276
6290
  if (space == null) {
@@ -6284,7 +6298,7 @@ var SpaceInvitationProtocol = class {
6284
6298
  getInvitationContext() {
6285
6299
  invariant16(this._spaceKey, void 0, {
6286
6300
  F: __dxlog_file23,
6287
- L: 64,
6301
+ L: 65,
6288
6302
  S: this,
6289
6303
  A: [
6290
6304
  "this._spaceKey",
@@ -6294,7 +6308,7 @@ var SpaceInvitationProtocol = class {
6294
6308
  const space = this._spaceManager.spaces.get(this._spaceKey);
6295
6309
  invariant16(space, void 0, {
6296
6310
  F: __dxlog_file23,
6297
- L: 66,
6311
+ L: 67,
6298
6312
  S: this,
6299
6313
  A: [
6300
6314
  "space",
@@ -6310,7 +6324,7 @@ var SpaceInvitationProtocol = class {
6310
6324
  async admit(invitation, request, guestProfile) {
6311
6325
  invariant16(this._spaceKey && request.space, void 0, {
6312
6326
  F: __dxlog_file23,
6313
- L: 79,
6327
+ L: 80,
6314
6328
  S: this,
6315
6329
  A: [
6316
6330
  "this._spaceKey && request.space",
@@ -6322,7 +6336,7 @@ var SpaceInvitationProtocol = class {
6322
6336
  guest: request.space.deviceKey
6323
6337
  }, {
6324
6338
  F: __dxlog_file23,
6325
- L: 80,
6339
+ L: 81,
6326
6340
  S: this,
6327
6341
  C: (f, a) => f(...a)
6328
6342
  });
@@ -6344,7 +6358,7 @@ var SpaceInvitationProtocol = class {
6344
6358
  async delegate(invitation) {
6345
6359
  invariant16(this._spaceKey, void 0, {
6346
6360
  F: __dxlog_file23,
6347
- L: 100,
6361
+ L: 101,
6348
6362
  S: this,
6349
6363
  A: [
6350
6364
  "this._spaceKey",
@@ -6354,7 +6368,7 @@ var SpaceInvitationProtocol = class {
6354
6368
  const space = this._spaceManager.spaces.get(this._spaceKey);
6355
6369
  invariant16(space, void 0, {
6356
6370
  F: __dxlog_file23,
6357
- L: 102,
6371
+ L: 103,
6358
6372
  S: this,
6359
6373
  A: [
6360
6374
  "space",
@@ -6364,7 +6378,7 @@ var SpaceInvitationProtocol = class {
6364
6378
  if (invitation.authMethod === Invitation8.AuthMethod.KNOWN_PUBLIC_KEY) {
6365
6379
  invariant16(invitation.guestKeypair?.publicKey, void 0, {
6366
6380
  F: __dxlog_file23,
6367
- L: 104,
6381
+ L: 105,
6368
6382
  S: this,
6369
6383
  A: [
6370
6384
  "invitation.guestKeypair?.publicKey",
@@ -6377,7 +6391,7 @@ var SpaceInvitationProtocol = class {
6377
6391
  id: invitation.invitationId
6378
6392
  }, {
6379
6393
  F: __dxlog_file23,
6380
- L: 107,
6394
+ L: 108,
6381
6395
  S: this,
6382
6396
  C: (f, a) => f(...a)
6383
6397
  });
@@ -6386,13 +6400,13 @@ var SpaceInvitationProtocol = class {
6386
6400
  authMethod: invitation.authMethod,
6387
6401
  swarmKey: invitation.swarmKey,
6388
6402
  role: invitation.role ?? SpaceMember6.Role.ADMIN,
6389
- expiresOn: invitation.lifetime ? new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime) : void 0,
6403
+ expiresOn: computeExpirationTime(invitation),
6390
6404
  multiUse: invitation.multiUse ?? false,
6391
6405
  guestKey: invitation.authMethod === Invitation8.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
6392
6406
  });
6393
6407
  invariant16(credential.credential, void 0, {
6394
6408
  F: __dxlog_file23,
6395
- L: 127,
6409
+ L: 126,
6396
6410
  S: this,
6397
6411
  A: [
6398
6412
  "credential.credential",
@@ -6407,7 +6421,7 @@ var SpaceInvitationProtocol = class {
6407
6421
  async cancelDelegation(invitation) {
6408
6422
  invariant16(this._spaceKey, void 0, {
6409
6423
  F: __dxlog_file23,
6410
- L: 133,
6424
+ L: 132,
6411
6425
  S: this,
6412
6426
  A: [
6413
6427
  "this._spaceKey",
@@ -6416,7 +6430,7 @@ var SpaceInvitationProtocol = class {
6416
6430
  });
6417
6431
  invariant16(invitation.type === Invitation8.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
6418
6432
  F: __dxlog_file23,
6419
- L: 134,
6433
+ L: 133,
6420
6434
  S: this,
6421
6435
  A: [
6422
6436
  "invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
@@ -6426,7 +6440,7 @@ var SpaceInvitationProtocol = class {
6426
6440
  const space = this._spaceManager.spaces.get(this._spaceKey);
6427
6441
  invariant16(space, void 0, {
6428
6442
  F: __dxlog_file23,
6429
- L: 136,
6443
+ L: 135,
6430
6444
  S: this,
6431
6445
  A: [
6432
6446
  "space",
@@ -6438,14 +6452,14 @@ var SpaceInvitationProtocol = class {
6438
6452
  id: invitation.invitationId
6439
6453
  }, {
6440
6454
  F: __dxlog_file23,
6441
- L: 138,
6455
+ L: 137,
6442
6456
  S: this,
6443
6457
  C: (f, a) => f(...a)
6444
6458
  });
6445
6459
  const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
6446
6460
  invariant16(credential.credential, void 0, {
6447
6461
  F: __dxlog_file23,
6448
- L: 145,
6462
+ L: 144,
6449
6463
  S: this,
6450
6464
  A: [
6451
6465
  "credential.credential",
@@ -6458,7 +6472,7 @@ var SpaceInvitationProtocol = class {
6458
6472
  }
6459
6473
  checkInvitation(invitation) {
6460
6474
  if (invitation.spaceKey == null) {
6461
- return new InvalidInvitationError("No spaceKey was provided for a space invitation.");
6475
+ return new InvalidInvitationError2("No spaceKey was provided for a space invitation.");
6462
6476
  }
6463
6477
  if (this._spaceManager.spaces.has(invitation.spaceKey)) {
6464
6478
  return new AlreadyJoinedError3("Already joined space.");
@@ -6484,7 +6498,7 @@ var SpaceInvitationProtocol = class {
6484
6498
  async accept(response) {
6485
6499
  invariant16(response.space, void 0, {
6486
6500
  F: __dxlog_file23,
6487
- L: 180,
6501
+ L: 179,
6488
6502
  S: this,
6489
6503
  A: [
6490
6504
  "response.space",
@@ -6495,7 +6509,7 @@ var SpaceInvitationProtocol = class {
6495
6509
  const assertion = getCredentialAssertion5(credential);
6496
6510
  invariant16(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
6497
6511
  F: __dxlog_file23,
6498
- L: 183,
6512
+ L: 182,
6499
6513
  S: this,
6500
6514
  A: [
6501
6515
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -6504,7 +6518,7 @@ var SpaceInvitationProtocol = class {
6504
6518
  });
6505
6519
  invariant16(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
6506
6520
  F: __dxlog_file23,
6507
- L: 184,
6521
+ L: 183,
6508
6522
  S: this,
6509
6523
  A: [
6510
6524
  "credential.subject.id.equals(this._signingContext.identityKey)",
@@ -6740,7 +6754,7 @@ var InvitationsManager = class {
6740
6754
  }
6741
6755
  }
6742
6756
  _createInvitation(protocol, _options) {
6743
- const { invitationId = PublicKey12.random().toHex(), type = Invitation9.Type.INTERACTIVE, authMethod = Invitation9.AuthMethod.SHARED_SECRET, state = Invitation9.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey12.random(), persistent = _options?.authMethod !== Invitation9.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = SpaceMember7.Role.ADMIN, lifetime = 86400, multiUse = false, ...options } = _options ?? {};
6757
+ const { invitationId = PublicKey12.random().toHex(), type = Invitation9.Type.INTERACTIVE, authMethod = Invitation9.AuthMethod.SHARED_SECRET, state = Invitation9.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey12.random(), persistent = _options?.authMethod !== Invitation9.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = SpaceMember7.Role.ADMIN, lifetime = 86400 * 7, multiUse = false, ...options } = _options ?? {};
6744
6758
  const authCode = options?.authCode ?? (authMethod === Invitation9.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
6745
6759
  return {
6746
6760
  invitationId,
@@ -9096,4 +9110,4 @@ export {
9096
9110
  importProfileData,
9097
9111
  ClientServicesHost
9098
9112
  };
9099
- //# sourceMappingURL=chunk-RFZHCLFI.mjs.map
9113
+ //# sourceMappingURL=chunk-O46EJ5BJ.mjs.map