@dxos/client-services 0.8.1-staging.391c573 → 0.8.1-staging.97aedb1

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 (32) hide show
  1. package/dist/lib/browser/{chunk-27WUD3Q6.mjs → chunk-5VIKZEA3.mjs} +54 -19
  2. package/dist/lib/browser/chunk-5VIKZEA3.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-SJ3DQ4HS.cjs → chunk-HAYNZLSJ.cjs} +52 -17
  7. package/dist/lib/node/chunk-HAYNZLSJ.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-ZQFIFOIV.mjs → chunk-NK72VK3B.mjs} +54 -19
  12. package/dist/lib/node-esm/chunk-NK72VK3B.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/devtools/feeds.d.ts.map +1 -1
  17. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +6 -0
  18. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
  19. package/dist/types/src/packlets/identity/identity-service.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/devices/devices-service.ts +2 -2
  23. package/src/packlets/devtools/feeds.ts +4 -3
  24. package/src/packlets/identity/contacts-service.ts +2 -2
  25. package/src/packlets/identity/identity-recovery-manager.ts +27 -0
  26. package/src/packlets/identity/identity-service.ts +2 -0
  27. package/src/packlets/spaces/data-space-manager.ts +1 -1
  28. package/src/packlets/spaces/spaces-service.ts +6 -6
  29. package/src/version.ts +1 -1
  30. package/dist/lib/browser/chunk-27WUD3Q6.mjs.map +0 -7
  31. package/dist/lib/node/chunk-SJ3DQ4HS.cjs.map +0 -7
  32. package/dist/lib/node-esm/chunk-ZQFIFOIV.mjs.map +0 -7
@@ -32,7 +32,7 @@ __export(testing_exports, {
32
32
  sanitizeInvitation: () => sanitizeInvitation
33
33
  });
34
34
  module.exports = __toCommonJS(testing_exports);
35
- var import_chunk_SJ3DQ4HS = require("../chunk-SJ3DQ4HS.cjs");
35
+ var import_chunk_HAYNZLSJ = require("../chunk-HAYNZLSJ.cjs");
36
36
  var import_credentials = require("@dxos/credentials");
37
37
  var import_keys = require("@dxos/keys");
38
38
  var import_async = require("@dxos/async");
@@ -235,7 +235,7 @@ var createInvitation = async (host, options) => {
235
235
  authMethod: import_services.Invitation.AuthMethod.NONE,
236
236
  ...options ?? {}
237
237
  };
