@dxos/client-services 0.1.41 → 0.1.45-next.45667d4

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 (164) hide show
  1. package/dist/lib/browser/{chunk-T73F4MV4.mjs → chunk-IHSMRQ3L.mjs} +985 -867
  2. package/dist/lib/browser/chunk-IHSMRQ3L.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +7 -3
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +121 -297
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +4 -4
  7. package/dist/lib/node/index.cjs +589 -469
  8. package/dist/lib/node/index.cjs.map +4 -4
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +688 -740
  11. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  12. package/dist/types/src/index.d.ts +1 -0
  13. package/dist/types/src/index.d.ts.map +1 -1
  14. package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
  15. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  16. package/dist/types/src/packlets/devtools/devtools.d.ts +4 -2
  17. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  18. package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
  19. package/dist/types/src/packlets/devtools/network.d.ts +5 -4
  20. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  21. package/dist/types/src/packlets/identity/authenticator.d.ts +1 -1
  22. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  23. package/dist/types/src/packlets/identity/identity-manager.d.ts +2 -4
  24. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  25. package/dist/types/src/packlets/identity/identity.d.ts +1 -1
  26. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  27. package/dist/types/src/packlets/invitations/invitation-extension.d.ts +2 -3
  28. package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
  29. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +1 -3
  30. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  31. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -2
  32. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  33. package/dist/types/src/packlets/network/network-service.d.ts +6 -4
  34. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  35. package/dist/types/src/packlets/services/client-rpc-server.d.ts +2 -2
  36. package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
  37. package/dist/types/src/packlets/services/index.d.ts +0 -1
  38. package/dist/types/src/packlets/services/index.d.ts.map +1 -1
  39. package/dist/types/src/packlets/services/local-client-services.d.ts +1 -1
  40. package/dist/types/src/packlets/services/local-client-services.d.ts.map +1 -1
  41. package/dist/types/src/packlets/services/service-context.d.ts +4 -2
  42. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  43. package/dist/types/src/packlets/services/service-host.d.ts +16 -9
  44. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  45. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +12 -7
  46. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  47. package/dist/types/src/packlets/spaces/data-space.d.ts +15 -10
  48. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  49. package/dist/types/src/packlets/spaces/genesis.d.ts +5 -0
  50. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -0
  51. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +4 -4
  52. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  53. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -1
  54. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  55. package/dist/types/src/packlets/system/system-service.d.ts +1 -1
  56. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  57. package/dist/types/src/packlets/testing/credential-utils.d.ts +1 -1
  58. package/dist/types/src/packlets/testing/index.d.ts +0 -1
  59. package/dist/types/src/packlets/testing/index.d.ts.map +1 -1
  60. package/dist/types/src/packlets/testing/invitation-utils.d.ts +13 -7
  61. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  62. package/dist/types/src/packlets/testing/test-builder.d.ts +35 -32
  63. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  64. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +1 -1
  65. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  66. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +5 -2
  67. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
  68. package/dist/types/src/packlets/vault/vault-resource-lock.d.ts +1 -1
  69. package/dist/types/src/packlets/vault/vault-resource-lock.d.ts.map +1 -1
  70. package/dist/types/src/packlets/vault/worker-runtime.d.ts +1 -1
  71. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  72. package/dist/types/src/packlets/vault/worker-session.d.ts +4 -7
  73. package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
  74. package/package.json +30 -31
  75. package/src/index.ts +1 -0
  76. package/src/packlets/devices/devices-service.ts +5 -5
  77. package/src/packlets/devtools/devtools.ts +25 -4
  78. package/src/packlets/devtools/feeds.ts +10 -10
  79. package/src/packlets/devtools/keys.ts +6 -6
  80. package/src/packlets/devtools/network.ts +14 -13
  81. package/src/packlets/devtools/spaces.ts +4 -4
  82. package/src/packlets/identity/authenticator.test.ts +1 -1
  83. package/src/packlets/identity/authenticator.ts +2 -2
  84. package/src/packlets/identity/identity-manager.test.ts +17 -13
  85. package/src/packlets/identity/identity-manager.ts +21 -22
  86. package/src/packlets/identity/identity-service.ts +3 -3
  87. package/src/packlets/identity/identity.test.ts +65 -36
  88. package/src/packlets/identity/identity.ts +17 -17
  89. package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
  90. package/src/packlets/invitations/device-invitation-protocol.ts +7 -7
  91. package/src/packlets/invitations/invitation-extension.ts +16 -27
  92. package/src/packlets/invitations/invitations-handler.ts +17 -25
  93. package/src/packlets/invitations/invitations-service.ts +11 -11
  94. package/src/packlets/invitations/space-invitation-protocol.test.ts +9 -9
  95. package/src/packlets/invitations/space-invitation-protocol.ts +11 -12
  96. package/src/packlets/logging/logging-service.ts +8 -3
  97. package/src/packlets/network/network-service.test.ts +8 -8
  98. package/src/packlets/network/network-service.ts +20 -8
  99. package/src/packlets/services/client-rpc-server.ts +5 -5
  100. package/src/packlets/services/index.ts +0 -1
  101. package/src/packlets/services/local-client-services.ts +1 -1
  102. package/src/packlets/services/service-context.test.ts +3 -3
  103. package/src/packlets/services/service-context.ts +26 -24
  104. package/src/packlets/services/service-host.test.ts +6 -6
  105. package/src/packlets/services/service-host.ts +57 -31
  106. package/src/packlets/services/service-registry.test.ts +20 -38
  107. package/src/packlets/spaces/data-space-manager.test.ts +17 -29
  108. package/src/packlets/spaces/data-space-manager.ts +29 -35
  109. package/src/packlets/spaces/data-space.ts +73 -47
  110. package/src/packlets/spaces/genesis.ts +81 -0
  111. package/src/packlets/spaces/notarization-plugin.test.ts +2 -2
  112. package/src/packlets/spaces/notarization-plugin.ts +12 -12
  113. package/src/packlets/spaces/spaces-service.test.ts +2 -2
  114. package/src/packlets/spaces/spaces-service.ts +21 -10
  115. package/src/packlets/storage/storage.ts +3 -3
  116. package/src/packlets/system/system-service.test.ts +1 -1
  117. package/src/packlets/system/system-service.ts +1 -1
  118. package/src/packlets/testing/credential-utils.ts +4 -4
  119. package/src/packlets/testing/index.ts +0 -1
  120. package/src/packlets/testing/invitation-utils.ts +28 -33
  121. package/src/packlets/testing/test-builder.ts +132 -168
  122. package/src/packlets/vault/iframe-host-runtime.ts +8 -11
  123. package/src/packlets/vault/iframe-proxy-runtime.ts +25 -9
  124. package/src/packlets/vault/shell-runtime.ts +4 -4
  125. package/src/packlets/vault/vault-resource-lock.ts +2 -2
  126. package/src/packlets/vault/worker-runtime.ts +7 -9
  127. package/src/packlets/vault/worker-session.ts +24 -45
  128. package/dist/lib/browser/chunk-T73F4MV4.mjs.map +0 -7
  129. package/dist/types/src/packlets/services/utils.d.ts +0 -7
  130. package/dist/types/src/packlets/services/utils.d.ts.map +0 -1
  131. package/dist/types/src/packlets/testing/host-test-builder.d.ts +0 -43
  132. package/dist/types/src/packlets/testing/host-test-builder.d.ts.map +0 -1
  133. package/dist/types/src/packlets/tests/client-services.test.d.ts +0 -2
  134. package/dist/types/src/packlets/tests/client-services.test.d.ts.map +0 -1
  135. package/dist/types/src/packlets/tests/client.test.d.ts +0 -2
  136. package/dist/types/src/packlets/tests/client.test.d.ts.map +0 -1
  137. package/dist/types/src/packlets/tests/halo-credentials.test.d.ts +0 -2
  138. package/dist/types/src/packlets/tests/halo-credentials.test.d.ts.map +0 -1
  139. package/dist/types/src/packlets/tests/halo-persistent.test.d.ts +0 -2
  140. package/dist/types/src/packlets/tests/halo-persistent.test.d.ts.map +0 -1
  141. package/dist/types/src/packlets/tests/halo-profile.test.d.ts +0 -2
  142. package/dist/types/src/packlets/tests/halo-profile.test.d.ts.map +0 -1
  143. package/dist/types/src/packlets/tests/invitations.test.d.ts +0 -2
  144. package/dist/types/src/packlets/tests/invitations.test.d.ts.map +0 -1
  145. package/dist/types/src/packlets/tests/shared-worker.test.d.ts +0 -2
  146. package/dist/types/src/packlets/tests/shared-worker.test.d.ts.map +0 -1
  147. package/dist/types/src/packlets/tests/spaces-invitations.test.d.ts +0 -2
  148. package/dist/types/src/packlets/tests/spaces-invitations.test.d.ts.map +0 -1
  149. package/dist/types/src/packlets/tests/spaces.test.d.ts +0 -2
  150. package/dist/types/src/packlets/tests/spaces.test.d.ts.map +0 -1
  151. package/dist/types/src/packlets/tests/text.test.d.ts +0 -2
  152. package/dist/types/src/packlets/tests/text.test.d.ts.map +0 -1
  153. package/src/packlets/services/utils.ts +0 -53
  154. package/src/packlets/testing/host-test-builder.ts +0 -163
  155. package/src/packlets/tests/client-services.test.ts +0 -222
  156. package/src/packlets/tests/client.test.ts +0 -140
  157. package/src/packlets/tests/halo-credentials.test.ts +0 -94
  158. package/src/packlets/tests/halo-persistent.test.ts +0 -53
  159. package/src/packlets/tests/halo-profile.test.ts +0 -48
  160. package/src/packlets/tests/invitations.test.ts +0 -389
  161. package/src/packlets/tests/shared-worker.test.ts +0 -92
  162. package/src/packlets/tests/spaces-invitations.test.ts +0 -46
  163. package/src/packlets/tests/spaces.test.ts +0 -147
  164. package/src/packlets/tests/text.test.ts +0 -206
