@dxos/client-services 0.7.5-labs.8a82073 → 0.7.5-labs.a8b535d

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 (33) hide show
  1. package/dist/lib/browser/{chunk-XCOUT2K5.mjs → chunk-LGIF7IGW.mjs} +39 -25
  2. package/dist/lib/browser/chunk-LGIF7IGW.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-KBHGJAMG.cjs → chunk-RHAQYBK2.cjs} +41 -27
  7. package/dist/lib/node/chunk-RHAQYBK2.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-YPF3TFCW.mjs → chunk-UBSDPLI2.mjs} +39 -25
  12. package/dist/lib/node-esm/chunk-UBSDPLI2.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/agents/edge-agent-manager.d.ts.map +1 -1
  17. package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
  18. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +2 -2
  19. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
  20. package/dist/types/src/packlets/identity/identity-service.d.ts +2 -2
  21. package/dist/types/src/packlets/services/service-host.d.ts +1 -1
  22. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  23. package/dist/types/src/version.d.ts +1 -1
  24. package/package.json +39 -38
  25. package/src/packlets/agents/edge-agent-manager.ts +6 -0
  26. package/src/packlets/diagnostics/diagnostics-collector.ts +2 -2
  27. package/src/packlets/identity/identity-recovery-manager.ts +7 -5
  28. package/src/packlets/spaces/data-space-manager.ts +2 -2
  29. package/src/packlets/spaces/data-space.ts +2 -2
  30. package/src/version.ts +1 -1
  31. package/dist/lib/browser/chunk-XCOUT2K5.mjs.map +0 -7
  32. package/dist/lib/node/chunk-KBHGJAMG.cjs.map +0 -7
  33. package/dist/lib/node-esm/chunk-YPF3TFCW.mjs.map +0 -7
@@ -6,7 +6,7 @@ import {
6
6
  InvitationsManager,
7
7
  ServiceContext,
8
8
  SpaceInvitationProtocol
9
- } from "../chunk-XCOUT2K5.mjs";
9
+ } from "../chunk-LGIF7IGW.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_KBHGJAMG_exports = {};
30
- __export(chunk_KBHGJAMG_exports, {
29
+ var chunk_RHAQYBK2_exports = {};
30
+ __export(chunk_RHAQYBK2_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -72,7 +72,7 @@ __export(chunk_KBHGJAMG_exports, {
72
72
  subscribeToSpaces: () => subscribeToSpaces,
73
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
74
74
  });
75
- module.exports = __toCommonJS(chunk_KBHGJAMG_exports);
75
+ module.exports = __toCommonJS(chunk_RHAQYBK2_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");
@@ -735,7 +735,7 @@ var DevtoolsServiceImpl = class {
735
735
  });
736
736
  }
737
737
  };
738
- var DXOS_VERSION = "0.7.5-labs.8a82073";
738
+ var DXOS_VERSION = "0.7.5-labs.a8b535d";
739
739
  var getPlatform = () => {
740
740
  if (process.browser) {
741
741
  if (typeof window !== "undefined") {
@@ -928,7 +928,7 @@ var findSystemServiceProvider = () => {
928
928
  };
929
929
  var findConfigs = () => {
930
930
  const configs = import_tracing2.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
931
- return configs.map((r) => r.instance.deref()).filter(import_util2.nonNullable);
931
+ return configs.map((r) => r.instance.deref()).filter(import_util2.isNonNullable);
932
932
  };
933
933
  var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
934
934
  var Credential = import_proto.schema.getCodecForType("dxos.halo.credentials.Credential");
@@ -2666,7 +2666,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2666
2666
  });
2667
2667
  dataSpace.postOpen.append(async () => {
2668
2668
  const setting = dataSpace.getEdgeReplicationSetting();
2669
- if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
2669
+ if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
2670
2670
  await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
2671
2671
  } else if (this._echoEdgeReplicator) {
2672
2672
  (0, import_log8.log)("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
@@ -2681,7 +2681,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2681
2681
  });
2682
2682
  dataSpace.preClose.append(async () => {
2683
2683
  const setting = dataSpace.getEdgeReplicationSetting();
2684
- if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
2684
+ if (!setting || setting === import_metadata.EdgeReplicationSetting.ENABLED) {
2685
2685
  await this._echoEdgeReplicator?.disconnectFromSpace(dataSpace.id);
2686
2686
  }
2687
2687
  });
@@ -7062,6 +7062,18 @@ var EdgeAgentManager = class extends import_context15.Resource {
7062
7062
  haloSpaceKey: this._identity.haloSpaceKey.toHex()
7063
7063
  });
7064
7064
  const deviceKey = import_keys15.PublicKey.fromHex(response.deviceKey);
7065
+ if (await this._identity.authorizedDeviceKeys.has(deviceKey)) {
7066
+ import_log21.log.info("agent was already added to HALO, ignoring response", {
7067
+ response
7068
+ }, {
7069
+ F: __dxlog_file25,
7070
+ L: 67,
7071
+ S: this,
7072
+ C: (f, a) => f(...a)
7073
+ });
7074
+ this._updateStatus(import_protocols14.EdgeAgentStatus.ACTIVE, deviceKey);
7075
+ return;
7076
+ }
7065
7077
  await this._identity.admitDevice({
7066
7078
  deviceKey,
7067
7079
  controlFeedKey: import_keys15.PublicKey.fromHex(response.feedKey),
@@ -7070,7 +7082,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7070
7082
  });
7071
7083
  (0, import_log21.log)("agent created", response, {
7072
7084
  F: __dxlog_file25,
7073
- L: 73,
7085
+ L: 79,
7074
7086
  S: this,
7075
7087
  C: (f, a) => f(...a)
7076
7088
  });
@@ -7082,7 +7094,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7082
7094
  isEnabled
7083
7095
  }, {
7084
7096
  F: __dxlog_file25,
7085
- L: 81,
7097
+ L: 87,
7086
7098
  S: this,
7087
7099
  C: (f, a) => f(...a)
7088
7100
  });