238
- if (host instanceof import_chunk_SJ3DQ4HS.ServiceContext) {
238
+ if (host instanceof import_chunk_HAYNZLSJ.ServiceContext) {
239
239
  return host.invitationsManager.createInvitation({
240
240
  kind: import_services.Invitation.Kind.SPACE,
241
241
  ...options
@@ -245,7 +245,7 @@ var createInvitation = async (host, options) => {
245
245
  };
246
246
  var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
247
247
  invitation = sanitizeInvitation(invitation);
248
- if (guest instanceof import_chunk_SJ3DQ4HS.ServiceContext) {
248
+ if (guest instanceof import_chunk_HAYNZLSJ.ServiceContext) {
249
249
  return guest.invitationsManager.acceptInvitation({
250
250
  invitation,
251
251
  deviceProfile: guestDeviceProfile
@@ -255,7 +255,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
255
255
  };
256
256
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
257
257
  var createServiceHost = (config, signalManagerContext) => {
258
- return new import_chunk_SJ3DQ4HS.ClientServicesHost({
258
+ return new import_chunk_HAYNZLSJ.ClientServicesHost({
259
259
  config,
260
260
  signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
261
261
  transportFactory: import_network_manager.MemoryTransportFactory
@@ -274,7 +274,7 @@ var createServiceContext = async ({ signalManagerFactory = async () => {
274
274
  });
275
275
  const level = (0, import_testing.createTestLevel)();
276
276
  await level.open();
277
- return new import_chunk_SJ3DQ4HS.ServiceContext(storage, level, networkManager, signalManager, void 0, void 0, {
277
+ return new import_chunk_HAYNZLSJ.ServiceContext(storage, level, networkManager, signalManager, void 0, void 0, {
278
278
  invitationConnectionDefaultParams: {
279
279
  teleport: {
280
280
  controlHeartbeatInterval: 200
@@ -385,7 +385,7 @@ var TestPeer = class {
385
385
  return this._props.meshEchoReplicator ??= new import_echo_pipeline.MeshEchoReplicator();
386
386
  }
387
387
  get dataSpaceManager() {
388
- return this._props.dataSpaceManager ??= new import_chunk_SJ3DQ4HS.DataSpaceManager({
388
+ return this._props.dataSpaceManager ??= new import_chunk_HAYNZLSJ.DataSpaceManager({
389
389
  spaceManager: this.spaceManager,
390
390
  metadataStore: this.metadataStore,
391
391
  keyring: this.keyring,
@@ -400,9 +400,9 @@ var TestPeer = class {
400
400
  });
401
401
  }
402
402
  get invitationsManager() {
403
- return this._props.invitationsManager ??= new import_chunk_SJ3DQ4HS.InvitationsManager(new import_chunk_SJ3DQ4HS.InvitationsHandler(this.networkManager), (invitation) => {
403
+ return this._props.invitationsManager ??= new import_chunk_HAYNZLSJ.InvitationsManager(new import_chunk_HAYNZLSJ.InvitationsHandler(this.networkManager), (invitation) => {
404
404
  if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
405
- return new import_chunk_SJ3DQ4HS.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
405
+ return new import_chunk_HAYNZLSJ.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
406
406
  } else {
407
407
  throw new Error("not implemented");
408
408
  }
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
 
3
3
  // packages/sdk/client-services/src/packlets/devtools/feeds.ts
4
- import { EventSubscriptions } from "@dxos/async";
4
+ import { SubscriptionList } from "@dxos/async";
5
5
  import { Stream } from "@dxos/codec-protobuf/stream";
6
6
  import { FeedIterator } from "@dxos/feed-store";
7
7
  import { PublicKey } from "@dxos/keys";
@@ -10,7 +10,7 @@ import { ComplexMap } from "@dxos/util";
10
10
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
11
11
  var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
12
12
  return new Stream(({ next }) => {
13
- const subscriptions = new EventSubscriptions();
13
+ const subscriptions = new SubscriptionList();
14
14
  const feedMap = new ComplexMap(PublicKey.hash);
15
15
  const update = () => {
16
16
  const { feeds } = feedStore;
@@ -72,7 +72,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
72
72
  if (!feedKey) {
73
73
  return;
74
74
  }
75
- const subscriptions = new EventSubscriptions();
75
+ const subscriptions = new SubscriptionList();
76
76
  const timeout = setTimeout(async () => {
77
77
  const feed = feedStore.getFeed(feedKey);
78
78
  if (!feed) {
@@ -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.8.1-staging.391c573";
400
+ var DXOS_VERSION = "0.8.1-staging.97aedb1";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -2099,7 +2099,7 @@ var DataSpaceManager = class extends Resource4 {
2099
2099
  dataFeedKey,
2100
2100
  state: SpaceState.SPACE_ACTIVE
2101
2101
  };
2102
- log6.info("creating space...", {
2102
+ log6("creating space...", {
2103
2103
  spaceId,
2104
2104
  spaceKey
2105
2105
  }, {
@@ -2670,7 +2670,7 @@ DataSpaceManager = _ts_decorate3([
2670
2670
  ], DataSpaceManager);
2671
2671
 
2672
2672
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
2673
- import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask3 } from "@dxos/async";
2673
+ import { SubscriptionList as SubscriptionList2, UpdateScheduler, scheduleTask as scheduleTask3 } from "@dxos/async";
2674
2674
  import { Stream as Stream7 } from "@dxos/codec-protobuf/stream";
2675
2675
  import { createAdmissionCredentials as createAdmissionCredentials2, createDidFromIdentityKey as createDidFromIdentityKey2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
2676
2676
  import { raise } from "@dxos/debug";
@@ -2678,7 +2678,7 @@ import { writeMessages as writeMessages2 } from "@dxos/feed-store";
2678
2678
  import { assertArgument as assertArgument4, assertState as assertState3, invariant as invariant7 } from "@dxos/invariant";
2679
2679
  import { SpaceId as SpaceId2 } from "@dxos/keys";
2680
2680
  import { log as log8 } from "@dxos/log";
2681
- import { ApiError, SpaceNotFoundError, encodeError, IdentityNotInitializedError, AuthorizationError } from "@dxos/protocols";
2681
+ import { encodeError, ApiError, AuthorizationError, IdentityNotInitializedError, SpaceNotFoundError } from "@dxos/protocols";
2682
2682
  import { SpaceMember as SpaceMember4, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
2683
2683
  import { trace as trace2 } from "@dxos/tracing";
2684
2684
 
@@ -2930,7 +2930,7 @@ var SpacesServiceImpl = class {
2930
2930
  });
2931
2931
  scheduleTask3(ctx, async () => {
2932
2932
  const dataSpaceManager = await this._getDataSpaceManager();
2933
- const subscriptions = new EventSubscriptions2();
2933
+ const subscriptions = new SubscriptionList2();
2934
2934
  ctx.onDispose(() => subscriptions.clear());
2935
2935
  const subscribeSpaces = () => {
2936
2936
  subscriptions.clear();
@@ -4026,6 +4026,10 @@ var IdentityServiceImpl = class extends Resource6 {
4026
4026
  });
4027
4027
  } else if (request.external) {
4028
4028
  await this._recoveryManager.recoverIdentityWithExternalSignature(request.external);
4029
+ } else if (request.token) {
4030
+ await this._recoveryManager.recoverIdentityWithToken({
4031
+ token: request.token
4032
+ });
4029
4033
  } else {
4030
4034
  throw new Error("Invalid request.");
4031
4035
  }
@@ -4035,7 +4039,7 @@ var IdentityServiceImpl = class extends Resource6 {
4035
4039
  async signPresentation({ presentation, nonce }) {
4036
4040
  invariant10(this._identityManager.identity, "Identity not initialized.", {
4037
4041
  F: __dxlog_file14,
4038
- L: 116,
4042
+ L: 118,
4039
4043
  S: this,
4040
4044
  A: [
4041
4045
  "this._identityManager.identity",
@@ -4054,7 +4058,7 @@ var IdentityServiceImpl = class extends Resource6 {
4054
4058
  const identity = this._identityManager.identity;
4055
4059
  invariant10(identity, "Identity not initialized.", {
4056
4060
  F: __dxlog_file14,
4057
- L: 130,
4061
+ L: 132,
4058
4062
  S: this,
4059
4063
  A: [
4060
4064
  "identity",
@@ -4092,7 +4096,7 @@ var IdentityServiceImpl = class extends Resource6 {
4092
4096
  duplicate: space.id
4093
4097
  }, {
4094
4098
  F: __dxlog_file14,
4095
- L: 164,
4099
+ L: 166,
4096
4100
  S: this,
4097
4101
  C: (f, a) => f(...a)
4098
4102
  });
@@ -4106,7 +4110,7 @@ var IdentityServiceImpl = class extends Resource6 {
4106
4110
  }, (err) => {
4107
4111
  log11.catch(err, void 0, {
4108
4112
  F: __dxlog_file14,
4109
- L: 175,
4113
+ L: 177,
4110
4114
  S: this,
4111
4115
  C: (f, a) => f(...a)
4112
4116
  });
@@ -7705,10 +7709,41 @@ var EdgeIdentityRecoveryManager = class {
7705
7709
  dataFeedKey: await this._keyring.createKey()
7706
7710
  });
7707
7711
  }
7712
+ /**
7713
+ * Recovery identity using an opaque token sent to the user's email.
7714
+ */
7715
+ async recoverIdentityWithToken({ token }) {
7716
+ invariant22(this._edgeClient, "Not connected to EDGE.", {
7717
+ F: __dxlog_file27,
7718
+ L: 139,
7719
+ S: this,
7720
+ A: [
7721
+ "this._edgeClient",
7722
+ "'Not connected to EDGE.'"
7723
+ ]
7724
+ });
7725
+ const deviceKey = await this._keyring.createKey();
7726
+ const controlFeedKey = await this._keyring.createKey();
7727
+ const request = {
7728
+ deviceKey: deviceKey.toHex(),
7729
+ controlFeedKey: controlFeedKey.toHex(),
7730
+ token
7731
+ };
7732
+ const response = await this._edgeClient.recoverIdentity(request);
7733
+ await this._acceptRecoveredIdentity({
7734
+ authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
7735
+ haloGenesisFeedKey: PublicKey14.fromHex(response.genesisFeedKey),
7736
+ haloSpaceKey: PublicKey14.fromHex(response.haloSpaceKey),
7737
+ identityKey: PublicKey14.fromHex(response.identityKey),
7738
+ deviceKey,
7739
+ controlFeedKey,
7740
+ dataFeedKey: await this._keyring.createKey()
7741
+ });
7742
+ }
7708
7743
  async recoverIdentity({ recoveryCode }) {
7709
7744
  invariant22(this._edgeClient, "Not connected to EDGE.", {
7710
7745
  F: __dxlog_file27,
7711
- L: 136,
7746
+ L: 163,
7712
7747
  S: this,
7713
7748
  A: [
7714
7749
  "this._edgeClient",
@@ -7739,7 +7774,7 @@ var EdgeIdentityRecoveryManager = class {
7739
7774
  }
7740
7775
  log23.info("recovering identity", response, {
7741
7776
  F: __dxlog_file27,
7742
- L: 162,
7777
+ L: 189,
7743
7778
  S: this,
7744
7779
  C: (f, a) => f(...a)
7745
7780
  });
@@ -8478,7 +8513,7 @@ import { TRACE_PROCESSOR as TRACE_PROCESSOR3, trace as Trace4 } from "@dxos/trac
8478
8513
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
8479
8514
 
8480
8515
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
8481
- import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
8516
+ import { SubscriptionList as SubscriptionList3 } from "@dxos/async";
8482
8517
  import { Stream as Stream12 } from "@dxos/codec-protobuf/stream";
8483
8518
  import { invariant as invariant25 } from "@dxos/invariant";
8484
8519
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
@@ -8549,7 +8584,7 @@ var DevicesServiceImpl = class {
8549
8584
  presenceSubscribed = true;
8550
8585
  }
8551
8586
  };
8552
- const subscriptions = new EventSubscriptions3();
8587
+ const subscriptions = new SubscriptionList3();
8553
8588
  if (this._identityManager.identity) {
8554
8589
  subscribeIdentity();
8555
8590
  subscribePresence();
@@ -8568,7 +8603,7 @@ var DevicesServiceImpl = class {
8568
8603
  };
8569
8604
 
8570
8605
  // packages/sdk/client-services/src/packlets/identity/contacts-service.ts
8571
- import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
8606
+ import { scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2, SubscriptionList as SubscriptionList4 } from "@dxos/async";
8572
8607
  import { Stream as Stream13 } from "@dxos/codec-protobuf/stream";
8573
8608
  import { PublicKey as PublicKey17 } from "@dxos/keys";
8574
8609
  import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
@@ -8628,7 +8663,7 @@ var ContactsServiceImpl = class {
8628
8663
  maxFrequency: 2
8629
8664
  });
8630
8665
  scheduleTask9(ctx, async () => {
8631
- const subscriptions = new EventSubscriptions4();
8666
+ const subscriptions = new SubscriptionList4();
8632
8667
  ctx.onDispose(() => subscriptions.clear());
8633
8668
  const subscribeToSpaceAndUpdate = () => {
8634
8669
  const oldSetSize = subscribedSpaceKeySet.size;
@@ -9344,4 +9379,4 @@ export {
9344
9379
  importProfileData,
9345
9380
  ClientServicesHost
9346
9381
  };
9347
- //# sourceMappingURL=chunk-ZQFIFOIV.mjs.map
9382
+ //# sourceMappingURL=chunk-NK72VK3B.mjs.map