@@ -4,8 +4,18 @@
4
4
 
5
5
  import expect from 'expect';
6
6
 
7
+ import { createDefaultModelFactory } from '@dxos/client-protocol';
7
8
  import { CredentialGenerator, verifyCredential } from '@dxos/credentials';
8
- import { MOCK_AUTH_PROVIDER, MOCK_AUTH_VERIFIER, Space, SpaceProtocol, valueEncoding } from '@dxos/echo-pipeline';
9
+ import {
10
+ MetadataStore,
11
+ MOCK_AUTH_PROVIDER,
12
+ MOCK_AUTH_VERIFIER,
13
+ SnapshotManager,
14
+ SnapshotStore,
15
+ Space,
16
+ SpaceProtocol,
17
+ valueEncoding,
18
+ } from '@dxos/echo-pipeline';
9
19
  import { FeedFactory, FeedStore } from '@dxos/feed-store';
10
20
  import { Keyring } from '@dxos/keyring';
11
21
  import { PublicKey } from '@dxos/keys';
@@ -30,9 +40,9 @@ describe('identity/identity', () => {
30
40
  root: createStorage({ type: StorageType.RAM }).createDirectory(),
31
41
  signer: keyring,
32
42
  hypercore: {
33
- valueEncoding
34
- }
35
- })
43
+ valueEncoding,
44
+ },
45
+ }),
36
46
  });