@@ -7115,7 +7127,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7115
7127
  async _fetchAgentStatus() {
7116
7128
  (0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
7117
7129
  F: __dxlog_file25,
7118
- L: 115,
7130
+ L: 121,
7119
7131
  S: this,
7120
7132
  A: [
7121
7133
  "this._edgeHttpClient",
@@ -7125,7 +7137,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7125
7137
  try {
7126
7138
  (0, import_log21.log)("fetching agent status", void 0, {
7127
7139
  F: __dxlog_file25,
7128
- L: 117,
7140
+ L: 123,
7129
7141
  S: this,
7130
7142
  C: (f, a) => f(...a)
7131
7143
  });
@@ -7144,7 +7156,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7144
7156
  err
7145
7157
  }, {
7146
7158
  F: __dxlog_file25,
7147
- L: 127,
7159
+ L: 133,
7148
7160
  S: this,
7149
7161
  C: (f, a) => f(...a)
7150
7162
  });
@@ -7157,7 +7169,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7157
7169
  retryAfterMs
7158
7170
  }, {
7159
7171
  F: __dxlog_file25,
7160
- L: 132,
7172
+ L: 138,
7161
7173
  S: this,
7162
7174
  C: (f, a) => f(...a)
7163
7175
  });
@@ -7193,7 +7205,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7193
7205
  spaceId: space.id
7194
7206
  }, {
7195
7207
  F: __dxlog_file25,
7196
- L: 159,
7208
+ L: 165,
7197
7209
  S: this,
7198
7210
  C: (f, a) => f(...a)
7199
7211
  });
@@ -7213,7 +7225,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7213
7225
  status
7214
7226
  }, {
7215
7227
  F: __dxlog_file25,
7216
- L: 175,
7228
+ L: 181,
7217
7229
  S: this,
7218
7230
  C: (f, a) => f(...a)
7219
7231
  });
@@ -7286,7 +7298,7 @@ var EdgeIdentityRecoveryManager = class {
7286
7298
  this._identityProvider = _identityProvider;
7287
7299
  this._acceptRecoveredIdentity = _acceptRecoveredIdentity;
7288
7300
  }
