@dxos/client-services 0.4.10-main.c42bfdb → 0.4.10-main.cb83c78

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 (40) hide show
  1. package/dist/lib/browser/{chunk-W7UANCHR.mjs → chunk-MR3A4F5A.mjs} +216 -149
  2. package/dist/lib/browser/chunk-MR3A4F5A.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +3 -3
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +9 -4
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/{chunk-JSVLZGJM.cjs → chunk-SICZTC25.cjs} +230 -163
  8. package/dist/lib/node/chunk-SICZTC25.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +43 -43
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +14 -9
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/indexing/util.d.ts +2 -1
  14. package/dist/types/src/packlets/indexing/util.d.ts.map +1 -1
  15. package/dist/types/src/packlets/invitations/invitation-extension.d.ts +1 -0
  16. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -2
  18. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  19. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  20. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-host.d.ts +3 -1
  22. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  23. package/dist/types/src/packlets/testing/test-builder.d.ts +3 -1
  24. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  25. package/dist/types/src/version.d.ts +1 -1
  26. package/package.json +34 -34
  27. package/src/packlets/indexing/util.ts +2 -2
  28. package/src/packlets/invitations/invitation-extension.ts +28 -1
  29. package/src/packlets/invitations/invitations-handler.ts +73 -32
  30. package/src/packlets/invitations/invitations-service.ts +5 -5
  31. package/src/packlets/services/automerge-host.test.ts +9 -3
  32. package/src/packlets/services/service-context.test.ts +4 -1
  33. package/src/packlets/services/service-context.ts +5 -3
  34. package/src/packlets/services/service-host.ts +14 -3
  35. package/src/packlets/spaces/data-space-manager.test.ts +4 -4
  36. package/src/packlets/storage/level.ts +1 -1
  37. package/src/packlets/testing/test-builder.ts +20 -4
  38. package/src/version.ts +1 -1
  39. package/dist/lib/browser/chunk-W7UANCHR.mjs.map +0 -7
  40. package/dist/lib/node/chunk-JSVLZGJM.cjs.map +0 -7
@@ -1282,6 +1282,7 @@ import { PushStream, scheduleTask as scheduleTask2, TimeoutError, Trigger as Tri
1282
1282
  import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvitation, INVITATION_TIMEOUT } from "@dxos/client-protocol";
1283
1283
  import { Context as Context5 } from "@dxos/context";
1284
1284
  import { generatePasscode } from "@dxos/credentials";
1285
+ import { createKeyPair, sign } from "@dxos/crypto";
1285
1286
  import { invariant as invariant6 } from "@dxos/invariant";
1286
1287
  import { PublicKey as PublicKey6 } from "@dxos/keys";
1287
1288
  import { log as log5 } from "@dxos/log";
@@ -1293,6 +1294,7 @@ import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protoco
1293
1294
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
1294
1295
  import { Trigger as Trigger2 } from "@dxos/async";
1295
1296
  import { cancelWithContext, Context as Context4 } from "@dxos/context";
1297
+ import { randomBytes, verify } from "@dxos/crypto";
1296
1298
  import { invariant as invariant5 } from "@dxos/invariant";
1297
1299
  import { PublicKey as PublicKey5 } from "@dxos/keys";
1298
1300
  import { log as log4 } from "@dxos/log";
@@ -1316,6 +1318,7 @@ var InvitationHostExtension = class extends RpcExtension {
1316
1318
  this._callbacks = _callbacks;
1317
1319
  this._ctx = new Context4();
1318
1320
  this._remoteOptionsTrigger = new Trigger2();
1321
+ this._challenge = void 0;
1319
1322
  this.invitation = void 0;
1320
1323
  this.guestProfile = void 0;
1321
1324
  this.authenticationPassed = false;
@@ -1330,7 +1333,7 @@ var InvitationHostExtension = class extends RpcExtension {
1330
1333
  options: async (options) => {
1331
1334
  invariant5(!this._remoteOptions, "Remote options already set.", {
1332
1335
  F: __dxlog_file6,
1333
- L: 87,
1336
+ L: 90,
1334
1337
  S: this,
1335
1338
  A: [
1336
1339
  "!this._remoteOptions",
@@ -1347,7 +1350,7 @@ var InvitationHostExtension = class extends RpcExtension {
1347
1350
  id: traceId
1348
1351
  }), {
1349
1352
  F: __dxlog_file6,
1350
- L: 96,
1353
+ L: 99,
1351
1354
  S: this,
1352
1355
  C: (f, a) => f(...a)
1353
1356
  });
@@ -1357,7 +1360,7 @@ var InvitationHostExtension = class extends RpcExtension {
1357
1360
  invitationId
1358
1361
  }, {
1359
1362
  F: __dxlog_file6,
1360
- L: 100,
1363
+ L: 103,
1361
1364
  S: this,
1362
1365
  C: (f, a) => f(...a)
1363
1366
  });
@@ -1371,7 +1374,7 @@ var InvitationHostExtension = class extends RpcExtension {
1371
1374
  guestProfile: profile
1372
1375
  }, {
1373
1376
  F: __dxlog_file6,
1374
- L: 109,
1377
+ L: 112,
1375
1378
  S: this,
1376
1379
  C: (f, a) => f(...a)
1377
1380
  });
@@ -1380,25 +1383,27 @@ var InvitationHostExtension = class extends RpcExtension {
1380
1383
  ...this.invitation,
1381
1384
  state: Invitation2.State.READY_FOR_AUTHENTICATION
1382
1385
  });
1386
+ this._challenge = this.invitation.authMethod === Invitation2.AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
1383
1387
  log4.trace("dxos.sdk.invitation-handler.host.introduce", trace3.end({
1384
1388
  id: traceId
1385
1389
  }), {
1386
1390
  F: __dxlog_file6,
1387
- L: 116,
1391
+ L: 122,
1388
1392
  S: this,
1389
1393
  C: (f, a) => f(...a)
1390
1394
  });
1391
1395
  return {
1392
- authMethod: this.invitation.authMethod
1396
+ authMethod: this.invitation.authMethod,
1397
+ challenge: this._challenge
1393
1398
  };
1394
1399
  },