37
47
 
38
48
  const createFeed = async () => {
@@ -48,19 +58,26 @@ describe('identity/identity', () => {
48
58
  swarmIdentity: {
49
59
  peerKey: deviceKey,
50
60
  credentialProvider: MOCK_AUTH_PROVIDER,
51
- credentialAuthenticator: MOCK_AUTH_VERIFIER
61
+ credentialAuthenticator: MOCK_AUTH_VERIFIER,
52
62
  },
53
63
  networkManager: new NetworkManager({
54
64
  signalManager: new MemorySignalManager(new MemorySignalManagerContext()),
55
- transportFactory: MemoryTransportFactory
56
- })
65
+ transportFactory: MemoryTransportFactory,
66
+ }),
57
67
  });
58
68
 
59
69
  const space: Space = new Space({
60
70
  spaceKey,
61
71
  protocol,
62
72
  genesisFeed: controlFeed,
63
- feedProvider: (feedKey) => feedStore.openFeed(feedKey)
73
+ feedProvider: (feedKey) => feedStore.openFeed(feedKey),
74
+ memberKey: identityKey,
75
+ modelFactory: createDefaultModelFactory(),
76
+ metadataStore: new MetadataStore(createStorage({ type: StorageType.RAM }).createDirectory()),
77
+ snapshotManager: new SnapshotManager(
78
+ new SnapshotStore(createStorage({ type: StorageType.RAM }).createDirectory()),
79
+ ),
80
+ snapshotId: undefined,
64
81
  })
65
82
  .setControlFeed(controlFeed)
66
83
  .setDataFeed(dataFeed);
@@ -69,7 +86,7 @@ describe('identity/identity', () => {
69
86
  signer: keyring,
70
87
  identityKey,
71
88
  deviceKey,
72
- space
89
+ space,
73
90
  });
74
91
 
75
92
  await identity.open();
@@ -83,12 +100,12 @@ describe('identity/identity', () => {
83
100
  const credentials = [
84
101
  ...(await generator.createSpaceGenesis(spaceKey, controlFeed.key)),
85
102
  await generator.createDeviceAuthorization(deviceKey),
86
- await generator.createFeedAdmission(spaceKey, dataFeed.key, AdmittedFeed.Designation.DATA)
103
+ await generator.createFeedAdmission(spaceKey, dataFeed.key, AdmittedFeed.Designation.DATA),
87
104
  ];
88
105
 
89
106
  for (const credential of credentials) {
90
107
  await identity.controlPipeline.writer.write({
91
- credential: { credential }
108
+ credential: { credential },
92
109
  });
93
110
  }
94
111
  }
@@ -101,9 +118,9 @@ describe('identity/identity', () => {
101
118
  assertion: {
102
119
  '@type': 'dxos.halo.credentials.IdentityProfile',
103
120
  profile: {
104
- displayName: 'Alice'
105
- }
106
- }
121
+ displayName: 'Alice',
122
+ },
123
+ },
107
124
  });
108
125
 
109
126
  expect(credential.issuer).toEqual(identityKey);