7289
- async createRecoveryCredential({ recoveryKey, algorithm }) {
7301
+ async createRecoveryCredential({ recoveryKey, lookupKey, algorithm }) {
7290
7302
  const identity = this._identityProvider();
7291
7303
  (0, import_invariant22.invariant)(identity, void 0, {
7292
7304
  F: __dxlog_file26,
@@ -7298,15 +7310,16 @@ var EdgeIdentityRecoveryManager = class {
7298
7310
  ]
7299
7311
  });
7300
7312
  let recoveryCode;
7301
- if (!recoveryKey) {
7313
+ if (!recoveryKey || !lookupKey) {
7302
7314
  recoveryCode = (0, import_credentials23.generateSeedPhrase)();
7303
7315
  const keypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
7304
7316
  recoveryKey = import_keys17.PublicKey.from(keypair.publicKey);
7317
+ lookupKey = import_keys17.PublicKey.random();
7305
7318
  algorithm = "ED25519";
7306
7319
  }
7307
7320
  (0, import_invariant22.invariant)(algorithm, "Algorithm is required.", {
7308
7321
  F: __dxlog_file26,
7309
- L: 47,
7322
+ L: 48,
7310
7323
  S: this,
7311
7324
  A: [
7312
7325
  "algorithm",
@@ -7320,7 +7333,8 @@ var EdgeIdentityRecoveryManager = class {
7320
7333
  "@type": "dxos.halo.credentials.IdentityRecovery",
7321
7334
  recoveryKey,
7322
7335
  identityKey,
7323
- algorithm
7336
+ algorithm,
7337
+ lookupKey
7324
7338
  }
7325
7339
  });
7326
7340
  const receipt = await identity.controlPipeline.writer.write({
@@ -7341,7 +7355,7 @@ var EdgeIdentityRecoveryManager = class {
7341
7355
  async requestRecoveryChallenge() {
7342
7356
  (0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
7343
7357
  F: __dxlog_file26,
7344
- L: 66,
7358
+ L: 68,
7345
7359
  S: this,
7346
7360
  A: [
7347
7361
  "this._edgeClient",
@@ -7368,10 +7382,10 @@ var EdgeIdentityRecoveryManager = class {
7368
7382
  };
7369
7383
  }
7370
7384
  }
7371
- async recoverIdentityWithExternalSignature({ identityDid, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
7385
+ async recoverIdentityWithExternalSignature({ lookupKey, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
7372
7386
  (0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
7373
7387
  F: __dxlog_file26,
7374
- L: 98,
7388
+ L: 100,
7375
7389
  S: this,
7376
7390
  A: [
7377
7391
  "this._edgeClient",
@@ -7379,7 +7393,7 @@ var EdgeIdentityRecoveryManager = class {
7379
7393
  ]
7380
7394
  });
7381
7395
  const request = {
7382
- identityDid,
7396
+ lookupKey: lookupKey.toHex(),
7383
7397
  deviceKey: deviceKey.toHex(),
7384
7398
  controlFeedKey: controlFeedKey.toHex(),
7385
7399
  signature: clientDataJson && authenticatorData ? {
@@ -7402,7 +7416,7 @@ var EdgeIdentityRecoveryManager = class {
7402
7416
  async recoverIdentity({ recoveryCode }) {
7403
7417
  (0, import_invariant22.invariant)(this._edgeClient, "Not connected to EDGE.", {
7404
7418
  F: __dxlog_file26,
7405
- L: 128,
7419
+ L: 130,
7406
7420
  S: this,
7407
7421
  A: [
7408
7422
  "this._edgeClient",
@@ -7414,7 +7428,7 @@ var EdgeIdentityRecoveryManager = class {
7414
7428
  const deviceKey = await this._keyring.createKey();
7415
7429
  const controlFeedKey = await this._keyring.createKey();
7416
7430
  const request = {
7417
- recoveryKey: recoveryKey.toHex(),
7431
+ lookupKey: recoveryKey.toHex(),
7418
7432
  deviceKey: deviceKey.toHex(),
7419
7433
  controlFeedKey: controlFeedKey.toHex()
7420
7434
  };
@@ -7433,7 +7447,7 @@ var EdgeIdentityRecoveryManager = class {
7433
7447
  }
7434
7448
  import_log23.log.info("recovering identity", response, {
7435
7449
  F: __dxlog_file26,
7436
- L: 154,
7450
+ L: 156,
7437
7451
  S: this,
7438
7452
  C: (f, a) => f(...a)
7439
7453
  });
@@ -8962,4 +8976,4 @@ ClientServicesHost = _ts_decorate11([
8962
8976
  subscribeToSpaces,
8963
8977
  subscribeToSwarmInfo
8964
8978
  });
8965
- //# sourceMappingURL=chunk-KBHGJAMG.cjs.map
8979
+ //# sourceMappingURL=chunk-RHAQYBK2.cjs.map