@dxos/client-services 0.8.1-staging.391c573 → 0.8.1-staging.9eaf14f

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-2I64KBVC.mjs} +54 -19
  2. package/dist/lib/browser/chunk-2I64KBVC.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-FSDMAWGD.cjs} +52 -17
  7. package/dist/lib/node/chunk-FSDMAWGD.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-Q6I2E5GO.mjs} +54 -19
  12. package/dist/lib/node-esm/chunk-Q6I2E5GO.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
@@ -1,7 +1,7 @@
1
1
  import "@dxos/node-std/globals";
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.9eaf14f";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -2177,7 +2177,7 @@ var DataSpaceManager = class extends Resource4 {
2177
2177
  dataFeedKey,
2178
2178
  state: SpaceState.SPACE_ACTIVE
2179
2179
  };
2180
- log7.info("creating space...", {
2180
+ log7("creating space...", {
2181
2181
  spaceId,
2182
2182
  spaceKey
2183
2183
  }, {
@@ -2748,7 +2748,7 @@ DataSpaceManager = _ts_decorate3([
2748
2748
  ], DataSpaceManager);
2749
2749
 
2750
2750
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
2751
- import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask3 } from "@dxos/async";
2751
+ import { SubscriptionList as SubscriptionList2, UpdateScheduler, scheduleTask as scheduleTask3 } from "@dxos/async";
2752
2752
  import { Stream as Stream7 } from "@dxos/codec-protobuf/stream";
2753
2753
  import { createAdmissionCredentials as createAdmissionCredentials2, createDidFromIdentityKey as createDidFromIdentityKey2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
2754
2754
  import { raise } from "@dxos/debug";
@@ -2756,7 +2756,7 @@ import { writeMessages as writeMessages2 } from "@dxos/feed-store";
2756
2756
  import { assertArgument as assertArgument4, assertState as assertState3, invariant as invariant7 } from "@dxos/invariant";
2757
2757
  import { SpaceId as SpaceId2 } from "@dxos/keys";
2758
2758
  import { log as log9 } from "@dxos/log";
2759
- import { ApiError, SpaceNotFoundError, encodeError, IdentityNotInitializedError, AuthorizationError } from "@dxos/protocols";
2759
+ import { encodeError, ApiError, AuthorizationError, IdentityNotInitializedError, SpaceNotFoundError } from "@dxos/protocols";
2760
2760
  import { SpaceMember as SpaceMember4, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
2761
2761
  import { trace as trace2 } from "@dxos/tracing";
2762
2762
 
@@ -3008,7 +3008,7 @@ var SpacesServiceImpl = class {
3008
3008
  });
3009
3009
  scheduleTask3(ctx, async () => {
3010
3010
  const dataSpaceManager = await this._getDataSpaceManager();
3011
- const subscriptions = new EventSubscriptions2();
3011
+ const subscriptions = new SubscriptionList2();
3012
3012
  ctx.onDispose(() => subscriptions.clear());
3013
3013
  const subscribeSpaces = () => {
3014
3014
  subscriptions.clear();
@@ -4104,6 +4104,10 @@ var IdentityServiceImpl = class extends Resource6 {
4104
4104
  });
4105
4105
  } else if (request.external) {
4106
4106
  await this._recoveryManager.recoverIdentityWithExternalSignature(request.external);
4107
+ } else if (request.token) {
4108
+ await this._recoveryManager.recoverIdentityWithToken({
4109
+ token: request.token
4110
+ });
4107
4111
  } else {
4108
4112
  throw new Error("Invalid request.");
4109
4113
  }
@@ -4113,7 +4117,7 @@ var IdentityServiceImpl = class extends Resource6 {
4113
4117
  async signPresentation({ presentation, nonce }) {
4114
4118
  invariant10(this._identityManager.identity, "Identity not initialized.", {
4115
4119
  F: __dxlog_file15,
4116
- L: 116,
4120
+ L: 118,
4117
4121
  S: this,
4118
4122
  A: [
4119
4123
  "this._identityManager.identity",
@@ -4132,7 +4136,7 @@ var IdentityServiceImpl = class extends Resource6 {
4132
4136
  const identity = this._identityManager.identity;
4133
4137
  invariant10(identity, "Identity not initialized.", {
4134
4138
  F: __dxlog_file15,
4135
- L: 130,
4139
+ L: 132,
4136
4140
  S: this,
4137
4141
  A: [
4138
4142
  "identity",
@@ -4170,7 +4174,7 @@ var IdentityServiceImpl = class extends Resource6 {
4170
4174
  duplicate: space.id
4171
4175
  }, {
4172
4176
  F: __dxlog_file15,
4173
- L: 164,
4177
+ L: 166,
4174
4178
  S: this,
4175
4179
  C: (f, a) => f(...a)
4176
4180
  });
@@ -4184,7 +4188,7 @@ var IdentityServiceImpl = class extends Resource6 {
4184
4188
  }, (err) => {
4185
4189
  log12.catch(err, void 0, {
4186
4190
  F: __dxlog_file15,
4187
- L: 175,
4191
+ L: 177,
4188
4192
  S: this,
4189
4193
  C: (f, a) => f(...a)
4190
4194
  });
@@ -7848,10 +7852,41 @@ var EdgeIdentityRecoveryManager = class {
7848
7852
  dataFeedKey: await this._keyring.createKey()
7849
7853
  });
7850
7854
  }
7855
+ /**
7856
+ * Recovery identity using an opaque token sent to the user's email.
7857
+ */
7858
+ async recoverIdentityWithToken({ token }) {
7859
+ invariant21(this._edgeClient, "Not connected to EDGE.", {
7860
+ F: __dxlog_file28,
7861
+ L: 139,
7862
+ S: this,
7863
+ A: [
7864
+ "this._edgeClient",
7865
+ "'Not connected to EDGE.'"
7866
+ ]
7867
+ });
7868
+ const deviceKey = await this._keyring.createKey();
7869
+ const controlFeedKey = await this._keyring.createKey();
7870
+ const request = {
7871
+ deviceKey: deviceKey.toHex(),
7872
+ controlFeedKey: controlFeedKey.toHex(),
7873
+ token
7874
+ };
7875
+ const response = await this._edgeClient.recoverIdentity(request);
7876
+ await this._acceptRecoveredIdentity({
7877
+ authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
7878
+ haloGenesisFeedKey: PublicKey14.fromHex(response.genesisFeedKey),
7879
+ haloSpaceKey: PublicKey14.fromHex(response.haloSpaceKey),
7880
+ identityKey: PublicKey14.fromHex(response.identityKey),
7881
+ deviceKey,
7882
+ controlFeedKey,
7883
+ dataFeedKey: await this._keyring.createKey()
7884
+ });
7885
+ }
7851
7886
  async recoverIdentity({ recoveryCode }) {
7852
7887
  invariant21(this._edgeClient, "Not connected to EDGE.", {
7853
7888
  F: __dxlog_file28,
7854
- L: 136,
7889
+ L: 163,
7855
7890
  S: this,
7856
7891
  A: [
7857
7892
  "this._edgeClient",
@@ -7882,7 +7917,7 @@ var EdgeIdentityRecoveryManager = class {
7882
7917
  }
7883
7918
  log24.info("recovering identity", response, {
7884
7919
  F: __dxlog_file28,
7885
- L: 162,
7920
+ L: 189,
7886
7921
  S: this,
7887
7922
  C: (f, a) => f(...a)
7888
7923
  });
@@ -8621,7 +8656,7 @@ import { TRACE_PROCESSOR as TRACE_PROCESSOR3, trace as Trace4 } from "@dxos/trac
8621
8656
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
8622
8657
 
8623
8658
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
8624
- import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
8659
+ import { SubscriptionList as SubscriptionList3 } from "@dxos/async";
8625
8660
  import { Stream as Stream12 } from "@dxos/codec-protobuf/stream";
8626
8661
  import { invariant as invariant24 } from "@dxos/invariant";
8627
8662
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
@@ -8692,7 +8727,7 @@ var DevicesServiceImpl = class {
8692
8727
  presenceSubscribed = true;
8693
8728
  }
8694
8729
  };
8695
- const subscriptions = new EventSubscriptions3();
8730
+ const subscriptions = new SubscriptionList3();
8696
8731
  if (this._identityManager.identity) {
8697
8732
  subscribeIdentity();
8698
8733
  subscribePresence();
@@ -8711,7 +8746,7 @@ var DevicesServiceImpl = class {
8711
8746
  };
8712
8747
 
8713
8748
  // packages/sdk/client-services/src/packlets/identity/contacts-service.ts
8714
- import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
8749
+ import { scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2, SubscriptionList as SubscriptionList4 } from "@dxos/async";
8715
8750
  import { Stream as Stream13 } from "@dxos/codec-protobuf/stream";
8716
8751
  import { PublicKey as PublicKey17 } from "@dxos/keys";
8717
8752
  import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
@@ -8771,7 +8806,7 @@ var ContactsServiceImpl = class {
8771
8806
  maxFrequency: 2
8772
8807
  });
8773
8808
  scheduleTask9(ctx, async () => {
8774
- const subscriptions = new EventSubscriptions4();
8809
+ const subscriptions = new SubscriptionList4();
8775
8810
  ctx.onDispose(() => subscriptions.clear());
8776
8811
  const subscribeToSpaceAndUpdate = () => {
8777
8812
  const oldSetSize = subscribedSpaceKeySet.size;
@@ -9487,4 +9522,4 @@ export {
9487
9522
  importProfileData,
9488
9523
  ClientServicesHost
9489
9524
  };
9490
- //# sourceMappingURL=chunk-27WUD3Q6.mjs.map
9525
+ //# sourceMappingURL=chunk-2I64KBVC.mjs.map