@@ -133,9 +150,9 @@ describe('identity/identity', () => {
133
150
  root: createStorage({ type: StorageType.RAM }).createDirectory(),
134
151
  signer: keyring,
135
152
  hypercore: {
136
- valueEncoding
137
- }
138
- })
153
+ valueEncoding,
154
+ },
155
+ }),
139
156
  });
140
157
 
141
158
  const createFeed = async () => {
@@ -153,19 +170,25 @@ describe('identity/identity', () => {
153
170
  swarmIdentity: {
154
171
  peerKey: deviceKey,
155
172
  credentialProvider: MOCK_AUTH_PROVIDER, // createHaloAuthProvider(createCredentialSignerWithKey(keyring, device_key)),
156
- credentialAuthenticator: MOCK_AUTH_VERIFIER // createHaloAuthVerifier(() => identity.authorizedDeviceKeys),
173
+ credentialAuthenticator: MOCK_AUTH_VERIFIER, // createHaloAuthVerifier(() => identity.authorizedDeviceKeys),
157
174
  },
158
175
  networkManager: new NetworkManager({
159
176
  signalManager: new MemorySignalManager(signalContext),
160
- transportFactory: MemoryTransportFactory
161
- })
177
+ transportFactory: MemoryTransportFactory,
178
+ }),
162
179
  });
163
180
 
164
181
  const space = new Space({
165
182
  spaceKey,
166
183
  protocol,
167
184
  genesisFeed: controlFeed,
168
- feedProvider: (feedKey) => feedStore.openFeed(feedKey)
185
+ feedProvider: (feedKey) => feedStore.openFeed(feedKey),
186
+ memberKey: identityKey,
187
+ modelFactory: createDefaultModelFactory(),
188
+ metadataStore: new MetadataStore(createStorage({ type: StorageType.RAM }).createDirectory()),
189
+ snapshotManager: new SnapshotManager(
190
+ new SnapshotStore(createStorage({ type: StorageType.RAM }).createDirectory()),
191
+ ),
169
192
  })
170
193
  .setControlFeed(controlFeed)
171
194
  .setDataFeed(dataFeed);
@@ -174,7 +197,7 @@ describe('identity/identity', () => {
174
197
  signer: keyring,
175
198
  identityKey,
176
199
  deviceKey,
177
- space
200
+ space,
178
201
  }));
179
202
 
180
203
  await identity.open();
@@ -188,12 +211,12 @@ describe('identity/identity', () => {
188
211
  const credentials = [
189
212
  ...(await generator.createSpaceGenesis(spaceKey, controlFeed.key)),
190
213
  await generator.createDeviceAuthorization(deviceKey),
191
- await generator.createFeedAdmission(spaceKey, dataFeed.key, AdmittedFeed.Designation.DATA)
214
+ await generator.createFeedAdmission(spaceKey, dataFeed.key, AdmittedFeed.Designation.DATA),
192
215
  ];
193
216
 
194
217
  for (const credential of credentials) {
195
218
  await identity.controlPipeline.writer.write({
196
- credential: { credential }
219
+ credential: { credential },
197
220
  });
198
221
  }
199
222
  }
@@ -214,9 +237,9 @@ describe('identity/identity', () => {
214
237
  root: createStorage({ type: StorageType.RAM }).createDirectory(),
215
238
  signer: keyring,
216
239
  hypercore: {
217
- valueEncoding
218
- }
219
- })
240
+ valueEncoding,
241
+ },
242
+ }),
220
243
  });
221
244
 
222
245
  const createFeed = async () => {
@@ -232,19 +255,25 @@ describe('identity/identity', () => {
232
255
  swarmIdentity: {
233
256
  peerKey: deviceKey,
234
257
  credentialProvider: MOCK_AUTH_PROVIDER, // createHaloAuthProvider(createCredentialSignerWithKey(keyring, device_key)),
235
- credentialAuthenticator: MOCK_AUTH_VERIFIER // createHaloAuthVerifier(() => identity.authorizedDeviceKeys),
258
+ credentialAuthenticator: MOCK_AUTH_VERIFIER, // createHaloAuthVerifier(() => identity.authorizedDeviceKeys),
236
259
  },
237
260
  networkManager: new NetworkManager({
238
261
  signalManager: new MemorySignalManager(signalContext),
239
- transportFactory: MemoryTransportFactory
240
- })
262
+ transportFactory: MemoryTransportFactory,
263
+ }),
241
264
  });
242
265
 
243
266
  const space = new Space({
244
267
  spaceKey,
245
268
  protocol,
246
269
  genesisFeed: await feedStore.openFeed(genesisFeedKey),
247
- feedProvider: (feedKey) => feedStore.openFeed(feedKey)
270
+ feedProvider: (feedKey) => feedStore.openFeed(feedKey),
271
+ memberKey: identityKey,
272
+ modelFactory: createDefaultModelFactory(),
273
+ metadataStore: new MetadataStore(createStorage({ type: StorageType.RAM }).createDirectory()),
274
+ snapshotManager: new SnapshotManager(
275
+ new SnapshotStore(createStorage({ type: StorageType.RAM }).createDirectory()),
276
+ ),
248
277
  })
