@dxos/client-services 0.6.13-main.548ca8d → 0.6.13-main.ed424a1

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 (70) hide show
  1. package/dist/lib/browser/{chunk-UEQIHAL2.mjs → chunk-IPWEAPT2.mjs} +728 -379
  2. package/dist/lib/browser/chunk-IPWEAPT2.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +5 -1
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +5 -1
  7. package/dist/lib/browser/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-MA5EWTRH.cjs → chunk-DJIOUOAF.cjs} +769 -422
  9. package/dist/lib/node/chunk-DJIOUOAF.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +49 -45
  11. package/dist/lib/node/index.cjs.map +1 -1
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +12 -8
  14. package/dist/lib/node/testing/index.cjs.map +3 -3
  15. package/dist/lib/node-esm/{chunk-AIBLDI4U.mjs → chunk-MMU5KC57.mjs} +728 -379
  16. package/dist/lib/node-esm/chunk-MMU5KC57.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +5 -1
  18. package/dist/lib/node-esm/index.mjs.map +1 -1
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +5 -1
  21. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  22. package/dist/types/src/index.d.ts +1 -0
  23. package/dist/types/src/index.d.ts.map +1 -1
  24. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +35 -0
  25. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -0
  26. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +10 -0
  27. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -0
  28. package/dist/types/src/packlets/agents/index.d.ts +3 -0
  29. package/dist/types/src/packlets/agents/index.d.ts.map +1 -0
  30. package/dist/types/src/packlets/identity/identity-manager.d.ts +11 -7
  31. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  32. package/dist/types/src/packlets/identity/identity.d.ts +4 -2
  33. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  34. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  35. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
  36. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  37. package/dist/types/src/packlets/services/service-context.d.ts +4 -1
  38. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  39. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  40. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -0
  41. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  42. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
  43. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  44. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +4 -0
  45. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  46. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  47. package/dist/types/src/version.d.ts +1 -1
  48. package/package.json +38 -38
  49. package/src/index.ts +1 -0
  50. package/src/packlets/agents/edge-agent-manager.ts +163 -0
  51. package/src/packlets/agents/edge-agent-service.ts +42 -0
  52. package/src/packlets/agents/index.ts +6 -0
  53. package/src/packlets/identity/identity-manager.test.ts +26 -10
  54. package/src/packlets/identity/identity-manager.ts +19 -19
  55. package/src/packlets/identity/identity.test.ts +2 -0
  56. package/src/packlets/identity/identity.ts +21 -12
  57. package/src/packlets/invitations/device-invitation-protocol.ts +5 -1
  58. package/src/packlets/invitations/edge-invitation-handler.ts +6 -5
  59. package/src/packlets/invitations/invitations-handler.ts +1 -2
  60. package/src/packlets/services/service-context.ts +75 -45
  61. package/src/packlets/services/service-host.ts +8 -0
  62. package/src/packlets/spaces/data-space-manager.ts +4 -2
  63. package/src/packlets/spaces/data-space.ts +3 -0
  64. package/src/packlets/spaces/edge-feed-replicator.test.ts +5 -6
  65. package/src/packlets/spaces/notarization-plugin.ts +27 -0
  66. package/src/packlets/testing/test-builder.ts +4 -0
  67. package/src/version.ts +1 -1
  68. package/dist/lib/browser/chunk-UEQIHAL2.mjs.map +0 -7
  69. package/dist/lib/node/chunk-MA5EWTRH.cjs.map +0 -7
  70. package/dist/lib/node-esm/chunk-AIBLDI4U.mjs.map +0 -7
@@ -355,7 +355,7 @@ export class InvitationsHandler {
355
355
  const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
356
356
  onInvitationSuccess: async (admissionResponse, admissionRequest) => {
357
357
  const result = await protocol.accept(admissionResponse, admissionRequest);
358
- log('admitted by edge', { ...protocol.toJSON() });
358
+ log.info('admitted by edge', { ...protocol.toJSON() });
359
359
  guardedState.complete({ ...guardedState.current, ...result, state: Invitation.State.SUCCESS });
360
360
  },
361
361
  });
