@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
@@ -6,7 +6,7 @@ import {
6
6
  InvitationsManager,
7
7
  ServiceContext,
8
8
  SpaceInvitationProtocol
9
- } from "../chunk-27WUD3Q6.mjs";
9
+ } from "../chunk-5VIKZEA3.mjs";
10
10
 
11
11
  // packages/sdk/client-services/src/packlets/testing/credential-utils.ts
12
12
  import { createCredential } from "@dxos/credentials";
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_SJ3DQ4HS_exports = {};
30
- __export(chunk_SJ3DQ4HS_exports, {
29
+ var chunk_HAYNZLSJ_exports = {};
30
+ __export(chunk_HAYNZLSJ_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -72,7 +72,7 @@ __export(chunk_SJ3DQ4HS_exports, {
72
72
  subscribeToSpaces: () => subscribeToSpaces,
73
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
74
74
  });
75
- module.exports = __toCommonJS(chunk_SJ3DQ4HS_exports);
75
+ module.exports = __toCommonJS(chunk_HAYNZLSJ_exports);
76
76
  var import_async = require("@dxos/async");
77
77
  var import_stream = require("@dxos/codec-protobuf/stream");
78
78
  var import_feed_store = require("@dxos/feed-store");
@@ -389,7 +389,7 @@ var import_util17 = require("@dxos/util");
389
389
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
390
390
  var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
391
391
  return new import_stream.Stream(({ next }) => {
392
- const subscriptions = new import_async.EventSubscriptions();
392
+ const subscriptions = new import_async.SubscriptionList();
393
393
  const feedMap = new import_util.ComplexMap(import_keys.PublicKey.hash);
394
394
  const update = () => {
395
395
  const { feeds } = feedStore;
@@ -451,7 +451,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
451
451
  if (!feedKey) {
452
452
  return;
453
453
  }
454
- const subscriptions = new import_async.EventSubscriptions();
454
+ const subscriptions = new import_async.SubscriptionList();
455
455
  const timeout = setTimeout(async () => {
456
456
  const feed = feedStore.getFeed(feedKey);
457
457
  if (!feed) {
@@ -744,7 +744,7 @@ var DevtoolsServiceImpl = class {
744
744
  });
745
745
  }
746
746
  };
747
- var DXOS_VERSION = "0.8.1-staging.391c573";
747
+ var DXOS_VERSION = "0.8.1-staging.97aedb1";
748
748
  var getPlatform = () => {
749
749
  if (process.browser) {
750
750
  if (typeof window !== "undefined") {
@@ -2320,7 +2320,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2320
2320
  dataFeedKey,
2321
2321
  state: import_services6.SpaceState.SPACE_ACTIVE
2322
2322
  };
2323
- import_log8.log.info("creating space...", {
2323
+ (0, import_log8.log)("creating space...", {
2324
2324
  spaceId,
2325
2325
  spaceKey
2326
2326
  }, {
@@ -3126,7 +3126,7 @@ var SpacesServiceImpl = class {
3126
3126
  });
3127
3127
  (0, import_async12.scheduleTask)(ctx, async () => {
3128
3128
  const dataSpaceManager = await this._getDataSpaceManager();
3129
- const subscriptions = new import_async12.EventSubscriptions();
3129
+ const subscriptions = new import_async12.SubscriptionList();
3130
3130
  ctx.onDispose(() => subscriptions.clear());
3131
3131
  const subscribeSpaces = () => {
3132
3132
  subscriptions.clear();
@@ -4194,6 +4194,10 @@ var IdentityServiceImpl = class extends import_context10.Resource {
4194
4194
  });
4195
4195
  } else if (request.external) {
4196
4196
  await this._recoveryManager.recoverIdentityWithExternalSignature(request.external);
4197
+ } else if (request.token) {
4198
+ await this._recoveryManager.recoverIdentityWithToken({
4199
+ token: request.token
4200
+ });
4197
4201
  } else {
4198
4202
  throw new Error("Invalid request.");
4199
4203
  }
@@ -4203,7 +4207,7 @@ var IdentityServiceImpl = class extends import_context10.Resource {
4203
4207
  async signPresentation({ presentation, nonce }) {
4204
4208
  (0, import_invariant12.invariant)(this._identityManager.identity, "Identity not initialized.", {
4205
4209
  F: __dxlog_file14,
4206
- L: 116,
4210
+ L: 118,
4207
4211
  S: this,
4208
4212
  A: [
4209
4213
  "this._identityManager.identity",
@@ -4222,7 +4226,7 @@ var IdentityServiceImpl = class extends import_context10.Resource {
4222
4226
  const identity = this._identityManager.identity;
4223
4227
  (0, import_invariant12.invariant)(identity, "Identity not initialized.", {
4224
4228
  F: __dxlog_file14,
4225
- L: 130,
4229
+ L: 132,
4226
4230
  S: this,
4227
4231
  A: [
4228
4232
  "identity",
@@ -4260,7 +4264,7 @@ var IdentityServiceImpl = class extends import_context10.Resource {
4260
4264
  duplicate: space.id
4261
4265
  }, {
4262
4266
  F: __dxlog_file14,
4263
- L: 164,
4267
+ L: 166,
4264
4268
  S: this,
4265
4269
  C: (f, a) => f(...a)
4266
4270
  });
@@ -4274,7 +4278,7 @@ var IdentityServiceImpl = class extends import_context10.Resource {
4274
4278
  }, (err) => {
4275
4279
  import_log12.log.catch(err, void 0, {
4276
4280
  F: __dxlog_file14,
4277
- L: 175,
4281
+ L: 177,
4278
4282
  S: this,
4279
4283
  C: (f, a) => f(...a)
4280
4284
  });
@@ -7712,10 +7716,41 @@ var EdgeIdentityRecoveryManager = class {
7712
7716
  dataFeedKey: await this._keyring.createKey()
7713
7717
  });
7714
7718
  }
7719
+ /**
7720
+ * Recovery identity using an opaque token sent to the user's email.
7721
+ */
7722
+ async recoverIdentityWithToken({ token }) {
7723
+ (0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
7724
+ F: __dxlog_file27,
7725
+ L: 139,
7726
+ S: this,
7727
+ A: [
7728
+ "this._edgeClient",
7729
+ "'Not connected to EDGE.'"
7730
+ ]
7731
+ });
7732
+ const deviceKey = await this._keyring.createKey();
7733
+ const controlFeedKey = await this._keyring.createKey();
7734
+ const request = {
7735
+ deviceKey: deviceKey.toHex(),
7736
+ controlFeedKey: controlFeedKey.toHex(),
7737
+ token
7738
+ };
7739
+ const response = await this._edgeClient.recoverIdentity(request);
7740
+ await this._acceptRecoveredIdentity({
7741
+ authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
7742
+ haloGenesisFeedKey: import_keys18.PublicKey.fromHex(response.genesisFeedKey),
7743
+ haloSpaceKey: import_keys18.PublicKey.fromHex(response.haloSpaceKey),
7744
+ identityKey: import_keys18.PublicKey.fromHex(response.identityKey),
7745
+ deviceKey,
7746
+ controlFeedKey,
7747
+ dataFeedKey: await this._keyring.createKey()
7748
+ });
7749
+ }
7715
7750
  async recoverIdentity({ recoveryCode }) {
7716
7751
  (0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
7717
7752
  F: __dxlog_file27,
7718
- L: 136,
7753
+ L: 163,
7719
7754
  S: this,
7720
7755
  A: [
7721
7756
  "this._edgeClient",
@@ -7746,7 +7781,7 @@ var EdgeIdentityRecoveryManager = class {
7746
7781
  }
7747
7782
  import_log24.log.info("recovering identity", response, {
7748
7783
  F: __dxlog_file27,
7749
- L: 162,
7784
+ L: 189,
7750
7785
  S: this,
7751
7786
  C: (f, a) => f(...a)
7752
7787
  });
@@ -8507,7 +8542,7 @@ var DevicesServiceImpl = class {
8507
8542
  presenceSubscribed = true;
8508
8543
  }
8509
8544
  };
8510
- const subscriptions = new import_async24.EventSubscriptions();
8545
+ const subscriptions = new import_async24.SubscriptionList();
8511
8546
  if (this._identityManager.identity) {
8512
8547
  subscribeIdentity();
8513
8548
  subscribePresence();
@@ -8580,7 +8615,7 @@ var ContactsServiceImpl = class {
8580
8615
  maxFrequency: 2
8581
8616
  });
8582
8617
  (0, import_async25.scheduleTask)(ctx, async () => {
8583
- const subscriptions = new import_async25.EventSubscriptions();
8618
+ const subscriptions = new import_async25.SubscriptionList();
8584
8619
  ctx.onDispose(() => subscriptions.clear());
8585
8620
  const subscribeToSpaceAndUpdate = () => {
8586
8621
  const oldSetSize = subscribedSpaceKeySet.size;
@@ -9278,4 +9313,4 @@ ClientServicesHost = _ts_decorate11([
9278
9313
  subscribeToSpaces,
9279
9314
  subscribeToSwarmInfo
9280
9315
  });
9281
- //# sourceMappingURL=chunk-SJ3DQ4HS.cjs.map
9316
+ //# sourceMappingURL=chunk-HAYNZLSJ.cjs.map