249
278
  .setControlFeed(controlFeed)
250
279
  .setDataFeed(dataFeed);
@@ -253,7 +282,7 @@ describe('identity/identity', () => {
253
282
  signer: keyring,
254
283
  identityKey: identity1.identityKey,
255
284
  deviceKey,
256
- space
285
+ space,
257
286
  }));
258
287
 
259
288
  await identity.open();
@@ -272,10 +301,10 @@ describe('identity/identity', () => {
272
301
  assertion: {
273
302
  '@type': 'dxos.halo.credentials.AuthorizedDevice',
274
303
  identityKey: identity1.identityKey,
275
- deviceKey: identity2.deviceKey
276
- }
277
- })
278
- }
304
+ deviceKey: identity2.deviceKey,
305
+ },
306
+ }),
307
+ },
279
308
  });
280
309
 
281
310
  await identity2.ready();
@@ -11,7 +11,7 @@ import {
11
11
  createCredentialSignerWithKey,
12
12
  createCredentialSignerWithChain,
13
13
  ProfileStateMachine,
14
- CredentialConsumer
14
+ CredentialConsumer,
15
15
  } from '@dxos/credentials';
16
16
  import { Signer } from '@dxos/crypto';
17
17
  import { failUndefined } from '@dxos/debug';
@@ -64,20 +64,20 @@ export class Identity {
64
64
  new DeviceStateMachine({
65
65
  identityKey: this.identityKey,
66
66
  deviceKey: this.deviceKey,
67
- onUpdate: () => this.stateUpdate.emit()
68
- })
67
+ onUpdate: () => this.stateUpdate.emit(),
68
+ }),
69
69
  );
70
70
  this._profileStateMachine = this.space.spaceState.registerProcessor(
71
71
  new ProfileStateMachine({
72
72
  identityKey: this.identityKey,
73
- onUpdate: () => this.stateUpdate.emit()
74
- })
73
+ onUpdate: () => this.stateUpdate.emit(),
74
+ }),
75
75
  );
76
76
 
77
77
  this.authVerifier = new TrustedKeySetAuthVerifier({
78
78
  trustedKeysProvider: () => this.authorizedDeviceKeys,
79
79
  update: this.stateUpdate,
80
- authTimeout: AUTH_TIMEOUT
80
+ authTimeout: AUTH_TIMEOUT,
81
81
  });
82
82
  }
83
83
 
@@ -132,7 +132,7 @@ export class Identity {
132
132
  return {
133
133
  deviceKey: this.deviceKey,
134
134
  controlFeedKey: this.space.controlFeedKey ?? failUndefined(),
135
- dataFeedKey: this.space.dataFeedKey ?? failUndefined()
135
+ dataFeedKey: this.space.dataFeedKey ?? failUndefined(),
136
136
  };
137
137
  }
138
138
 
@@ -145,7 +145,7 @@ export class Identity {
145
145
  return createCredentialSignerWithChain(
146
146
  this._signer,
147
147
  this._deviceStateMachine.processor.deviceCredentialChain,
148
- this.deviceKey
148
+ this.deviceKey,
149
149
  );
150
150
  }
151
151
 
@@ -162,7 +162,7 @@ export class Identity {
162
162
  hostDevice: this.deviceKey,
163
163
  deviceKey,
164
164
  controlFeedKey,
165
- dataFeedKey
165
+ dataFeedKey,
166
166
  });
167
167
  const signer = this.getIdentityCredentialSigner();
168
168
  await writeMessages(
@@ -173,8 +173,8 @@ export class Identity {
173
173
  assertion: {
174
174
  '@type': 'dxos.halo.credentials.AuthorizedDevice',
175
175
  identityKey: this.identityKey,
176
- deviceKey
177
- }
176
+ deviceKey,
177
+ },
178
178
  }),
179
179
  await signer.createCredential({
180
180
  subject: controlFeedKey,
@@ -183,8 +183,8 @@ export class Identity {
183
183
  spaceKey: this.haloSpaceKey,
184
184
  deviceKey,
185
185
  identityKey: this.identityKey,
186
- designation: AdmittedFeed.Designation.CONTROL
187
- }
186
+ designation: AdmittedFeed.Designation.CONTROL,
187
+ },
188
188
  }),
189
189
  await signer.createCredential({
190
190
  subject: dataFeedKey,
@@ -193,10 +193,10 @@ export class Identity {
193
193
  spaceKey: this.haloSpaceKey,
194
194
  deviceKey,
195
195
  identityKey: this.identityKey,
196
- designation: AdmittedFeed.Designation.DATA
197
- }
198
- })
199
- ].map((credential): FeedMessage.Payload => ({ credential: { credential } }))
196
+ designation: AdmittedFeed.Designation.DATA,
197
+ },
198
+ }),
199
+ ].map((credential): FeedMessage.Payload => ({ credential: { credential } })),
200
200
  );