@@ -454,7 +454,6 @@ export class InvitationsHandler {
454
454
  throw new Error('challenge missing in the introduction');
455
455
  }
456
456
  log('sending authentication request');
457
- setState(Invitation.State.AUTHENTICATING);
458
457
  const signature = sign(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
459
458
  const response = await extension.rpc.InvitationHostService.authenticate({
460
459
  signedChallenge: signature,
@@ -2,7 +2,7 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { Mutex, scheduleMicroTask, Trigger } from '@dxos/async';
5
+ import { Mutex, Trigger } from '@dxos/async';
6
6
  import { Context, Resource } from '@dxos/context';
7
7
  import { getCredentialAssertion, type CredentialProcessor } from '@dxos/credentials';
8
8
  import { failUndefined, warnAfterTimeout } from '@dxos/debug';
@@ -15,7 +15,7 @@ import {
15
15
  valueEncoding,
16
16
  } from '@dxos/echo-pipeline';
17
17
  import { createChainEdgeIdentity, createEphemeralEdgeIdentity } from '@dxos/edge-client';
18
- import type { EdgeHttpClient, EdgeConnection } from '@dxos/edge-client';
18
+ import type { EdgeHttpClient, EdgeConnection, EdgeIdentity } from '@dxos/edge-client';
19
19
  import { FeedFactory, FeedStore } from '@dxos/feed-store';
20
20
  import { invariant } from '@dxos/invariant';
21
21
  import { Keyring } from '@dxos/keyring';
@@ -34,6 +34,7 @@ import { BlobStore } from '@dxos/teleport-extension-object-sync';
34
34
  import { trace as Trace } from '@dxos/tracing';
35
35
  import { safeInstanceof } from '@dxos/util';
36
36
 
37
+ import { EdgeAgentManager } from '../agents';
37
38
  import {
38
39
  IdentityManager,
39
40
  type CreateIdentityOptions,
@@ -42,11 +43,11 @@ import {
42
43
  } from '../identity';
43
44
  import {
44
45
  DeviceInvitationProtocol,
46
+ type InvitationConnectionParams,
45
47
  InvitationsHandler,
46
48
  InvitationsManager,
47
49
  SpaceInvitationProtocol,
48
50
  type InvitationProtocol,
49
- type InvitationConnectionParams,
50
51
  } from '../invitations';
51
52
  import { DataSpaceManager, type DataSpaceManagerRuntimeParams, type SigningContext } from '../spaces';
52
53
 
@@ -83,6 +84,7 @@ export class ServiceContext extends Resource {
83
84
 
84
85
  // Initialized after identity is initialized.
85
86
  public dataSpaceManager?: DataSpaceManager;
87
+ public edgeAgentManager?: EdgeAgentManager;
86
88
 
87
89
  private readonly _handlerFactories = new Map<
88
90
  Invitation.Kind,
@@ -138,40 +140,6 @@ export class ServiceContext extends Resource {
138
140
  devicePresenceAnnounceInterval: this._runtimeParams?.devicePresenceAnnounceInterval,
139
141
  edgeConnection: this._edgeConnection,
140
142
  edgeFeatures: this._edgeFeatures,
141
- callbacks: {
142
- onIdentityConstruction: (identity) => {
143
- if (this._edgeConnection) {
144
- scheduleMicroTask(this._ctx, async () => {
145
- using _ = await this._edgeIdentityUpdateMutex.acquire();
146
-
147
- log.info('Setting identity on edge connection', {
148
- identity: identity.identityKey.toHex(),
149
- oldIdentity: this._edgeConnection!.identityKey,
150
- swarms: this.networkManager.topics,
151
- });
152
-
153
- await warnAfterTimeout(10_000, 'Waiting for identity to be ready for edge connection', async () => {
154
- await identity.ready();
155
- });
156
-
157
- invariant(identity.deviceCredentialChain);
158
- this._edgeConnection!.setIdentity(
159
- await createChainEdgeIdentity(
160
- identity.signer,
161
- identity.identityKey,
162
- identity.deviceKey,
163
- identity.deviceCredentialChain,
164
- [], // TODO(dmaretskyi): Service access credentials.
165
- ),
166
- );
167
- this.networkManager.setPeerInfo({
168
- identityKey: identity.identityKey.toHex(),
169
- peerKey: identity.deviceKey.toHex(),
170
- });
171
- });
172
- }
173
- },
174
- },
175
143
  });
176
144
 
177
145
  this.echoHost = new EchoHost({ kv: this.level });
@@ -179,7 +147,7 @@ export class ServiceContext extends Resource {
179
147
  this._meshReplicator = new MeshEchoReplicator();
180
148
 
181
149
  this.invitations = new InvitationsHandler(
182
- this.networkManager,
150
+ this.networkManager, //
183
151
  this._edgeHttpClient,
184
152
  _runtimeParams?.invitationConnectionDefaultParams,
185
153
  );
@@ -217,11 +185,12 @@ export class ServiceContext extends Resource {
217
185
 
218
186
  log('opening...');
219
187
  log.trace('dxos.sdk.service-context.open', trace.begin({ id: this._instanceId }));
220
- if (this._edgeConnection) {
221
- // TODO(dmaretskyi): Use device key.
222
- this._edgeConnection.setIdentity(await createEphemeralEdgeIdentity());
223
- await this._edgeConnection.open();
224
- }
188
+
189
+ await this.identityManager.open(ctx);
190
+
191
+ await this._setNetworkIdentity();
192
+
193
+ await this._edgeConnection?.open();
225
194
  await this.signalManager.open();
226
195
  await this.networkManager.open();
227
196
 
@@ -236,9 +205,9 @@ export class ServiceContext extends Resource {
236
205
 
237
206
  await this.metadataStore.load();
238
207
  await this.spaceManager.open();
239
- await this.identityManager.open(ctx);
240
208
 
241
209
  if (this.identityManager.identity) {
210
+ await this.identityManager.identity.joinNetwork();
242
211
  await this._initialize(ctx);
243
212
  }
244
213
 
@@ -255,6 +224,7 @@ export class ServiceContext extends Resource {
255
224
  await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
256
225
  }
257
226
  await this.dataSpaceManager?.close();
227
+ await this.edgeAgentManager?.close();
258
228
  await this.identityManager.close();
259
229
  await this.spaceManager.close();
260
230
  await this.feedStore.close();
@@ -270,6 +240,8 @@ export class ServiceContext extends Resource {
270
240
 
271
241
  async createIdentity(params: CreateIdentityOptions = {}) {
272
242
  const identity = await this.identityManager.createIdentity(params);
243
+ await this._setNetworkIdentity();
244
+ await identity.joinNetwork();
273
245
  await this._initialize(new Context());
274
246
  return identity;
275
247
  }
@@ -291,7 +263,10 @@ export class ServiceContext extends Resource {
291
263
  }
292
264
 
293
265
  private async _acceptIdentity(params: JoinIdentityParams) {
294
- const identity = await this.identityManager.acceptIdentity(params);
266
+ const { identity, identityRecord } = await this.identityManager.prepareIdentity(params);
267
+ await this._setNetworkIdentity({ deviceCredential: params.authorizedDeviceCredential! });
268
+ await identity.joinNetwork();
269
+ await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
295
270
  await this._initialize(new Context());
296
271
  return identity;
297
272
  }
@@ -336,6 +311,14 @@ export class ServiceContext extends Resource {
336
311
  });
337
312
  await this.dataSpaceManager.open();
338
313
 
314
+ this.edgeAgentManager = new EdgeAgentManager(
315
+ this._edgeFeatures,
316
+ this._edgeHttpClient,
317
+ this.dataSpaceManager,
318
+ identity,
319
+ );
320
+ await this.edgeAgentManager.open();
321
+
339
322
  this._handlerFactories.set(Invitation.Kind.SPACE, (invitation) => {
340
323
  invariant(this.dataSpaceManager, 'dataSpaceManager not initialized yet');
341
324
  return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
@@ -375,4 +358,51 @@ export class ServiceContext extends Resource {
375
358
 
376
359
  await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
377
360
  }
361
+
362
+ private async _setNetworkIdentity(params?: { deviceCredential: Credential }) {
363
+ using _ = await this._edgeIdentityUpdateMutex.acquire();
364
+
365
+ let edgeIdentity: EdgeIdentity;
366
+ const identity = this.identityManager.identity;
367
+ if (identity) {
368
+ log.info('Setting identity on edge connection', {
369
+ identity: identity.identityKey.toHex(),
370
+ swarms: this.networkManager.topics,
371
+ });
372
+ if (params?.deviceCredential) {
373
+ edgeIdentity = await createChainEdgeIdentity(
374
+ identity.signer,
375
+ identity.identityKey,
376
+ identity.deviceKey,
377
+ { credential: params.deviceCredential },
378
+ [], // TODO(dmaretskyi): Service access credentials.
379
+ );
380
+ } else {
381
+ // TODO: throw here or from identity if device chain can't be loaded, to avoid indefinite hangup
382
+ await warnAfterTimeout(10_000, 'Waiting for identity to be ready for edge connection', async () => {
383
+ await identity.ready();
384
+ });
385
+
386
+ invariant(identity.deviceCredentialChain);
387
+
388
+ edgeIdentity = await createChainEdgeIdentity(
389
+ identity.signer,
390
+ identity.identityKey,
391
+ identity.deviceKey,
392
+ identity.deviceCredentialChain,
393
+ [], // TODO(dmaretskyi): Service access credentials.
394
+ );
395
+ }
396
+ } else {
397
+ edgeIdentity = await createEphemeralEdgeIdentity();
398
+ }
399
+
400
+ if (this._edgeConnection) {
401
+ this._edgeConnection.setIdentity(edgeIdentity);
402
+ }
403
+ this.networkManager.setPeerInfo({
404
+ identityKey: edgeIdentity.identityKey,
405
+ peerKey: edgeIdentity.peerKey,
406
+ });
407
+ }
378
408
  }
@@ -26,6 +26,7 @@ import { WebsocketRpcClient } from '@dxos/websocket-rpc';
26
26
 
27
27
  import { ServiceContext, type ServiceContextRuntimeParams } from './service-context';
28
28
  import { ServiceRegistry } from './service-registry';
29
+ import { EdgeAgentServiceImpl } from '../agents';
29
30
  import { DevicesServiceImpl } from '../devices';
30
31
  import { DevtoolsHostEvents, DevtoolsServiceImpl } from '../devtools';
31
32
  import {
@@ -289,6 +290,11 @@ export class ClientServicesHost {
289
290
  return this._serviceContext.dataSpaceManager!;
290
291
  };
291
292
 
293
+ const agentManagerProvider = async () => {
294
+ await this._serviceContext.initialized.wait();
295
+ return this._serviceContext.edgeAgentManager!;
296
+ };
297
+
292
298
  const identityService = new IdentityServiceImpl(
293
299
  this._serviceContext.identityManager,
294
300
  this._serviceContext.keyring,
@@ -330,6 +336,8 @@ export class ClientServicesHost {
330
336
  config: this._config,
331
337
  context: this._serviceContext,
332
338
  }),
339
+
340
+ EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider),
333
341
  });
334
342
 
335
343
  await this._serviceContext.open(ctx);
@@ -35,7 +35,7 @@ import {
35
35
  type ObjectStructure,
36
36
  type SpaceDoc,
37
37
  } from '@dxos/echo-protocol';
38
- import { TYPE_PROPERTIES, generateEchoId, getTypeReference } from '@dxos/echo-schema';
38
+ import { TYPE_PROPERTIES, createObjectId, getTypeReference } from '@dxos/echo-schema';
39
39
  import type { EdgeConnection, EdgeHttpClient } from '@dxos/edge-client';
40
40
  import { writeMessages, type FeedStore } from '@dxos/feed-store';
41
41
  import { invariant } from '@dxos/invariant';
@@ -120,6 +120,7 @@ export type DataSpaceManagerParams = {
120
120
  export type DataSpaceManagerRuntimeParams = {
121
121
  spaceMemberPresenceAnnounceInterval?: number;
122
122
  spaceMemberPresenceOfflineTimeout?: number;
123
+ activeEdgeNotarizationPollingInterval?: number;
123
124
  disableP2pReplication?: boolean;
124
125
  };
125
126
 
@@ -296,7 +297,7 @@ export class DataSpaceManager extends Resource {
296
297
  },
297
298
  };
298
299
 
299
- const propertiesId = generateEchoId();
300
+ const propertiesId = createObjectId();
300
301
  document.change((doc: SpaceDoc) => {
301
302
  setDeep(doc, ['objects', propertiesId], properties);
302
303
  });
@@ -507,6 +508,7 @@ export class DataSpaceManager extends Resource {
507
508
  edgeConnection: this._edgeConnection,
508
509
  edgeHttpClient: this._edgeHttpClient,
509
510
  edgeFeatures: this._edgeFeatures,
511
+ activeEdgeNotarizationPollingInterval: this._runtimeParams?.activeEdgeNotarizationPollingInterval,
510
512
  });
511
513
  dataSpace.postOpen.append(async () => {
512
514
  const setting = dataSpace.getEdgeReplicationSetting();
@@ -82,6 +82,7 @@ export type DataSpaceParams = {
82
82
  edgeConnection?: EdgeConnection;
83
83
  edgeHttpClient?: EdgeHttpClient;
84
84
  edgeFeatures?: Runtime.Client.EdgeFeatures;
85
+ activeEdgeNotarizationPollingInterval?: number;
85
86
  };
86
87
 
87
88
  export type CreateEpochOptions = {
@@ -146,6 +147,7 @@ export class DataSpace {
146
147
  spaceId: this._inner.id,
147
148
  edgeClient: params.edgeHttpClient,
148
149
  edgeFeatures: params.edgeFeatures,
150
+ activeEdgePollingInterval: params.activeEdgeNotarizationPollingInterval,
149
151
  });
150
152
 
151
153
  this.authVerifier = new TrustedKeySetAuthVerifier({
@@ -242,6 +244,7 @@ export class DataSpace {
242
244
  }
243
245
 
244
246
  await this._inner.open(new Context());
247
+ await this._inner.startProtocol();
245
248
 
246
249
  await this._edgeFeedReplicator?.open();
247
250
 
@@ -3,16 +3,15 @@
3
3
  //
4
4
 
5
5
  import { decode as decodeCbor, encode as encodeCbor } from 'cbor-x';
6
- import { getRandomPort } from 'get-port-please';
7
- import { describe, test, onTestFinished, vi, expect } from 'vitest';
6
+ import { getPort } from 'get-port-please';
7
+ import { describe, expect, onTestFinished, test, vi } from 'vitest';
8
8
 
9
- import { Trigger, sleep } from '@dxos/async';
9
+ import { sleep, Trigger } from '@dxos/async';
10
10
  import { Context } from '@dxos/context';
11
11
  import { valueEncoding } from '@dxos/echo-pipeline';
12
12
  import { createEphemeralEdgeIdentity, EdgeClient, EdgeIdentityChangedError } from '@dxos/edge-client';
13
13
  import { createTestEdgeWsServer } from '@dxos/edge-client/testing';
14
- import { FeedFactory, FeedStore } from '@dxos/feed-store';
15
- import { type FeedWrapper } from '@dxos/feed-store';
14
+ import { FeedFactory, FeedStore, type FeedWrapper } from '@dxos/feed-store';
16
15
  import { Keyring } from '@dxos/keyring';
17
16
  import { SpaceId } from '@dxos/keys';
18
17
  import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
@@ -188,7 +187,7 @@ describe('EdgeFeedReplicator', () => {
188
187
  });
189
188
 
190
189
  const createEdge = async () => {
191
- const port = await getRandomPort('127.0.0.1');
190
+ const port = await getPort({ host: 'localhost', port: 7200, portRange: [7200, 7299] });
192
191
  let lastBlockIndex = -1;
193
192
  const admitConnection = new Trigger();
194
193
  const { cleanup, endpoint, messageSink, sendResponseMessage } = await createTestEdgeWsServer(port, {
@@ -25,6 +25,8 @@ const DEFAULT_SUCCESS_DELAY = 1_000;
25
25
 
26
26
  const DEFAULT_NOTARIZE_TIMEOUT = 10_000;
27
27
 
28
+ const DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL = 3_000;
29
+
28
30
  const MAX_EDGE_RETRIES = 2;
29
31
 
30
32
  const WRITER_NOT_SET_ERROR_CODE = 'WRITER_NOT_SET';
@@ -35,6 +37,7 @@ export type NotarizationPluginParams = {
35
37
  spaceId: SpaceId;
36
38
  edgeClient?: EdgeHttpClient;
37
39
  edgeFeatures?: Runtime.Client.EdgeFeatures;
40
+ activeEdgePollingInterval?: number;
38
41
  };
39
42
 
40
43
  export type NotarizeParams = {
@@ -85,6 +88,9 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
85
88
  private readonly _processedCredentials = new ComplexSet<PublicKey>(PublicKey.hash);
86
89
  private readonly _processCredentialsTriggers = new ComplexMap<PublicKey, Trigger>(PublicKey.hash);
87
90
 
91
+ private _activeEdgePollingIntervalHandle: any | undefined = undefined;
92
+ private readonly _activeEdgePollingInterval: number;
93
+
88
94
  @logInfo
89
95
  private readonly _spaceId: SpaceId;
90
96
 
@@ -93,11 +99,28 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
93
99
  constructor(params: NotarizationPluginParams) {
94
100
  super();
95
101
  this._spaceId = params.spaceId;
102
+ this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
96
103
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
97
104
  this._edgeClient = params.edgeClient;
98
105
  }
99
106
  }
100
107
 
108
+ setActiveEdgePollingEnabled(enabled: boolean) {
109
+ invariant(this.isOpen);
110
+ const client = this._edgeClient;
111
+ invariant(client);
112
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
113
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
114
+ if (this._writer) {
115
+ this._notarizePendingEdgeCredentials(client, this._writer);
116
+ }
117
+ }, this._activeEdgePollingInterval);
118
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
119
+ clearInterval(this._activeEdgePollingIntervalHandle);
120
+ this._activeEdgePollingIntervalHandle = undefined;
121
+ }
122
+ }
123
+
101
124
  get hasWriter() {
102
125
  return !!this._writer;
103
126
  }
@@ -109,6 +132,10 @@ export class NotarizationPlugin extends Resource implements CredentialProcessor
109
132
  }
110
133
 
111
134
  protected override async _close() {
135
+ if (this._activeEdgePollingIntervalHandle) {
136
+ clearInterval(this._activeEdgePollingIntervalHandle);
137
+ this._activeEdgePollingIntervalHandle = undefined;
138
+ }
112
139
  await this._ctx.dispose();
113
140
  }
114
141
 
@@ -218,6 +218,10 @@ export class TestPeer {
218
218
 
219
219
  async createIdentity() {
220
220
  this._props.signingContext ??= await createSigningContext(this.keyring);
221
+ this.networkManager.setPeerInfo({
222
+ identityKey: this._props.signingContext.identityKey.toHex(),
223
+ peerKey: this._props.signingContext.deviceKey.toHex(),
224
+ });
221
225
  }
222
226
 
223
227
  async destroy() {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const DXOS_VERSION = "0.6.13-main.548ca8d";
1
+ export const DXOS_VERSION = "0.6.13-main.ed424a1";