1395
- authenticate: async ({ authCode: code }) => {
1400
+ authenticate: async ({ authCode: code, signedChallenge }) => {
1396
1401
  const traceId = PublicKey5.random().toHex();
1397
1402
  log4.trace("dxos.sdk.invitation-handler.host.authenticate", trace3.begin({
1398
1403
  id: traceId
1399
1404
  }), {
1400
1405
  F: __dxlog_file6,
1401
- L: 124,
1406
+ L: 131,
1402
1407
  S: this,
1403
1408
  C: (f, a) => f(...a)
1404
1409
  });
@@ -1406,14 +1411,14 @@ var InvitationHostExtension = class extends RpcExtension {
1406
1411
  authCode: code
1407
1412
  }, {
1408
1413
  F: __dxlog_file6,
1409
- L: 125,
1414
+ L: 132,
1410
1415
  S: this,
1411
1416
  C: (f, a) => f(...a)
1412
1417
  });
1413
1418
  let status = AuthenticationResponse.Status.OK;
1414
1419
  invariant5(this.invitation, "Invitation is not set.", {
1415
1420
  F: __dxlog_file6,
1416
- L: 128,
1421
+ L: 135,
1417
1422
  S: this,
1418
1423
  A: [
1419
1424
  "this.invitation",
@@ -1424,7 +1429,7 @@ var InvitationHostExtension = class extends RpcExtension {
1424
1429
  case Invitation2.AuthMethod.NONE: {
1425
1430
  log4("authentication not required", void 0, {
1426
1431
  F: __dxlog_file6,
1427
- L: 131,
1432
+ L: 138,
1428
1433
  S: this,
1429
1434
  C: (f, a) => f(...a)
1430
1435
  });
@@ -1444,12 +1449,25 @@ var InvitationHostExtension = class extends RpcExtension {
1444
1449
  }
1445
1450
  break;
1446
1451
  }
1452
+ case Invitation2.AuthMethod.KNOWN_PUBLIC_KEY: {
1453
+ if (!this.invitation.guestKeypair) {
1454
+ status = AuthenticationResponse.Status.INTERNAL_ERROR;
1455
+ break;
1456
+ }
1457
+ const isSignatureValid = this._challenge && verify(this._challenge, Buffer.from(signedChallenge ?? []), this.invitation.guestKeypair.publicKey.asBuffer());
1458
+ if (isSignatureValid) {
1459
+ this.authenticationPassed = true;
1460
+ } else {
1461
+ status = AuthenticationResponse.Status.INVALID_SIGNATURE;
1462
+ }
1463
+ break;
1464
+ }
1447
1465
  default: {
1448
1466
  log4.error("invalid authentication method", {
1449
1467
  authMethod: this.invitation.authMethod
1450
1468
  }, {
1451
1469
  F: __dxlog_file6,
1452
- L: 149,
1470
+ L: 176,
1453
1471
  S: this,
1454
1472
  C: (f, a) => f(...a)
1455
1473
  });
@@ -1464,7 +1482,7 @@ var InvitationHostExtension = class extends RpcExtension {
1464
1482
  }
1465
1483
  }), {
1466
1484
  F: __dxlog_file6,
1467
- L: 155,
1485
+ L: 182,
1468
1486
  S: this,
1469
1487
  C: (f, a) => f(...a)
1470
1488
  });
@@ -1478,14 +1496,14 @@ var InvitationHostExtension = class extends RpcExtension {
1478
1496
  id: traceId
1479
1497
  }), {
1480
1498
  F: __dxlog_file6,
1481
- L: 161,
1499
+ L: 188,
1482
1500
  S: this,
1483
1501
  C: (f, a) => f(...a)
1484
1502
  });
1485
1503
  try {
1486
1504
  invariant5(this.invitation, "Invitation is not set.", {
1487
1505
  F: __dxlog_file6,
1488
- L: 164,
1506
+ L: 191,
1489
1507
  S: this,
1490
1508
  A: [
1491
1509
  "this.invitation",
@@ -1500,7 +1518,7 @@ var InvitationHostExtension = class extends RpcExtension {
1500
1518
  id: traceId
1501
1519
  }), {
1502
1520
  F: __dxlog_file6,
1503
- L: 172,
1521
+ L: 199,
1504
1522
  S: this,
1505
1523
  C: (f, a) => f(...a)
1506
1524
  });
@@ -1557,7 +1575,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1557
1575
  options: async (options) => {
1558
1576
  invariant5(!this._remoteOptions, "Remote options already set.", {
1559
1577
  F: __dxlog_file6,
1560
- L: 239,
1578
+ L: 266,
1561
1579
  S: this,
1562
1580
  A: [
1563
1581
  "!this._remoteOptions",
@@ -1584,7 +1602,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1584
1602
  try {
1585
1603
  log4("begin options", void 0, {
1586
1604
  F: __dxlog_file6,
1587
- L: 260,
1605
+ L: 287,
1588
1606
  S: this,
1589
1607
  C: (f, a) => f(...a)
1590
1608
  });
@@ -1596,7 +1614,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1596
1614
  }));
1597
1615
  log4("end options", void 0, {
1598
1616
  F: __dxlog_file6,
1599
- L: 263,
1617
+ L: 290,
1600
1618
  S: this,
1601
1619
  C: (f, a) => f(...a)
1602
1620
  });
@@ -1610,7 +1628,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1610
1628
  } catch (err) {
1611
1629
  log4("openError", err, {
1612
1630
  F: __dxlog_file6,
1613
- L: 273,
1631
+ L: 300,
1614
1632
  S: this,
1615
1633
  C: (f, a) => f(...a)
1616
1634
  });
@@ -1620,7 +1638,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1620
1638
  async onClose() {
1621
1639
  log4("onClose", void 0, {
1622
1640
  F: __dxlog_file6,
1623
- L: 279,
1641
+ L: 306,
1624
1642
  S: this,
1625
1643
  C: (f, a) => f(...a)
1626
1644
  });
@@ -1639,11 +1657,11 @@ var InvitationsHandler = class {
1639
1657
  this._networkManager = _networkManager;
1640
1658
  }
1641
1659
  createInvitation(protocol, options) {
1642
- const { invitationId = PublicKey6.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey6.random(), persistent = true, created = /* @__PURE__ */ new Date(), lifetime = 86400 } = options ?? {};
1660
+ const { invitationId = PublicKey6.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey6.random(), persistent = options?.authMethod !== Invitation3.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, lifetime = 86400, multiUse = false } = options ?? {};
1643
1661
  const authCode = options?.authCode ?? (authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
1644
1662
  invariant6(protocol, void 0, {
1645
1663
  F: __dxlog_file7,
1646
- L: 84,
1664
+ L: 87,
1647
1665
  S: this,
1648
1666
  A: [
1649
1667
  "protocol",
@@ -1658,9 +1676,11 @@ var InvitationsHandler = class {
1658
1676
  swarmKey,
1659
1677
  authCode,
1660
1678
  timeout,
1661
- persistent,
1679
+ persistent: persistent && type !== Invitation3.Type.DELEGATED,
1680
+ guestKeypair: guestKeypair ?? (authMethod === Invitation3.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
1662
1681
  created,
1663
1682
  lifetime,
1683
+ multiUse,
1664
1684
  ...protocol.getInvitationContext()
1665
1685
  };
1666
1686
  const stream = new PushStream();
@@ -1675,7 +1695,7 @@ var InvitationsHandler = class {
1675
1695
  ...protocol.toJSON()
1676
1696
  }, {
1677
1697
  F: __dxlog_file7,
1678
- L: 109,
1698
+ L: 115,
1679
1699
  S: this,
1680
1700
  C: (f, a) => f(...a)
1681
1701
  });
@@ -1700,7 +1720,7 @@ var InvitationsHandler = class {
1700
1720
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1701
1721
  invariant6(deviceKey, void 0, {
1702
1722
  F: __dxlog_file7,
1703
- L: 130,
1723
+ L: 136,
1704
1724
  S: this,
1705
1725
  A: [
1706
1726
  "deviceKey",
@@ -1723,7 +1743,7 @@ var InvitationsHandler = class {
1723
1743
  id: traceId
1724
1744
  }), {
1725
1745
  F: __dxlog_file7,
1726
- L: 148,
1746
+ L: 154,
1727
1747
  S: this,
1728
1748
  C: (f, a) => f(...a)
1729
1749
  });
@@ -1731,7 +1751,7 @@ var InvitationsHandler = class {
1731
1751
  ...protocol.toJSON()
1732
1752
  }, {
1733
1753
  F: __dxlog_file7,
1734
- L: 149,
1754
+ L: 155,
1735
1755
  S: this,
1736
1756
  C: (f, a) => f(...a)
1737
1757
  });
@@ -1747,7 +1767,7 @@ var InvitationsHandler = class {
1747
1767
  ...protocol.toJSON()
1748
1768
  }, {
1749
1769
  F: __dxlog_file7,
1750
- L: 152,
1770
+ L: 158,
1751
1771
  S: this,
1752
1772
  C: (f, a) => f(...a)
1753
1773
  });
@@ -1759,7 +1779,7 @@ var InvitationsHandler = class {
1759
1779
  id: traceId
1760
1780
  }), {
1761
1781
  F: __dxlog_file7,
1762
- L: 154,
1782
+ L: 160,
1763
1783
  S: this,
1764
1784
  C: (f, a) => f(...a)
1765
1785
  });
@@ -1769,7 +1789,7 @@ var InvitationsHandler = class {
1769
1789
  ...protocol.toJSON()
1770
1790
  }, {
1771
1791
  F: __dxlog_file7,
1772
- L: 157,
1792
+ L: 163,
1773
1793
  S: this,
1774
1794
  C: (f, a) => f(...a)
1775
1795
  });
@@ -1780,7 +1800,7 @@ var InvitationsHandler = class {
1780
1800
  } else {
1781
1801
  log5.error("failed", err, {
1782
1802
  F: __dxlog_file7,
1783
- L: 160,
1803
+ L: 166,
1784
1804
  S: this,
1785
1805
  C: (f, a) => f(...a)
1786
1806
  });
@@ -1791,12 +1811,12 @@ var InvitationsHandler = class {
1791
1811
  error: err
1792
1812
  }), {
1793
1813
  F: __dxlog_file7,
1794
- L: 163,
1814
+ L: 169,
1795
1815
  S: this,
1796
1816
  C: (f, a) => f(...a)
1797
1817
  });
1798
1818
  } finally {
1799
- if (type !== Invitation3.Type.MULTIUSE) {
1819
+ if (!multiUse) {
1800
1820
  await swarmConnection.close();
1801
1821
  await ctx.dispose();
1802
1822
  }
@@ -1812,7 +1832,7 @@ var InvitationsHandler = class {
1812
1832
  ...protocol.toJSON()
1813
1833
  }, {
1814
1834
  F: __dxlog_file7,
1815
- L: 178,
1835
+ L: 184,
1816
1836
  S: this,
1817
1837
  C: (f, a) => f(...a)
1818
1838
  });
@@ -1823,7 +1843,7 @@ var InvitationsHandler = class {
1823
1843
  } else {
1824
1844
  log5.error("failed", err, {
1825
1845
  F: __dxlog_file7,
1826
- L: 181,
1846
+ L: 187,
1827
1847
  S: this,
1828
1848
  C: (f, a) => f(...a)
1829
1849
  });
@@ -1837,7 +1857,7 @@ var InvitationsHandler = class {
1837
1857
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
1838
1858
  log5.warn("invitation has already expired", void 0, {
1839
1859
  F: __dxlog_file7,
1840
- L: 192,
1860
+ L: 198,
1841
1861
  S: this,
1842
1862
  C: (f, a) => f(...a)
1843
1863
  });
@@ -1888,7 +1908,7 @@ var InvitationsHandler = class {
1888
1908
  const { timeout = INVITATION_TIMEOUT } = invitation;
1889
1909
  invariant6(protocol, void 0, {
1890
1910
  F: __dxlog_file7,
1891
- L: 246,
1911
+ L: 252,
1892
1912
  S: this,
1893
1913
  A: [
1894
1914
  "protocol",
@@ -1898,7 +1918,7 @@ var InvitationsHandler = class {
1898
1918
  if (deviceProfile) {
1899
1919
  invariant6(invitation.kind === Invitation3.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
1900
1920
  F: __dxlog_file7,
1901
- L: 250,
1921
+ L: 256,
1902
1922
  S: this,
1903
1923
  A: [
1904
1924
  "invitation.kind === Invitation.Kind.DEVICE",
@@ -1913,7 +1933,7 @@ var InvitationsHandler = class {
1913
1933
  const setState = (newData) => {
1914
1934
  invariant6(newData.state !== void 0, void 0, {
1915
1935
  F: __dxlog_file7,
1916
- L: 261,
1936
+ L: 267,
1917
1937
  S: this,
1918
1938
  A: [
1919
1939
  "newData.state !== undefined",
@@ -1933,7 +1953,7 @@ var InvitationsHandler = class {
1933
1953
  ...protocol.toJSON()
1934
1954
  }, {
1935
1955
  F: __dxlog_file7,
1936
- L: 269,
1956
+ L: 275,
1937
1957
  S: this,
1938
1958
  C: (f, a) => f(...a)
1939
1959
  });
@@ -1943,7 +1963,7 @@ var InvitationsHandler = class {
1943
1963
  } else {
1944
1964
  log5.warn("auth failed", err, {
1945
1965
  F: __dxlog_file7,
1946
- L: 272,
1966
+ L: 278,
1947
1967
  S: this,
1948
1968
  C: (f, a) => f(...a)
1949
1969
  });
@@ -1957,7 +1977,7 @@ var InvitationsHandler = class {
1957
1977
  ...protocol.toJSON()
1958
1978
  }, {
1959
1979
  F: __dxlog_file7,
1960
- L: 280,
1980
+ L: 286,
1961
1981
  S: this,
1962
1982
  C: (f, a) => f(...a)
1963
1983
  });
@@ -1972,7 +1992,7 @@ var InvitationsHandler = class {
1972
1992
  currentState
1973
1993
  }, {
1974
1994
  F: __dxlog_file7,
1975
- L: 290,
1995
+ L: 296,
1976
1996
  S: this,
1977
1997
  C: (f, a) => f(...a)
1978
1998
  });
@@ -1987,7 +2007,7 @@ var InvitationsHandler = class {
1987
2007
  id: traceId
1988
2008
  }), {
1989
2009
  F: __dxlog_file7,
1990
- L: 299,
2010
+ L: 305,
1991
2011
  S: this,
1992
2012
  C: (f, a) => f(...a)
1993
2013
  });
@@ -1999,7 +2019,7 @@ var InvitationsHandler = class {
1999
2019
  ...protocol.toJSON()
2000
2020
  }, {
2001
2021
  F: __dxlog_file7,
2002
- L: 307,
2022
+ L: 313,
2003
2023
  S: this,
2004
2024
  C: (f, a) => f(...a)
2005
2025
  });
@@ -2010,7 +2030,7 @@ var InvitationsHandler = class {
2010
2030
  ...protocol.toJSON()
2011
2031
  }, {
2012
2032
  F: __dxlog_file7,
2013
- L: 311,
2033
+ L: 317,
2014
2034
  S: this,
2015
2035
  C: (f, a) => f(...a)
2016
2036
  });
@@ -2020,62 +2040,28 @@ var InvitationsHandler = class {
2020
2040
  response: introductionResponse
2021
2041
  }, {
2022
2042
  F: __dxlog_file7,
2023
- L: 315,
2043
+ L: 321,
2024
2044
  S: this,
2025
2045
  C: (f, a) => f(...a)
2026
2046
  });
2027
2047
  invitation.authMethod = introductionResponse.authMethod;
2028
2048
  if (isAuthenticationRequired(invitation)) {
2029
- for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2030
- log5("guest waiting for authentication code...", void 0, {
2031
- F: __dxlog_file7,
2032
- L: 321,
2033
- S: this,
2034
- C: (f, a) => f(...a)
2035
- });
2036
- setState({
2037
- state: Invitation3.State.READY_FOR_AUTHENTICATION
2038
- });
2039
- const authCode = await authenticated.wait({
2040
- timeout
2041
- });
2042
- log5("sending authentication request", void 0, {
2043
- F: __dxlog_file7,
2044
- L: 325,
2045
- S: this,
2046
- C: (f, a) => f(...a)
2047
- });
2048
- setState({
2049
- state: Invitation3.State.AUTHENTICATING
2050
- });
2051
- const response = await extension.rpc.InvitationHostService.authenticate({
2052
- authCode
2053
- });
2054
- if (response.status === void 0 || response.status === AuthenticationResponse2.Status.OK) {
2049
+ switch (invitation.authMethod) {
2050
+ case Invitation3.AuthMethod.SHARED_SECRET:
2051
+ await this._handleGuestOtpAuth(extension, setState, authenticated, {
2052
+ timeout
2053
+ });
2054
+ break;
2055
+ case Invitation3.AuthMethod.KNOWN_PUBLIC_KEY:
2056
+ await this._handleGuestKpkAuth(extension, setState, invitation, introductionResponse);
2055
2057
  break;
2056
- }
2057
- if (response.status === AuthenticationResponse2.Status.INVALID_OTP) {
2058
- if (attempt === MAX_OTP_ATTEMPTS) {
2059
- throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
2060
- } else {
2061
- log5("retrying invalid code", {
2062
- attempt
2063
- }, {
2064
- F: __dxlog_file7,
2065
- L: 336,
2066
- S: this,
2067
- C: (f, a) => f(...a)
2068
- });
2069
- authenticated.reset();
2070
- }
2071
- }
2072
2058
  }
2073
2059
  }
2074
2060
  log5("request admission", {
2075
2061
  ...protocol.toJSON()
2076
2062
  }, {
2077
2063
  F: __dxlog_file7,
2078
- L: 344,
2064
+ L: 337,
2079
2065
  S: this,
2080
2066
  C: (f, a) => f(...a)
2081
2067
  });
@@ -2087,7 +2073,7 @@ var InvitationsHandler = class {
2087
2073
  ...protocol.toJSON()
2088
2074
  }, {
2089
2075
  F: __dxlog_file7,
2090
- L: 355,
2076
+ L: 348,
2091
2077
  S: this,
2092
2078
  C: (f, a) => f(...a)
2093
2079
  });
@@ -2100,7 +2086,7 @@ var InvitationsHandler = class {
2100
2086
  id: traceId
2101
2087
  }), {
2102
2088
  F: __dxlog_file7,
2103
- L: 357,
2089
+ L: 350,
2104
2090
  S: this,
2105
2091
  C: (f, a) => f(...a)
2106
2092
  });
@@ -2110,7 +2096,7 @@ var InvitationsHandler = class {
2110
2096
  ...protocol.toJSON()
2111
2097
  }, {
2112
2098
  F: __dxlog_file7,
2113
- L: 360,
2099
+ L: 353,
2114
2100
  S: this,
2115
2101
  C: (f, a) => f(...a)
2116
2102
  });
@@ -2120,7 +2106,7 @@ var InvitationsHandler = class {
2120
2106
  } else {
2121
2107
  log5("auth failed", err, {
2122
2108
  F: __dxlog_file7,
2123
- L: 363,
2109
+ L: 356,
2124
2110
  S: this,
2125
2111
  C: (f, a) => f(...a)
2126
2112
  });
@@ -2131,7 +2117,7 @@ var InvitationsHandler = class {
2131
2117
  error: err
2132
2118
  }), {
2133
2119
  F: __dxlog_file7,
2134
- L: 366,
2120
+ L: 359,
2135
2121
  S: this,
2136
2122
  C: (f, a) => f(...a)
2137
2123
  });
@@ -2149,7 +2135,7 @@ var InvitationsHandler = class {
2149
2135
  ...protocol.toJSON()
2150
2136
  }, {
2151
2137
  F: __dxlog_file7,
2152
- L: 377,
2138
+ L: 370,
2153
2139
  S: this,
2154
2140
  C: (f, a) => f(...a)
2155
2141
  });
@@ -2159,7 +2145,7 @@ var InvitationsHandler = class {
2159
2145
  } else {
2160
2146
  log5("auth failed", err, {
2161
2147
  F: __dxlog_file7,
2162
- L: 380,
2148
+ L: 373,
2163
2149
  S: this,
2164
2150
  C: (f, a) => f(...a)
2165
2151
  });
@@ -2176,7 +2162,7 @@ var InvitationsHandler = class {
2176
2162
  } else {
2177
2163
  invariant6(invitation.swarmKey, void 0, {
2178
2164
  F: __dxlog_file7,
2179
- L: 394,
2165
+ L: 387,
2180
2166
  S: this,
2181
2167
  A: [
2182
2168
  "invitation.swarmKey",
@@ -2214,15 +2200,88 @@ var InvitationsHandler = class {
2214
2200
  });
2215
2201
  return observable;
2216
2202
  }
2203
+ async _handleGuestOtpAuth(extension, setState, authenticated, options) {
2204
+ for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2205
+ log5("guest waiting for authentication code...", void 0, {
2206
+ F: __dxlog_file7,
2207
+ L: 427,
2208
+ S: this,
2209
+ C: (f, a) => f(...a)
2210
+ });
2211
+ setState({
2212
+ state: Invitation3.State.READY_FOR_AUTHENTICATION
2213
+ });
2214
+ const authCode = await authenticated.wait(options);
2215
+ log5("sending authentication request", void 0, {
2216
+ F: __dxlog_file7,
2217
+ L: 431,
2218
+ S: this,
2219
+ C: (f, a) => f(...a)
2220
+ });
2221
+ setState({
2222
+ state: Invitation3.State.AUTHENTICATING
2223
+ });
2224
+ const response = await extension.rpc.InvitationHostService.authenticate({
2225
+ authCode
2226
+ });
2227
+ if (response.status === void 0 || response.status === AuthenticationResponse2.Status.OK) {
2228
+ break;
2229
+ }
2230
+ if (response.status === AuthenticationResponse2.Status.INVALID_OTP) {
2231
+ if (attempt === MAX_OTP_ATTEMPTS) {
2232
+ throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
2233
+ } else {
2234
+ log5("retrying invalid code", {
2235
+ attempt
2236
+ }, {
2237
+ F: __dxlog_file7,
2238
+ L: 442,
2239
+ S: this,
2240
+ C: (f, a) => f(...a)
2241
+ });
2242
+ authenticated.reset();
2243
+ }
2244
+ }
2245
+ }
2246
+ }
2247
+ async _handleGuestKpkAuth(extension, setState, invitation, introductionResponse) {
2248
+ if (invitation.guestKeypair?.privateKey == null) {
2249
+ throw new Error("keypair missing in the invitation");
2250
+ }
2251
+ if (introductionResponse.challenge == null) {
2252
+ throw new Error("challenge missing in the introduction");
2253
+ }
2254
+ log5("sending authentication request", void 0, {
2255
+ F: __dxlog_file7,
2256
+ L: 461,
2257
+ S: this,
2258
+ C: (f, a) => f(...a)
2259
+ });
2260
+ setState({
2261
+ state: Invitation3.State.AUTHENTICATING
2262
+ });
2263
+ const signature = sign(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
2264
+ const response = await extension.rpc.InvitationHostService.authenticate({
2265
+ signedChallenge: signature
2266
+ });
2267
+ if (response.status !== AuthenticationResponse2.Status.OK) {
2268
+ throw new Error(`Authentication failed with code: ${response.status}`);
2269
+ }
2270
+ }
2217
2271
  };
2218
- var invitationExpired = (invitation) => {
2219
- return invitation.created && invitation.lifetime && invitation.lifetime !== 0 && invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now();
2272
+ var createAdmissionKeypair = () => {
2273
+ const keypair = createKeyPair();
2274
+ return {
2275
+ publicKey: PublicKey6.from(keypair.publicKey),
2276
+ privateKey: keypair.secretKey
2277
+ };
2220
2278
  };
2221
2279
 
2222
2280
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
2223
2281
  import { Event as Event3, scheduleTask as scheduleTask3 } from "@dxos/async";
2224
2282
  import { Stream as Stream8 } from "@dxos/codec-protobuf";
2225
2283
  import { Context as Context6 } from "@dxos/context";
2284
+ import { hasInvitationExpired } from "@dxos/echo-pipeline";
2226
2285
  import { invariant as invariant7 } from "@dxos/invariant";
2227
2286
  import { log as log6 } from "@dxos/log";
2228
2287
  import { Invitation as Invitation4, QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
@@ -2281,7 +2340,7 @@ var InvitationsServiceImpl = class {
2281
2340
  await this._metadataStore.removeInvitation(invitation.get().invitationId);
2282
2341
  }
2283
2342
  this._createInvitations.delete(invitation.get().invitationId);
2284
- if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
2343
+ if (!invitation.get().multiUse) {
2285
2344
  this._removedCreated.emit(invitation.get());
2286
2345
  }
2287
2346
  });
@@ -2289,7 +2348,7 @@ var InvitationsServiceImpl = class {
2289
2348
  }
2290
2349
  async loadPersistentInvitations() {
2291
2350
  const persistentInvitations = this._metadataStore.getInvitations();
2292
- const freshInvitations = persistentInvitations.filter(async (invitation) => !invitationExpired(invitation));
2351
+ const freshInvitations = persistentInvitations.filter(async (invitation) => !hasInvitationExpired(invitation));
2293
2352
  const cInvitations = freshInvitations.map((persistentInvitation) => {
2294
2353
  invariant7(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
2295
2354
  F: __dxlog_file8,
@@ -2342,7 +2401,7 @@ var InvitationsServiceImpl = class {
2342
2401
  }, () => {
2343
2402
  close();
2344
2403
  this._acceptInvitations.delete(invitation.get().invitationId);
2345
- if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
2404
+ if (!invitation.get().multiUse) {
2346
2405
  this._removedAccepted.emit(invitation.get());
2347
2406
  }
2348
2407
  });
@@ -4241,7 +4300,7 @@ import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credent
4241
4300
  import { failUndefined as failUndefined2 } from "@dxos/debug";
4242
4301
  import { AutomergeHost, MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
4243
4302
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
4244
- import { IndexMetadataStore, IndexStore, Indexer } from "@dxos/indexing";
4303
+ import { IndexMetadataStore, IndexStore, Indexer, createStorageCallbacks } from "@dxos/indexing";
4245
4304
  import { invariant as invariant13 } from "@dxos/invariant";
4246
4305
  import { Keyring } from "@dxos/keyring";
4247
4306
  import { PublicKey as PublicKey10 } from "@dxos/keys";
@@ -4381,11 +4440,15 @@ var ServiceContext = class extends Resource {
4381
4440
  });
4382
4441
  this.automergeHost = new AutomergeHost({
4383
4442
  directory: storage.createDirectory("automerge"),
4384
- metadata: this.indexMetadata
4443
+ db: level.sublevel("automerge"),
4444
+ storageCallbacks: createStorageCallbacks({
4445
+ host: () => this.automergeHost,
4446
+ metadata: this.indexMetadata
4447
+ })
4385
4448
  });
4386
4449
  this.indexer = new Indexer({
4387
4450
  indexStore: new IndexStore({
4388
- directory: storage.createDirectory("index-store")
4451
+ db: level.sublevel("index-store")
4389
4452
  }),
4390
4453
  metadataStore: this.indexMetadata,
4391
4454
  loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
@@ -4398,7 +4461,7 @@ var ServiceContext = class extends Resource {
4398
4461
  await this._checkStorageVersion();
4399
4462
  log12("opening...", void 0, {
4400
4463
  F: __dxlog_file14,
4401
- L: 156,
4464
+ L: 157,
4402
4465
  S: this,
4403
4466
  C: (f, a) => f(...a)
4404
4467
  });
@@ -4406,12 +4469,13 @@ var ServiceContext = class extends Resource {
4406
4469
  id: this._instanceId
4407
4470
  }), {
4408
4471
  F: __dxlog_file14,
4409
- L: 157,
4472
+ L: 158,
4410
4473
  S: this,
4411
4474
  C: (f, a) => f(...a)
4412
4475
  });
4413
4476
  await this.signalManager.open();
4414
4477
  await this.networkManager.open();
4478
+ await this.automergeHost.open();
4415
4479
  await this.metadataStore.load();
4416
4480
  await this.spaceManager.open();
4417
4481
  await this.identityManager.open(ctx);
@@ -4422,13 +4486,13 @@ var ServiceContext = class extends Resource {
4422
4486
  id: this._instanceId
4423
4487
  }), {
4424
4488
  F: __dxlog_file14,
4425
- L: 167,
4489
+ L: 169,
4426
4490
  S: this,
4427
4491
  C: (f, a) => f(...a)
4428
4492
  });
4429
4493
  log12("opened", void 0, {
4430
4494
  F: __dxlog_file14,
4431
- L: 168,
4495
+ L: 170,
4432
4496
  S: this,
4433
4497
  C: (f, a) => f(...a)
4434
4498
  });
@@ -4436,7 +4500,7 @@ var ServiceContext = class extends Resource {
4436
4500
  async _close() {
4437
4501
  log12("closing...", void 0, {
4438
4502
  F: __dxlog_file14,
4439
- L: 172,
4503
+ L: 174,
4440
4504
  S: this,
4441
4505
  C: (f, a) => f(...a)
4442
4506
  });
@@ -4454,7 +4518,7 @@ var ServiceContext = class extends Resource {
4454
4518
  await this.indexer.destroy();
4455
4519
  log12("closed", void 0, {
4456
4520
  F: __dxlog_file14,
4457
- L: 185,
4521
+ L: 187,
4458
4522
  S: this,
4459
4523
  C: (f, a) => f(...a)
4460
4524
  });
@@ -4468,7 +4532,7 @@ var ServiceContext = class extends Resource {
4468
4532
  const factory = this._handlerFactories.get(invitation.kind);
4469
4533
  invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
4470
4534
  F: __dxlog_file14,
4471
- L: 196,
4535
+ L: 198,
4472
4536
  S: this,
4473
4537
  A: [
4474
4538
  "factory",
@@ -4500,7 +4564,7 @@ var ServiceContext = class extends Resource {
4500
4564
  async _initialize(ctx) {
4501
4565
  log12("initializing spaces...", void 0, {
4502
4566
  F: __dxlog_file14,
4503
- L: 227,
4567
+ L: 229,
4504
4568
  S: this,
4505
4569
  C: (f, a) => f(...a)
4506
4570
  });
@@ -4523,7 +4587,7 @@ var ServiceContext = class extends Resource {
4523
4587
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4524
4588
  invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4525
4589
  F: __dxlog_file14,
4526
- L: 251,
4590
+ L: 253,
4527
4591
  S: this,
4528
4592
  A: [
4529
4593
  "this.dataSpaceManager",
@@ -4547,7 +4611,7 @@ var ServiceContext = class extends Resource {
4547
4611
  details: assertion
4548
4612
  }, {
4549
4613
  F: __dxlog_file14,
4550
- L: 267,
4614
+ L: 269,
4551
4615
  S: this,
4552
4616
  C: (f, a) => f(...a)
4553
4617
  });
@@ -4558,7 +4622,7 @@ var ServiceContext = class extends Resource {
4558
4622
  details: assertion
4559
4623
  }, {
4560
4624
  F: __dxlog_file14,
4561
- L: 271,
4625
+ L: 273,
4562
4626
  S: this,
4563
4627
  C: (f, a) => f(...a)
4564
4628
  });
@@ -4569,7 +4633,7 @@ var ServiceContext = class extends Resource {
4569
4633
  details: assertion
4570
4634
  }, {
4571
4635
  F: __dxlog_file14,
4572
- L: 276,
4636
+ L: 278,
4573
4637
  S: this,
4574
4638
  C: (f, a) => f(...a)
4575
4639
  });
@@ -4580,7 +4644,7 @@ var ServiceContext = class extends Resource {
4580
4644
  } catch (err) {
4581
4645
  log12.catch(err, void 0, {
4582
4646
  F: __dxlog_file14,
4583
- L: 282,
4647
+ L: 284,
4584
4648
  S: this,
4585
4649
  C: (f, a) => f(...a)
4586
4650
  });
@@ -4634,7 +4698,7 @@ import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/client/s
4634
4698
  import { TRACE_PROCESSOR } from "@dxos/tracing";
4635
4699
 
4636
4700
  // packages/sdk/client-services/src/version.ts
4637
- var DXOS_VERSION = "0.4.10-main.c42bfdb";
4701
+ var DXOS_VERSION = "0.4.10-main.cb83c78";
4638
4702
 
4639
4703
  // packages/sdk/client-services/src/packlets/services/platform.ts
4640
4704
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -4879,7 +4943,7 @@ import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
4879
4943
  import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
4880
4944
  import { Context as Context11 } from "@dxos/context";
4881
4945
  import { DataServiceImpl, encodeReference } from "@dxos/echo-pipeline";
4882
- import * as E from "@dxos/echo-schema";
4946
+ import { getTypeReference } from "@dxos/echo-schema";
4883
4947
  import { IndexServiceImpl } from "@dxos/indexing";
4884
4948
  import { invariant as invariant16 } from "@dxos/invariant";
4885
4949
  import { PublicKey as PublicKey13 } from "@dxos/keys";
@@ -5323,7 +5387,7 @@ import path from "@dxos/node-std/path";
5323
5387
  import { PublicKey as PublicKey12 } from "@dxos/keys";
5324
5388
  var createLevel = async (config) => {
5325
5389
  const persistent = isPersistent(config);
5326
- const storagePath = persistent ? getRootPath(config) : path.join("tmp", "level", PublicKey12.random().toHex());
5390
+ const storagePath = persistent ? path.join(getRootPath(config), "level") : `/tmp/dxos-${PublicKey12.random().toHex()}`;
5327
5391
  const level = new Level(storagePath);
5328
5392
  await level.open();
5329
5393
  return level;
@@ -5404,6 +5468,7 @@ var ClientServicesHost = class {
5404
5468
  transportFactory,
5405
5469
  signalManager,
5406
5470
  storage,
5471
+ level,
5407
5472
  // TODO(wittjosiah): Turn this on by default.
5408
5473
  lockKey,
5409
5474
  callbacks,
@@ -5414,6 +5479,7 @@ var ClientServicesHost = class {
5414
5479
  this._opening = false;
5415
5480
  this._open = false;
5416
5481
  this._storage = storage;
5482
+ this._level = level;
5417
5483
  this._callbacks = callbacks;
5418
5484
  this._runtimeParams = runtimeParams;
5419
5485
  if (config) {
@@ -5485,7 +5551,7 @@ var ClientServicesHost = class {
5485
5551
  initialize({ config, ...options }) {
5486
5552
  invariant16(!this._open, "service host is open", {
5487
5553
  F: __dxlog_file19,
5488
- L: 188,
5554
+ L: 197,
5489
5555
  S: this,
5490
5556
  A: [
5491
5557
  "!this._open",
@@ -5494,14 +5560,14 @@ var ClientServicesHost = class {
5494
5560
  });
5495
5561
  log16("initializing...", void 0, {
5496
5562
  F: __dxlog_file19,
5497
- L: 189,
5563
+ L: 198,
5498
5564
  S: this,
5499
5565
  C: (f, a) => f(...a)
5500
5566
  });
5501
5567
  if (config) {
5502
5568
  invariant16(!this._config, "config already set", {
5503
5569
  F: __dxlog_file19,
5504
- L: 192,
5570
+ L: 201,
5505
5571
  S: this,
5506
5572
  A: [
5507
5573
  "!this._config",
@@ -5516,7 +5582,7 @@ var ClientServicesHost = class {
5516
5582
  if (!options.signalManager) {
5517
5583
  log16.warn("running signaling without telemetry metadata.", void 0, {
5518
5584
  F: __dxlog_file19,
5519
- L: 200,
5585
+ L: 209,
5520
5586
  S: this,
5521
5587
  C: (f, a) => f(...a)
5522
5588
  });
@@ -5527,7 +5593,7 @@ var ClientServicesHost = class {
5527
5593
  this._signalManager = signalManager;
5528
5594
  invariant16(!this._networkManager, "network manager already set", {
5529
5595
  F: __dxlog_file19,
5530
- L: 211,
5596
+ L: 220,
5531
5597
  S: this,
5532
5598
  A: [
5533
5599
  "!this._networkManager",
@@ -5541,7 +5607,7 @@ var ClientServicesHost = class {
5541
5607
  });
5542
5608
  log16("initialized", void 0, {
5543
5609
  F: __dxlog_file19,
5544
- L: 218,
5610
+ L: 227,
5545
5611
  S: this,
5546
5612
  C: (f, a) => f(...a)
5547
5613
  });
@@ -5555,13 +5621,13 @@ var ClientServicesHost = class {
5555
5621
  id: traceId
5556
5622
  }), {
5557
5623
  F: __dxlog_file19,
5558
- L: 229,
5624
+ L: 238,
5559
5625
  S: this,
5560
5626
  C: (f, a) => f(...a)
5561
5627
  });
5562
5628
  invariant16(this._config, "config not set", {
5563
5629
  F: __dxlog_file19,
5564
- L: 231,
5630
+ L: 240,
5565
5631
  S: this,
5566
5632
  A: [
5567
5633
  "this._config",
@@ -5570,7 +5636,7 @@ var ClientServicesHost = class {
5570
5636
  });
5571
5637
  invariant16(this._storage, "storage not set", {
5572
5638
  F: __dxlog_file19,
5573
- L: 232,
5639
+ L: 241,
5574
5640
  S: this,
5575
5641
  A: [
5576
5642
  "this._storage",
@@ -5579,7 +5645,7 @@ var ClientServicesHost = class {
5579
5645
  });
5580
5646
  invariant16(this._signalManager, "signal manager not set", {
5581
5647
  F: __dxlog_file19,
5582
- L: 233,
5648
+ L: 242,
5583
5649
  S: this,
5584
5650
  A: [
5585
5651
  "this._signalManager",
@@ -5588,7 +5654,7 @@ var ClientServicesHost = class {
5588
5654
  });
5589
5655
  invariant16(this._networkManager, "network manager not set", {
5590
5656
  F: __dxlog_file19,
5591
- L: 234,
5657
+ L: 243,
5592
5658
  S: this,
5593
5659
  A: [
5594
5660
  "this._networkManager",
@@ -5600,13 +5666,14 @@ var ClientServicesHost = class {
5600
5666
  lockKey: this._resourceLock?.lockKey
5601
5667
  }, {
5602
5668
  F: __dxlog_file19,
5603
- L: 237,
5669
+ L: 246,
5604
5670
  S: this,
5605
5671
  C: (f, a) => f(...a)
5606
5672
  });
5607
5673
  if (!this._level) {
5608
5674
  this._level = await createLevel(this._config.get("runtime.client.storage", {}));
5609
5675
  }
5676
+ await this._level.open();
5610
5677
  await this._resourceLock?.acquire();
5611
5678
  await this._loggingService.open();
5612
5679
  this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
@@ -5637,7 +5704,7 @@ var ClientServicesHost = class {
5637
5704
  await this._serviceContext.open(ctx);
5638
5705
  invariant16(this.serviceRegistry.services.InvitationsService, void 0, {
5639
5706
  F: __dxlog_file19,
5640
- L: 303,
5707
+ L: 314,
5641
5708
  S: this,
5642
5709
  A: [
5643
5710
  "this.serviceRegistry.services.InvitationsService",
@@ -5649,7 +5716,7 @@ var ClientServicesHost = class {
5649
5716
  count: loadedInvitations.invitations?.length
5650
5717
  }, {
5651
5718
  F: __dxlog_file19,
5652
- L: 306,
5719
+ L: 317,
5653
5720
  S: this,
5654
5721
  C: (f, a) => f(...a)
5655
5722
  });
@@ -5672,7 +5739,7 @@ var ClientServicesHost = class {
5672
5739
  deviceKey
5673
5740
  }, {
5674
5741
  F: __dxlog_file19,
5675
- L: 324,
5742
+ L: 335,
5676
5743
  S: this,
5677
5744
  C: (f, a) => f(...a)
5678
5745
  });
@@ -5680,7 +5747,7 @@ var ClientServicesHost = class {
5680
5747
  id: traceId
5681
5748
  }), {
5682
5749
  F: __dxlog_file19,
5683
- L: 325,
5750
+ L: 336,
5684
5751
  S: this,
5685
5752
  C: (f, a) => f(...a)
5686
5753
  });
@@ -5694,7 +5761,7 @@ var ClientServicesHost = class {
5694
5761
  deviceKey
5695
5762
  }, {
5696
5763
  F: __dxlog_file19,
5697
- L: 336,
5764
+ L: 347,
5698
5765
  S: this,
5699
5766
  C: (f, a) => f(...a)
5700
5767
  });
@@ -5712,7 +5779,7 @@ var ClientServicesHost = class {
5712
5779
  deviceKey
5713
5780
  }, {
5714
5781
  F: __dxlog_file19,
5715
- L: 345,
5782
+ L: 356,
5716
5783
  S: this,
5717
5784
  C: (f, a) => f(...a)
5718
5785
  });
@@ -5723,13 +5790,13 @@ var ClientServicesHost = class {
5723
5790
  id: traceId
5724
5791
  }), {
5725
5792
  F: __dxlog_file19,
5726
- L: 350,
5793
+ L: 361,
5727
5794
  S: this,
5728
5795
  C: (f, a) => f(...a)
5729
5796
  });
5730
5797
  log16("resetting...", void 0, {
5731
5798
  F: __dxlog_file19,
5732
- L: 352,
5799
+ L: 363,
5733
5800
  S: this,
5734
5801
  C: (f, a) => f(...a)
5735
5802
  });
@@ -5737,7 +5804,7 @@ var ClientServicesHost = class {
5737
5804
  await this._storage.reset();
5738
5805
  log16("reset", void 0, {
5739
5806
  F: __dxlog_file19,
5740
- L: 355,
5807
+ L: 366,
5741
5808
  S: this,
5742
5809
  C: (f, a) => f(...a)
5743
5810
  });
@@ -5745,7 +5812,7 @@ var ClientServicesHost = class {
5745
5812
  id: traceId
5746
5813
  }), {
5747
5814
  F: __dxlog_file19,
5748
- L: 356,
5815
+ L: 367,
5749
5816
  S: this,
5750
5817
  C: (f, a) => f(...a)
5751
5818
  });
@@ -5758,7 +5825,7 @@ var ClientServicesHost = class {
5758
5825
  const automergeIndex = space.automergeSpaceState.rootUrl;
5759
5826
  invariant16(automergeIndex, void 0, {
5760
5827
  F: __dxlog_file19,
5761
- L: 368,
5828
+ L: 379,
5762
5829
  S: this,
5763
5830
  A: [
5764
5831
  "automergeIndex",
@@ -5769,7 +5836,7 @@ var ClientServicesHost = class {
5769
5836
  await document.whenReady();
5770
5837
  const properties = {
5771
5838
  system: {
5772
- type: encodeReference(E.getTypeReference(Properties))
5839
+ type: encodeReference(getTypeReference(Properties))
5773
5840
  },
5774
5841
  data: {
5775
5842
  [defaultKey]: identity.identityKey.toHex()
@@ -5864,7 +5931,7 @@ export {
5864
5931
  IdentityServiceImpl,
5865
5932
  DeviceInvitationProtocol,
5866
5933
  InvitationsHandler,
5867
- invitationExpired,
5934
+ createAdmissionKeypair,
5868
5935
  InvitationsServiceImpl,
5869
5936
  SpaceInvitationProtocol,
5870
5937
  ClientRpcServer,
@@ -5884,4 +5951,4 @@ export {
5884
5951
  ClientServicesHost,
5885
5952
  ClientServicesProviderResource
5886
5953
  };
5887
- //# sourceMappingURL=chunk-W7UANCHR.mjs.map
5954
+ //# sourceMappingURL=chunk-MR3A4F5A.mjs.map