201
201
  }
202
202
  }
@@ -5,7 +5,7 @@
5
5
  import { expect } from 'chai';
6
6
 
7
7
  import { asyncChain } from '@dxos/async';
8
- import { Invitation } from '@dxos/client';
8
+ import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
9
9
  import { describe, test, afterTest } from '@dxos/test';
10
10
 
11
11
  import { ServiceContext } from '../services';
@@ -15,7 +15,7 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
15
15
  constructor(
16
16
  private readonly _keyring: Keyring,
17
17
  private readonly _getIdentity: () => Identity,
18
- private readonly _acceptIdentity: (identity: JoinIdentityParams) => Promise<Identity>
18
+ private readonly _acceptIdentity: (identity: JoinIdentityParams) => Promise<Identity>,
19
19
  ) {}
20
20
 
21
21
  toJSON(): object {
@@ -24,7 +24,7 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
24
24
 
25
25
  getInvitationContext(): Partial<Invitation> & Pick<Invitation, 'kind'> {
26
26
  return {
27
- kind: Invitation.Kind.DEVICE
27
+ kind: Invitation.Kind.DEVICE,
28
28
  };
29
29
  }
30
30
 
@@ -38,8 +38,8 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
38
38
  identityKey: identity.identityKey,
39
39
  haloSpaceKey: identity.haloSpaceKey,
40
40
  genesisFeedKey: identity.haloGenesisFeedKey,
41
- controlTimeframe: identity.controlPipeline.state.timeframe
42
- }
41
+ controlTimeframe: identity.controlPipeline.state.timeframe,
42
+ },
43
43
  };
44
44
  }
45
45
 
@@ -56,8 +56,8 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
56
56
  device: {
57
57
  deviceKey,
58
58
  controlFeedKey,
59
- dataFeedKey
60
- }
59
+ dataFeedKey,
60
+ },
61
61
  };
62
62
  }
63
63
 
@@ -75,7 +75,7 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
75
75
  haloGenesisFeedKey: genesisFeedKey,
76
76
  controlFeedKey,
77
77
  dataFeedKey,
78
- controlTimeframe
78
+ controlTimeframe,
79
79
  });
80
80
 
81
81
  return { identityKey };
@@ -18,7 +18,7 @@ import {
18
18
  IntroductionRequest,
19
19
  IntroductionResponse,
20
20
  InvitationHostService,
21
- Options
21
+ Options,
22
22
  } from '@dxos/protocols/proto/dxos/halo/invitations';
23
23
  import { ExtensionContext, RpcExtension } from '@dxos/teleport';
24
24
 
@@ -45,8 +45,6 @@ export class InvitationHostExtension extends RpcExtension<
45
45
  /**
46
46
  * @internal
47
47
  */
48
- public _traceParent?: string;
49
-
50
48
  private _ctx = new Context();
51
49
  private _remoteOptions?: Options;
52
50
  private _remoteOptionsTrigger = new Trigger();
@@ -54,11 +52,11 @@ export class InvitationHostExtension extends RpcExtension<
54
52
  constructor(private readonly _callbacks: InvitationHostExtensionCallbacks) {
55
53
  super({
56
54
  requested: {
57
- InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService')
55
+ InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService'),
58
56
  },
59
57
  exposed: {
60
- InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService')
61
- }
58
+ InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService'),
59
+ },
62
60
  });
63
61
  }
64
62
 
@@ -75,10 +73,7 @@ export class InvitationHostExtension extends RpcExtension<
75
73
 
76
74
  introduce: async (request) => {
77
75
  const traceId = PublicKey.random().toHex();
78
- log.trace(
79
- 'dxos.sdk.invitation-handler.host.introduce',
80
- trace.begin({ id: traceId, parentId: this._traceParent })
81
- );
76
+ log.trace('dxos.sdk.invitation-handler.host.introduce', trace.begin({ id: traceId }));
82
77
  const response = await this._callbacks.introduce(request);
83
78
  log.trace('dxos.sdk.invitation-handler.host.introduce', trace.end({ id: traceId }));
84
79
  return response;
@@ -86,10 +81,7 @@ export class InvitationHostExtension extends RpcExtension<
86
81
 
87
82
  authenticate: async (request) => {
88
83
  const traceId = PublicKey.random().toHex();
89
- log.trace(
90
- 'dxos.sdk.invitation-handler.host.authenticate',
91
- trace.begin({ id: traceId, parentId: this._traceParent })
92
- );
84
+ log.trace('dxos.sdk.invitation-handler.host.authenticate', trace.begin({ id: traceId }));
93
85
  const response = await this._callbacks.authenticate(request);
94
86
  log.trace('dxos.sdk.invitation-handler.host.authenticate', trace.end({ id: traceId, data: { ...response } }));
95
87
  return response;
@@ -97,15 +89,12 @@ export class InvitationHostExtension extends RpcExtension<
97
89
 
98
90
  admit: async (request) => {
99
91
  const traceId = PublicKey.random().toHex();
100
- log.trace(
101
- 'dxos.sdk.invitation-handler.host.admit',
102
- trace.begin({ id: traceId, parentId: this._traceParent })
103
- );
92
+ log.trace('dxos.sdk.invitation-handler.host.admit', trace.begin({ id: traceId }));
104
93
  const response = await this._callbacks.admit(request);
105
94
  log.trace('dxos.sdk.invitation-handler.host.admit', trace.end({ id: traceId }));
106
95
  return response;
107
- }
108
- }
96
+ },
97
+ },
109
98
  };
110
99
  }
111
100
 
@@ -118,7 +107,7 @@ export class InvitationHostExtension extends RpcExtension<
118
107
  if (this._remoteOptions?.role !== Options.Role.GUEST) {
119
108
  throw new InvalidInvitationExtensionRoleError(undefined, {
120
109
  expected: Options.Role.GUEST,
121
- remoteOptions: this._remoteOptions
110
+ remoteOptions: this._remoteOptions,
122
111
  });
123
112
  }
124
113
 
@@ -153,11 +142,11 @@ export class InvitationGuestExtension extends RpcExtension<
153
142
  constructor(private readonly _callbacks: InvitationGuestExtensionCallbacks) {
154
143
  super({
155
144
  requested: {
156
- InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService')
145
+ InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService'),
157
146
  },
158
147
  exposed: {
159
- InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService')
160
- }
148
+ InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService'),
149
+ },
161
150
  });
162
151
  }
163
152
 
@@ -177,8 +166,8 @@ export class InvitationGuestExtension extends RpcExtension<
177
166
  },
178
167
  admit: () => {
179
168
  throw new Error('Method not allowed.');
180
- }
181
- }
169
+ },
170
+ },
182
171
  };
183
172
  }
184
173
 
@@ -193,7 +182,7 @@ export class InvitationGuestExtension extends RpcExtension<
193
182
  if (this._remoteOptions?.role !== Options.Role.HOST) {
194
183
  throw new InvalidInvitationExtensionRoleError(undefined, {
195
184
  expected: Options.Role.HOST,
196
- remoteOptions: this._remoteOptions
185
+ remoteOptions: this._remoteOptions,
197
186
  });
198
187
  }
199
188
 
@@ -10,8 +10,8 @@ import {
10
10
  AUTHENTICATION_CODE_LENGTH,
11
11
  CancellableInvitationObservable,
12
12
  INVITATION_TIMEOUT,
13
- ON_CLOSE_DELAY
14
- } from '@dxos/client';
13
+ ON_CLOSE_DELAY,
14
+ } from '@dxos/client-protocol';
15
15
  import { Context } from '@dxos/context';
16
16
  import { generatePasscode } from '@dxos/credentials';
17
17
  import { InvalidInvitationExtensionRoleError } from '@dxos/errors';
@@ -59,7 +59,6 @@ export class InvitationsHandler {
59
59
  /**
60
60
  * @internal
61
61
  */
62
- public _traceParent?: string;
63
62
  constructor(private readonly _networkManager: NetworkManager) {}
64
63
 
65
64
  createInvitation(protocol: InvitationProtocol, options?: Partial<Invitation>): CancellableInvitationObservable {
@@ -69,7 +68,7 @@ export class InvitationsHandler {
69
68
  authMethod = Invitation.AuthMethod.SHARED_SECRET,
70
69
  state = Invitation.State.INIT,
71
70
  timeout = INVITATION_TIMEOUT,
72
- swarmKey = PublicKey.random()
71
+ swarmKey = PublicKey.random(),
73
72
  } = options ?? {};
74
73
  const authCode =
75
74
  options?.authCode ??
@@ -84,7 +83,7 @@ export class InvitationsHandler {
84
83
  swarmKey,
85
84
  authCode,
86
85
  timeout,
87
- ...protocol.getInvitationContext()
86
+ ...protocol.getInvitationContext(),
88
87
  };
89
88
 
90
89
  const stream = new PushStream<Invitation>();
@@ -92,7 +91,7 @@ export class InvitationsHandler {
92
91
  onError: (err) => {
93
92
  void ctx.dispose();
94
93
  stream.error(err);
95
- }
94
+ },
96
95
  });
97
96
 
98
97
  ctx.onDispose(() => {
@@ -111,7 +110,7 @@ export class InvitationsHandler {
111
110
  introduce: async ({ profile }) => {
112
111
  log('guest introduced itself', {
113
112
  guestProfile: profile,
114
- ...protocol.toJSON()
113
+ ...protocol.toJSON(),
115
114
  });
116
115
 
117
116
  guestProfile = profile;
@@ -123,7 +122,7 @@ export class InvitationsHandler {
123
122
  // Spaces may want to have public details (name, member count, etc.) or hide that until guest is authed.
124
123
  return {
125
124
  spaceKey: authMethod === Invitation.AuthMethod.NONE ? protocol.getInvitationContext().spaceKey : undefined,
126
- authMethod
125
+ authMethod,
127
126
  };
128
127
  },
129
128
 
@@ -186,10 +185,7 @@ export class InvitationsHandler {
186
185
  scheduleTask(ctx, async () => {
187
186
  const traceId = PublicKey.random().toHex();
188
187
  try {
189
- log.trace(
190
- 'dxos.sdk.invitations-handler.host.onOpen',
191
- trace.begin({ id: traceId, parentId: this._traceParent })
192
- );
188
+ log.trace('dxos.sdk.invitations-handler.host.onOpen', trace.begin({ id: traceId }));
193
189
  log('connected', { ...protocol.toJSON() });
194
190
  stream.next({ ...invitation, state: Invitation.State.CONNECTED });
195
191
  const deviceKey = await success.wait({ timeout });
@@ -224,9 +220,8 @@ export class InvitationsHandler {
224
220
  log.error('failed', err);
225
221
  stream.error(err);
226
222
  }
227
- }
223
+ },
228
224
  });
229
- extension._traceParent = this._traceParent;
230
225
 
231
226
  return extension;
232
227
  };
@@ -239,7 +234,7 @@ export class InvitationsHandler {
239
234
  protocolProvider: createTeleportProtocolFactory(async (teleport) => {
240
235
  teleport.addExtension('dxos.halo.invitations', createExtension());
241
236
  }),
242
- topology: new StarTopology(topic)
237
+ topology: new StarTopology(topic),
243
238
  });
244
239
  ctx.onDispose(() => swarmConnection.close());
245
240
 
@@ -253,7 +248,7 @@ export class InvitationsHandler {
253
248
  onCancel: async () => {
254
249
  stream.next({ ...invitation, state: Invitation.State.CANCELLED });
255
250
  await ctx.dispose();
256
- }
251
+ },
257
252
  });
258
253
 
259
254
  return observable;
@@ -283,7 +278,7 @@ export class InvitationsHandler {
283
278
  stream.error(err);
284
279
  }
285
280
  void ctx.dispose();
286
- }
281
+ },
287
282
  });
288
283
 
289
284
  ctx.onDispose(() => {
@@ -306,10 +301,7 @@ export class InvitationsHandler {
306
301
  scheduleTask(ctx, async () => {
307
302
  const traceId = PublicKey.random().toHex();
308
303
  try {
309
- log.trace(
310
- 'dxos.sdk.invitations-handler.guest.onOpen',
311
- trace.begin({ id: traceId, parentId: this._traceParent })
312
- );
304
+ log.trace('dxos.sdk.invitations-handler.guest.onOpen', trace.begin({ id: traceId }));
313
305
  // TODO(burdon): Bug where guest may create multiple connections.
314
306
  if (++connectionCount > 1) {
315
307
  throw new Error(`multiple connections detected: ${connectionCount}`);
@@ -323,7 +315,7 @@ export class InvitationsHandler {
323
315
  // 1. Introduce guest to host.
324
316
  log('introduce', { ...protocol.toJSON() });
325
317
  const introductionResponse = await extension.rpc.InvitationHostService.introduce(
326
- protocol.createIntroduction()
318
+ protocol.createIntroduction(),
327
319
  );
328
320
  log('introduce response', { ...protocol.toJSON(), response: introductionResponse });
329
321
  invitation.authMethod = introductionResponse.authMethod;
@@ -396,7 +388,7 @@ export class InvitationsHandler {
396
388
  log('auth failed', err);
397
389
  stream.error(err);
398
390
  }
399
- }
391
+ },
400
392
  });
401
393
 
402
394
  return extension;
@@ -411,7 +403,7 @@ export class InvitationsHandler {
411
403
  protocolProvider: createTeleportProtocolFactory(async (teleport) => {
412
404
  teleport.addExtension('dxos.halo.invitations', createExtension());
413
405
  }),
414
- topology: new StarTopology(topic)
406
+ topology: new StarTopology(topic),
415
407
  });
416
408
  ctx.onDispose(() => swarmConnection.close());
417
409
 
@@ -428,7 +420,7 @@ export class InvitationsHandler {
428
420
  onAuthenticate: async (code: string) => {
429
421
  // TODO(burdon): Reset creates a race condition? Event?
430
422
  authenticated.wake(code);
431
- }
423
+ },
432
424
  });
433
425
 
434
426
  return observable;