@dxos/client-services 0.8.4-main.84f28bd → 0.8.4-main.8baae0fced

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 (255) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/{chunk-OCFDRCSN.mjs → chunk-KBMYCFTL.mjs} +3177 -4457
  4. package/dist/lib/browser/chunk-KBMYCFTL.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
  6. package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-XJRPB3GA.mjs +22 -0
  8. package/dist/lib/browser/chunk-XJRPB3GA.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +451 -145
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +88 -0
  13. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  14. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  15. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  16. package/dist/lib/browser/packlets/locks/browser.mjs +86 -0
  17. package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
  18. package/dist/lib/browser/packlets/locks/node.mjs +48 -0
  19. package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
  20. package/dist/lib/browser/testing/index.mjs +35 -36
  21. package/dist/lib/browser/testing/index.mjs.map +3 -3
  22. package/dist/lib/node-esm/chunk-2DT3MZRL.mjs +22 -0
  23. package/dist/lib/node-esm/chunk-2DT3MZRL.mjs.map +7 -0
  24. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
  25. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-D7F3FYZS.mjs → chunk-TCS4PMDH.mjs} +3056 -4204
  27. package/dist/lib/node-esm/chunk-TCS4PMDH.mjs.map +7 -0
  28. package/dist/lib/node-esm/index.mjs +451 -145
  29. package/dist/lib/node-esm/index.mjs.map +4 -4
  30. package/dist/lib/node-esm/meta.json +1 -1
  31. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +88 -0
  32. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  33. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  34. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  35. package/dist/lib/node-esm/packlets/locks/browser.mjs +86 -0
  36. package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
  37. package/dist/lib/node-esm/packlets/locks/node.mjs +48 -0
  38. package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
  39. package/dist/lib/node-esm/testing/index.mjs +35 -36
  40. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  41. package/dist/types/src/index.d.ts +1 -0
  42. package/dist/types/src/index.d.ts.map +1 -1
  43. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +3 -2
  44. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
  45. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +3 -2
  46. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  47. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  48. package/dist/types/src/packlets/devtools/devtools.d.ts +20 -20
  49. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  50. package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
  51. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  52. package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
  53. package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
  54. package/dist/types/src/packlets/devtools/network.d.ts +1 -1
  55. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  56. package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
  57. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts +1 -1
  58. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
  59. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts +1 -1
  60. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
  61. package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
  62. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts +3 -4
  63. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
  64. package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
  65. package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
  66. package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
  67. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  68. package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
  69. package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
  70. package/dist/types/src/packlets/identity/identity-manager.d.ts +7 -7
  71. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  72. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +8 -7
  73. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
  74. package/dist/types/src/packlets/identity/identity-service.d.ts +6 -10
  75. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  76. package/dist/types/src/packlets/identity/identity.d.ts +9 -12
  77. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  78. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +6 -5
  79. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  80. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +2 -2
  81. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
  82. package/dist/types/src/packlets/invitations/index.d.ts +1 -1
  83. package/dist/types/src/packlets/invitations/index.d.ts.map +1 -1
  84. package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
  85. package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
  86. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +8 -5
  87. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
  88. package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
  89. package/dist/types/src/packlets/invitations/invitation-topology.d.ts.map +1 -1
  90. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
  91. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  92. package/dist/types/src/packlets/invitations/invitations-manager.d.ts +3 -3
  93. package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
  94. package/dist/types/src/packlets/invitations/invitations-service.d.ts +4 -4
  95. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  96. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +5 -4
  97. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  98. package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
  99. package/dist/types/src/packlets/locks/browser.d.ts.map +1 -1
  100. package/dist/types/src/packlets/locks/index.d.ts +2 -2
  101. package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
  102. package/dist/types/src/packlets/locks/node.d.ts.map +1 -1
  103. package/dist/types/src/packlets/logging/logging-service.d.ts +5 -1
  104. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  105. package/dist/types/src/packlets/network/network-service.d.ts +7 -6
  106. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  107. package/dist/types/src/packlets/services/client-rpc-server.d.ts +5 -5
  108. package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
  109. package/dist/types/src/packlets/services/feed-syncer.d.ts +59 -0
  110. package/dist/types/src/packlets/services/feed-syncer.d.ts.map +1 -0
  111. package/dist/types/src/packlets/services/feed-syncer.test.d.ts +2 -0
  112. package/dist/types/src/packlets/services/feed-syncer.test.d.ts.map +1 -0
  113. package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
  114. package/dist/types/src/packlets/services/service-context.d.ts +14 -10
  115. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  116. package/dist/types/src/packlets/services/service-host.d.ts +21 -8
  117. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  118. package/dist/types/src/packlets/services/service-registry.d.ts.map +1 -1
  119. package/dist/types/src/packlets/services/util.d.ts.map +1 -1
  120. package/dist/types/src/packlets/space-export/archive-format.d.ts +9 -0
  121. package/dist/types/src/packlets/space-export/archive-format.d.ts.map +1 -0
  122. package/dist/types/src/packlets/space-export/index.d.ts +4 -1
  123. package/dist/types/src/packlets/space-export/index.d.ts.map +1 -1
  124. package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts +23 -0
  125. package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts.map +1 -0
  126. package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts +36 -0
  127. package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts.map +1 -0
  128. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +9 -1
  129. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
  130. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts +8 -2
  131. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
  132. package/dist/types/src/packlets/space-export/space-archive.test.d.ts +2 -0
  133. package/dist/types/src/packlets/space-export/space-archive.test.d.ts.map +1 -0
  134. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +1 -1
  135. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
  136. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +31 -20
  137. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  138. package/dist/types/src/packlets/spaces/data-space.d.ts +30 -13
  139. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  140. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
  141. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  142. package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
  143. package/dist/types/src/packlets/spaces/genesis.d.ts +2 -1
  144. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
  145. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -9
  146. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  147. package/dist/types/src/packlets/spaces/spaces-service.d.ts +11 -8
  148. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  149. package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
  150. package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
  151. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  152. package/dist/types/src/packlets/storage/util.d.ts.map +1 -1
  153. package/dist/types/src/packlets/system/system-service.d.ts +2 -2
  154. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  155. package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
  156. package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
  157. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  158. package/dist/types/src/packlets/testing/test-builder.d.ts +8 -7
  159. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  160. package/dist/types/src/packlets/worker/worker-runtime.d.ts +41 -4
  161. package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
  162. package/dist/types/src/packlets/worker/worker-session.d.ts +2 -4
  163. package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
  164. package/dist/types/src/testing/setup.d.ts.map +1 -1
  165. package/dist/types/src/version.d.ts +1 -1
  166. package/dist/types/src/version.d.ts.map +1 -1
  167. package/dist/types/tsconfig.tsbuildinfo +1 -1
  168. package/package.json +73 -56
  169. package/src/index.ts +1 -0
  170. package/src/packlets/agents/edge-agent-manager.ts +10 -7
  171. package/src/packlets/agents/edge-agent-service.ts +17 -5
  172. package/src/packlets/devices/devices-service.test.ts +3 -3
  173. package/src/packlets/devices/devices-service.ts +2 -2
  174. package/src/packlets/devtools/devtools.ts +29 -29
  175. package/src/packlets/devtools/feeds.ts +2 -2
  176. package/src/packlets/devtools/network.ts +1 -1
  177. package/src/packlets/diagnostics/browser-diagnostics-broadcast.ts +1 -1
  178. package/src/packlets/diagnostics/diagnostics-broadcast.ts +1 -1
  179. package/src/packlets/diagnostics/diagnostics-collector.ts +1 -1
  180. package/src/packlets/diagnostics/diagnostics.ts +2 -3
  181. package/src/packlets/diagnostics/index.ts +1 -1
  182. package/src/packlets/identity/authenticator.node.test.ts +1 -1
  183. package/src/packlets/identity/authenticator.ts +3 -3
  184. package/src/packlets/identity/contacts-service.ts +2 -2
  185. package/src/packlets/identity/identity-manager.test.ts +8 -8
  186. package/src/packlets/identity/identity-manager.ts +25 -24
  187. package/src/packlets/identity/identity-recovery-manager.ts +22 -18
  188. package/src/packlets/identity/identity-service.test.ts +8 -28
  189. package/src/packlets/identity/identity-service.ts +13 -80
  190. package/src/packlets/identity/identity.test.ts +11 -11
  191. package/src/packlets/identity/identity.ts +17 -39
  192. package/src/packlets/invitations/device-invitation-protocol.test.ts +4 -4
  193. package/src/packlets/invitations/device-invitation-protocol.ts +8 -6
  194. package/src/packlets/invitations/edge-invitation-handler.ts +10 -6
  195. package/src/packlets/invitations/index.ts +1 -1
  196. package/src/packlets/invitations/invitation-guest-extenstion.ts +7 -5
  197. package/src/packlets/invitations/invitation-host-extension.ts +15 -16
  198. package/src/packlets/invitations/invitation-protocol.ts +8 -5
  199. package/src/packlets/invitations/invitation-state.ts +1 -15
  200. package/src/packlets/invitations/invitations-handler.test.ts +301 -292
  201. package/src/packlets/invitations/invitations-handler.ts +77 -25
  202. package/src/packlets/invitations/invitations-manager.ts +43 -18
  203. package/src/packlets/invitations/invitations-service.ts +10 -10
  204. package/src/packlets/invitations/space-invitation-protocol.test.ts +26 -25
  205. package/src/packlets/invitations/space-invitation-protocol.ts +13 -17
  206. package/src/packlets/invitations/utils.ts +1 -1
  207. package/src/packlets/locks/browser.ts +1 -1
  208. package/src/packlets/locks/index.ts +2 -2
  209. package/src/packlets/logging/logging-service.ts +22 -17
  210. package/src/packlets/logging/logging.test.ts +1 -1
  211. package/src/packlets/network/network-service.test.ts +3 -3
  212. package/src/packlets/network/network-service.ts +12 -10
  213. package/src/packlets/services/client-rpc-server.ts +20 -17
  214. package/src/packlets/services/feed-syncer.test.ts +340 -0
  215. package/src/packlets/services/feed-syncer.ts +377 -0
  216. package/src/packlets/services/platform.ts +7 -1
  217. package/src/packlets/services/service-context.test.ts +4 -3
  218. package/src/packlets/services/service-context.ts +160 -67
  219. package/src/packlets/services/service-host.test.ts +10 -9
  220. package/src/packlets/services/service-host.ts +86 -47
  221. package/src/packlets/services/service-registry.test.ts +1 -1
  222. package/src/packlets/space-export/archive-format.ts +42 -0
  223. package/src/packlets/space-export/index.ts +4 -1
  224. package/src/packlets/space-export/serialized-space-reader.ts +111 -0
  225. package/src/packlets/space-export/serialized-space-writer.ts +252 -0
  226. package/src/packlets/space-export/space-archive-reader.ts +65 -4
  227. package/src/packlets/space-export/space-archive-writer.ts +44 -6
  228. package/src/packlets/space-export/space-archive.test.ts +461 -0
  229. package/src/packlets/space-export/tar.test.ts +1 -1
  230. package/src/packlets/spaces/automerge-space-state.ts +1 -1
  231. package/src/packlets/spaces/data-space-manager.test.ts +79 -13
  232. package/src/packlets/spaces/data-space-manager.ts +134 -129
  233. package/src/packlets/spaces/data-space.ts +71 -42
  234. package/src/packlets/spaces/edge-feed-replicator.test.ts +4 -4
  235. package/src/packlets/spaces/edge-feed-replicator.ts +13 -11
  236. package/src/packlets/spaces/epoch-migrations.ts +6 -5
  237. package/src/packlets/spaces/genesis.ts +6 -1
  238. package/src/packlets/spaces/notarization-plugin.test.ts +3 -3
  239. package/src/packlets/spaces/notarization-plugin.ts +13 -12
  240. package/src/packlets/spaces/spaces-service.test.ts +20 -12
  241. package/src/packlets/spaces/spaces-service.ts +140 -38
  242. package/src/packlets/storage/profile-archive.ts +1 -1
  243. package/src/packlets/storage/storage.ts +7 -8
  244. package/src/packlets/system/system-service.test.ts +1 -1
  245. package/src/packlets/system/system-service.ts +4 -4
  246. package/src/packlets/testing/invitation-utils.ts +11 -7
  247. package/src/packlets/testing/test-builder.ts +39 -13
  248. package/src/packlets/worker/worker-runtime.ts +189 -17
  249. package/src/packlets/worker/worker-session.ts +15 -21
  250. package/src/version.ts +1 -1
  251. package/dist/lib/browser/chunk-OCFDRCSN.mjs.map +0 -7
  252. package/dist/lib/node-esm/chunk-D7F3FYZS.mjs.map +0 -7
  253. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
  254. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
  255. package/src/packlets/identity/default-space-state-machine.ts +0 -44
@@ -2,16 +2,16 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { describe, expect, test, onTestFinished } from 'vitest';
5
+ import { describe, expect, onTestFinished, test } from 'vitest';
6
6
 
7
7
  import { Context } from '@dxos/context';
8
- import { valueEncoding, MetadataStore, SpaceManager, AuthStatus } from '@dxos/echo-pipeline';
8
+ import { AuthStatus, MetadataStore, SpaceManager, valueEncoding } from '@dxos/echo-pipeline';
9
9
  import { FeedFactory, FeedStore } from '@dxos/feed-store';
10
10
  import { Keyring } from '@dxos/keyring';
11
11
  import { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';
12
12
  import { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manager';
13
13
  import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
14
- import { createStorage, type Storage, StorageType } from '@dxos/random-access-storage';
14
+ import { type Storage, StorageType, createStorage } from '@dxos/random-access-storage';
15
15
  import { BlobStore } from '@dxos/teleport-extension-object-sync';
16
16
 
17
17
  import { IdentityManager } from './identity-manager';
@@ -64,7 +64,7 @@ describe('identity/identity-manager', () => {
64
64
  test('creates identity', async () => {
65
65
  const { identityManager } = await setupPeer();
66
66
  await identityManager.open(new Context());
67
- onTestFinished(() => identityManager.close());
67
+ onTestFinished(() => identityManager.close(Context.default()));
68
68
 
69
69
  const identity = await identityManager.createIdentity();
70
70
  expect(identity).to.exist;
@@ -77,7 +77,7 @@ describe('identity/identity-manager', () => {
77
77
  await peer1.metadataStore.load();
78
78
  await peer1.identityManager.open(new Context());
79
79
  const identity1 = await peer1.identityManager.createIdentity();
80
- await peer1.identityManager.close();
80
+ await peer1.identityManager.close(Context.default());
81
81
  await peer1.feedStore.close();
82
82
  await peer1.metadataStore.close();
83
83
 
@@ -95,7 +95,7 @@ describe('identity/identity-manager', () => {
95
95
  test('update profile', async () => {
96
96
  const { identityManager } = await setupPeer();
97
97
  await identityManager.open(new Context());
98
- onTestFinished(() => identityManager.close());
98
+ onTestFinished(() => identityManager.close(Context.default()));
99
99
 
100
100
  const identity = await identityManager.createIdentity();
101
101
  expect(identity.profileDocument?.displayName).to.be.undefined;
@@ -112,7 +112,7 @@ describe('identity/identity-manager', () => {
112
112
  peerKey: identity1.deviceKey.toHex(),
113
113
  identityKey: identity1.identityKey.toHex(),
114
114
  });
115
- await identity1.joinNetwork();
115
+ await identity1.joinNetwork(Context.default());
116
116
 
117
117
  const peer2 = await setupPeer({ signalContext });
118
118
 
@@ -148,7 +148,7 @@ describe('identity/identity-manager', () => {
148
148
  peerKey: identity2.deviceKey.toHex(),
149
149
  identityKey: identity2.identityKey.toHex(),
150
150
  });
151
- await identity2.joinNetwork();
151
+ await identity2.joinNetwork(Context.default());
152
152
 
153
153
  // Identity2 is not yet ready at this point. Peer1 needs to admit peer2 device key and feed keys.
154
154
  await peer2.identityManager.acceptIdentity(identity2, identityRecord);
@@ -5,7 +5,7 @@ import platform from 'platform';
5
5
 
6
6
  import { Event } from '@dxos/async';
7
7
  import { Context } from '@dxos/context';
8
- import { createCredentialSignerWithKey, createDidFromIdentityKey, CredentialGenerator } from '@dxos/credentials';
8
+ import { CredentialGenerator, createCredentialSignerWithKey, createDidFromIdentityKey } from '@dxos/credentials';
9
9
  import { type MetadataStore, type SpaceManager, type SwarmIdentity } from '@dxos/echo-pipeline';
10
10
  import { type EdgeConnection } from '@dxos/edge-client';
11
11
  import { type FeedStore } from '@dxos/feed-store';
@@ -13,22 +13,21 @@ import { invariant } from '@dxos/invariant';
13
13
  import { type Keyring } from '@dxos/keyring';
14
14
  import { PublicKey } from '@dxos/keys';
15
15
  import { log } from '@dxos/log';
16
- import { trace } from '@dxos/protocols';
17
16
  import { Device, DeviceKind } from '@dxos/protocols/proto/dxos/client/services';
18
17
  import { type Runtime } from '@dxos/protocols/proto/dxos/config';
19
18
  import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
20
19
  import { type IdentityRecord, type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
21
20
  import {
22
21
  AdmittedFeed,
22
+ type Credential,
23
23
  type DeviceProfileDocument,
24
24
  DeviceType,
25
25
  type ProfileDocument,
26
- type Credential,
27
26
  } from '@dxos/protocols/proto/dxos/halo/credentials';
28
27
  import { Gossip, Presence } from '@dxos/teleport-extension-gossip';
29
28
  import { Timeframe } from '@dxos/timeframe';
30
29
  import { trace as Trace } from '@dxos/tracing';
31
- import { isNode, deferFunction } from '@dxos/util';
30
+ import { deferFunction, isNode, isTauri } from '@dxos/util';
32
31
 
33
32
  import { createAuthProvider } from './authenticator';
34
33
  import { Identity } from './identity';
@@ -36,14 +35,14 @@ import { Identity } from './identity';
36
35
  const DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 10_000;
37
36
  const DEVICE_PRESENCE_OFFLINE_TIMEOUT = 20_000;
38
37
 
39
- interface ConstructSpaceParams {
38
+ interface ConstructSpaceProps {
40
39
  spaceRecord: SpaceMetadata;
41
40
  swarmIdentity: SwarmIdentity;
42
41
  identityKey: PublicKey;
43
42
  gossip: Gossip;
44
43
  }
45
44
 
46
- export type JoinIdentityParams = {
45
+ export type JoinIdentityProps = {
47
46
  identityKey: PublicKey;
48
47
  deviceKey: PublicKey;
49
48
  haloSpaceKey: PublicKey;
@@ -67,7 +66,7 @@ export type CreateIdentityOptions = {
67
66
  deviceProfile?: DeviceProfileDocument;
68
67
  };
69
68
 
70
- export type IdentityManagerParams = {
69
+ export type IdentityManagerProps = {
71
70
  metadataStore: MetadataStore;
72
71
  keyring: Keyring;
73
72
  feedStore: FeedStore<FeedMessage>;
@@ -95,7 +94,7 @@ export class IdentityManager {
95
94
  private _identity?: Identity;
96
95
 
97
96
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
98
- constructor(params: IdentityManagerParams) {
97
+ constructor(params: IdentityManagerProps) {
99
98
  this._metadataStore = params.metadataStore;
100
99
  this._keyring = params.keyring;
101
100
  this._feedStore = params.feedStore;
@@ -112,8 +111,7 @@ export class IdentityManager {
112
111
 
113
112
  @Trace.span({ showInBrowserTimeline: true })
114
113
  async open(ctx: Context): Promise<void> {
115
- const traceId = PublicKey.random().toHex();
116
- log.trace('dxos.halo.identity-manager.open', trace.begin({ id: traceId }));
114
+ log('opening identity manager');
117
115
 
118
116
  const identityRecord = this._metadataStore.getIdentityRecord();
119
117
  log('identity record', { identityRecord });
@@ -128,15 +126,14 @@ export class IdentityManager {
128
126
 
129
127
  this.stateUpdate.emit();
130
128
  }
131
- log.trace('dxos.halo.identity-manager.open', trace.end({ id: traceId }));
129
+ log('opened identity manager');
132
130
  }
133
131
 
134
- async close(): Promise<void> {
135
- await this._identity?.close(new Context());
132
+ async close(ctx: Context): Promise<void> {
133
+ await this._identity?.close(ctx);
136
134
  }
137
135
 
138
- async createIdentity({ profile, deviceProfile }: CreateIdentityOptions = {}): Promise<Identity> {
139
- // TODO(nf): populate using context from ServiceContext?
136
+ async createIdentity({ profile, deviceProfile }: CreateIdentityOptions = {}, ctx?: Context): Promise<Identity> {
140
137
  invariant(!this._identity, 'Identity already exists.');
141
138
  log('creating identity...');
142
139
 
@@ -153,7 +150,7 @@ export class IdentityManager {
153
150
  };
154
151
 
155
152
  const identity = await this._constructIdentity(identityRecord);
156
- await identity.open(new Context());
153
+ await identity.open(ctx ?? Context.default());
157
154
 
158
155
  {
159
156
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
@@ -211,28 +208,32 @@ export class IdentityManager {
211
208
  return identity;
212
209
  }
213
210
 
214
- // TODO(nf): receive platform info rather than generating it here.
215
211
  createDefaultDeviceProfile(): DeviceProfileDocument {
212
+ // See TODOs in credentials.proto.
216
213
  let type: DeviceType;
217
- // TODO(nf): call Platform service instead?
218
214
  if (isNode()) {
219
215
  type = DeviceType.AGENT;
220
216
  } else {
221
217
  if (platform.name?.startsWith('iOS') || platform.name?.startsWith('Android')) {
222
218
  type = DeviceType.MOBILE;
223
- } else if ((globalThis as any).__args) {
219
+ } else if (isTauri() || !platform.name) {
220
+ // Tauri's __TAURI__ global isn't available in web workers. Fallback: WKWebView
221
+ // (Tauri on macOS) reports null for platform.name; all standard browsers don't.
224
222
  type = DeviceType.NATIVE;
225
223
  } else {
226
224
  type = DeviceType.BROWSER;
227
225
  }
228
226
  }
229
227
 
228
+ const os = platform.os?.family === 'OS X' ? 'macOS' : platform.os?.family;
229
+ const name = type === DeviceType.NATIVE || type === DeviceType.MOBILE ? 'App' : platform.name;
230
+
230
231
  return {
231
232
  type,
232
- platform: platform.name,
233
+ platform: name,
233
234
  platformVersion: platform.version,
234
235
  architecture: typeof platform.os?.architecture === 'number' ? String(platform.os.architecture) : undefined,
235
- os: platform.os?.family,
236
+ os,
236
237
  osVersion: platform.os?.version,
237
238
  };
238
239
  }
@@ -240,7 +241,7 @@ export class IdentityManager {
240
241
  /**
241
242
  * Prepare an identity object as the first step of acceptIdentity flow.
242
243
  */
243
- async prepareIdentity(params: JoinIdentityParams) {
244
+ async prepareIdentity(params: JoinIdentityProps, ctx?: Context) {
244
245
  log('accepting identity', { params });
245
246
  invariant(!this._identity, 'Identity already exists.');
246
247
 
@@ -256,7 +257,7 @@ export class IdentityManager {
256
257
  },
257
258
  };
258
259
  const identity = await this._constructIdentity(identityRecord);
259
- await identity.open(new Context());
260
+ await identity.open(ctx ?? Context.default());
260
261
  return { identity, identityRecord };
261
262
  }
262
263
 
@@ -395,7 +396,7 @@ export class IdentityManager {
395
396
  return identity;
396
397
  }
397
398
 
398
- private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceParams) {
399
+ private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceProps) {
399
400
  return this._spaceManager.constructSpace({
400
401
  metadata: {
401
402
  key: spaceRecord.key,
@@ -2,6 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { type Context } from '@dxos/context';
5
6
  import { generateSeedPhrase, keyPairFromSeedPhrase } from '@dxos/credentials';
6
7
  import { sign } from '@dxos/crypto';
7
8
  import { type EdgeHttpClient } from '@dxos/edge-client';
@@ -22,14 +23,14 @@ import {
22
23
  import { Timeframe } from '@dxos/timeframe';
23
24
 
24
25
  import { type Identity } from './identity';
25
- import { type JoinIdentityParams } from './identity-manager';
26
+ import { type JoinIdentityProps } from './identity-manager';
26
27
 
27
28
  export class EdgeIdentityRecoveryManager {
28
29
  constructor(
29
30
  private readonly _keyring: Keyring,
30
31
  private readonly _edgeClient: EdgeHttpClient | undefined,
31
32
  private readonly _identityProvider: () => Identity | undefined,
32
- private readonly _acceptRecoveredIdentity: (params: JoinIdentityParams) => Promise<Identity>,
33
+ private readonly _acceptRecoveredIdentity: (params: JoinIdentityProps) => Promise<Identity>,
33
34
  ) {}
34
35
 
35
36
  public async createRecoveryCredential({
@@ -72,7 +73,7 @@ export class EdgeIdentityRecoveryManager {
72
73
  return { recoveryCode };
73
74
  }
74
75
 
75
- public async requestRecoveryChallenge() {
76
+ public async requestRecoveryChallenge(ctx: Context) {
76
77
  invariant(this._edgeClient, 'Not connected to EDGE.');
77
78
 
78
79
  const deviceKey = await this._keyring.createKey();
@@ -83,7 +84,7 @@ export class EdgeIdentityRecoveryManager {
83
84
  };
84
85
 
85
86
  try {
86
- await this._edgeClient.recoverIdentity(request);
87
+ await this._edgeClient.recoverIdentity(ctx, request);
87
88
  throw new Error('No challenge received.');
88
89
  } catch (error: any) {
89
90
  if (!(error instanceof EdgeAuthChallengeError)) {
@@ -97,14 +98,17 @@ export class EdgeIdentityRecoveryManager {
97
98
  }
98
99
  }
99
100
 
100
- public async recoverIdentityWithExternalSignature({
101
- lookupKey,
102
- deviceKey,
103
- controlFeedKey,
104
- signature,
105
- clientDataJson,
106
- authenticatorData,
107
- }: RecoverIdentityRequest.ExternalSignature): Promise<void> {
101
+ public async recoverIdentityWithExternalSignature(
102
+ ctx: Context,
103
+ {
104
+ lookupKey,
105
+ deviceKey,
106
+ controlFeedKey,
107
+ signature,
108
+ clientDataJson,
109
+ authenticatorData,
110
+ }: RecoverIdentityRequest.ExternalSignature,
111
+ ): Promise<void> {
108
112
  invariant(this._edgeClient, 'Not connected to EDGE.');
109
113
 
110
114
  const request: EdgeRecoverIdentityRequest = {
@@ -121,7 +125,7 @@ export class EdgeIdentityRecoveryManager {
121
125
  : Buffer.from(signature).toString('base64'),
122
126
  };
123
127
 
124
- const response = await this._edgeClient.recoverIdentity(request);
128
+ const response = await this._edgeClient.recoverIdentity(ctx, request);
125
129
 
126
130
  await this._acceptRecoveredIdentity({
127
131
  authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
@@ -137,7 +141,7 @@ export class EdgeIdentityRecoveryManager {
137
141
  /**
138
142
  * Recovery identity using an opaque token sent to the user's email.
139
143
  */
140
- public async recoverIdentityWithToken({ token }: { token: string }): Promise<void> {
144
+ public async recoverIdentityWithToken(ctx: Context, { token }: { token: string }): Promise<void> {
141
145
  invariant(this._edgeClient, 'Not connected to EDGE.');
142
146
 
143
147
  const deviceKey = await this._keyring.createKey();
@@ -148,7 +152,7 @@ export class EdgeIdentityRecoveryManager {
148
152
  token,
149
153
  };
150
154
 
151
- const response = await this._edgeClient.recoverIdentity(request);
155
+ const response = await this._edgeClient.recoverIdentity(ctx, request);
152
156
 
153
157
  await this._acceptRecoveredIdentity({
154
158
  authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
@@ -161,7 +165,7 @@ export class EdgeIdentityRecoveryManager {
161
165
  });
162
166
  }
163
167
 
164
- public async recoverIdentity({ recoveryCode }: { recoveryCode: string }): Promise<void> {
168
+ public async recoverIdentity(ctx: Context, { recoveryCode }: { recoveryCode: string }): Promise<void> {
165
169
  invariant(this._edgeClient, 'Not connected to EDGE.');
166
170
 
167
171
  const recoveryKeypair = keyPairFromSeedPhrase(recoveryCode);
@@ -176,13 +180,13 @@ export class EdgeIdentityRecoveryManager {
176
180
 
177
181
  let response: RecoverIdentityResponseBody;
178
182
  try {
179
- response = await this._edgeClient.recoverIdentity(request);
183
+ response = await this._edgeClient.recoverIdentity(ctx, request);
180
184
  } catch (error: any) {
181
185
  if (!(error instanceof EdgeAuthChallengeError)) {
182
186
  throw error;
183
187
  }
184
188
  const signature = sign(Buffer.from(error.challenge, 'base64'), recoveryKeypair.secretKey);
185
- response = await this._edgeClient.recoverIdentity({
189
+ response = await this._edgeClient.recoverIdentity(ctx, {
186
190
  ...request,
187
191
  signature: Buffer.from(signature).toString('base64'),
188
192
  });
@@ -2,16 +2,16 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { afterEach, onTestFinished, beforeEach, describe, expect, test } from 'vitest';
5
+ import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'vitest';
6
6
 
7
7
  import { Trigger } from '@dxos/async';
8
8
  import { Context } from '@dxos/context';
9
9
  import { PublicKey } from '@dxos/keys';
10
10
  import { type Identity, type IdentityService } from '@dxos/protocols/proto/dxos/client/services';
11
11
 
12
- import { IdentityServiceImpl } from './identity-service';
13
12
  import { type ServiceContext } from '../services';
14
13
  import { createServiceContext } from '../testing';
14
+ import { IdentityServiceImpl } from './identity-service';
15
15
 
16
16
  describe('IdentityService', () => {
17
17
  let serviceContext: ServiceContext;
@@ -47,6 +47,12 @@ describe('IdentityService', () => {
47
47
  await identityService.createIdentity({});
48
48
  await expect(identityService.createIdentity({})).rejects.toThrowError('Identity already exists');
49
49
  });
50
+
51
+ test('creates identity with no spaces', async () => {
52
+ await identityService.createIdentity({});
53
+ const dataSpaces = [...(serviceContext.dataSpaceManager?.spaces?.values() ?? [])];
54
+ expect(dataSpaces.length).to.eq(0);
55
+ });
50
56
  });
51
57
 
52
58
  describe.skip('recoverIdentity', () => {});
@@ -88,37 +94,11 @@ describe('IdentityService', () => {
88
94
  });
89
95
  });
90
96
 
91
- describe('open', () => {
92
- test('identity without default space fixed', async () => {
93
- const serviceContext = await createServiceContext();
94
- await serviceContext.open(new Context());
95
- const identity = await serviceContext.createIdentity();
96
- const identityService = createIdentityService(serviceContext);
97
- const getDataSpaces = () => [...(serviceContext.dataSpaceManager?.spaces?.values() ?? [])];
98
- expect(getDataSpaces().length).to.eq(0);
99
- expect(identity.defaultSpaceId).to.be.undefined;
100
- await identityService.open();
101
- expect(getDataSpaces()[0].id === identity.defaultSpaceId).to.be.true;
102
- });
103
-
104
- test('identity without default space credential fixed', async () => {
105
- const serviceContext = await createServiceContext();
106
- await serviceContext.open(new Context());
107
- const identity = await serviceContext.createIdentity();
108
- const space = await serviceContext.dataSpaceManager!.createDefaultSpace();
109
- const identityService = createIdentityService(serviceContext);
110
- expect(identity.defaultSpaceId).to.be.undefined;
111
- await identityService.open();
112
- expect(identity.defaultSpaceId === space.id).to.be.true;
113
- });
114
- });
115
-
116
97
  const createIdentityService = (serviceContext: ServiceContext) => {
117
98
  return new IdentityServiceImpl(
118
99
  serviceContext.identityManager,
119
100
  serviceContext.recoveryManager,
120
101
  serviceContext.keyring,
121
- () => serviceContext.dataSpaceManager!,
122
102
  (options) => serviceContext.createIdentity(options),
123
103
  );
124
104
  };
@@ -2,13 +2,12 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Trigger, sleep } from '@dxos/async';
5
+ import { type RequestOptions } from '@dxos/codec-protobuf';
6
6
  import { Stream } from '@dxos/codec-protobuf/stream';
7
- import { Resource } from '@dxos/context';
7
+ import { Context, Resource } from '@dxos/context';
8
8
  import { createCredential, signPresentation } from '@dxos/credentials';
9
9
  import { invariant } from '@dxos/invariant';
10
10
  import { type Keyring } from '@dxos/keyring';
11
- import { log } from '@dxos/log';
12
11
  import {
13
12
  type CreateIdentityRequest,
14
13
  type CreateRecoveryCredentialRequest,
@@ -17,51 +16,30 @@ import {
17
16
  type QueryIdentityResponse,
18
17
  type RecoverIdentityRequest,
19
18
  type SignPresentationRequest,
20
- SpaceState,
21
19
  } from '@dxos/protocols/proto/dxos/client/services';
22
20
  import { type Presentation, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
23
- import { safeAwaitAll } from '@dxos/util';
24
21
 
25
22
  import { type Identity } from './identity';
26
23
  import { type CreateIdentityOptions, type IdentityManager } from './identity-manager';
27
24
  import { type EdgeIdentityRecoveryManager } from './identity-recovery-manager';
28
- import { type DataSpaceManager } from '../spaces';
29
-
30
- const DEFAULT_SPACE_SEARCH_TIMEOUT = 10_000;
31
25
 
32
26
  export class IdentityServiceImpl extends Resource implements IdentityService {
33
27
  constructor(
34
28
  private readonly _identityManager: IdentityManager,
35
29
  private readonly _recoveryManager: EdgeIdentityRecoveryManager,
36
30
  private readonly _keyring: Keyring,
37
- private readonly _dataSpaceManagerProvider: () => DataSpaceManager,
38
- private readonly _createIdentity: (params: CreateIdentityOptions) => Promise<Identity>,
31
+ private readonly _createIdentity: (params: CreateIdentityOptions, ctx?: Context) => Promise<Identity>,
39
32
  private readonly _onProfileUpdate?: (profile: ProfileDocument | undefined) => Promise<void>,
40
33
  ) {
41
34
  super();
42
35
  }
43
36
 
44
- protected override async _open(): Promise<void> {
45
- const identity = this._identityManager.identity;
46
- if (identity && !identity.defaultSpaceId) {
47
- await this._fixIdentityWithoutDefaultSpace(identity);
48
- }
49
- }
50
-
51
- async createIdentity(request: CreateIdentityRequest): Promise<IdentityProto> {
52
- await this._createIdentity({ profile: request.profile, deviceProfile: request.deviceProfile });
53
- const dataSpaceManager = this._dataSpaceManagerProvider();
54
- await this._createDefaultSpace(dataSpaceManager);
37
+ async createIdentity(request: CreateIdentityRequest, options?: RequestOptions): Promise<IdentityProto> {
38
+ const ctx = options?.ctx ?? Context.default();
39
+ await this._createIdentity({ profile: request.profile, deviceProfile: request.deviceProfile }, ctx);
55
40
  return this._getIdentity()!;
56
41
  }
57
42
 
58
- private async _createDefaultSpace(dataSpaceManager: DataSpaceManager): Promise<void> {
59
- const space = await dataSpaceManager!.createDefaultSpace();
60
- const identity = this._identityManager.identity;
61
- invariant(identity);
62
- await identity.updateDefaultSpace(space.id);
63
- }
64
-
65
43
  queryIdentity(): Stream<QueryIdentityResponse> {
66
44
  return new Stream(({ next }) => {
67
45
  const emitNext = () => next({ identity: this._getIdentity() });
@@ -95,17 +73,18 @@ export class IdentityServiceImpl extends Resource implements IdentityService {
95
73
  return this._recoveryManager.createRecoveryCredential(request);
96
74
  }
97
75
 
98
- async requestRecoveryChallenge() {
99
- return this._recoveryManager.requestRecoveryChallenge();
76
+ async requestRecoveryChallenge(_request: void, options?: RequestOptions) {
77
+ return this._recoveryManager.requestRecoveryChallenge(options?.ctx ?? Context.default());
100
78
  }
101
79
 
102
- async recoverIdentity(request: RecoverIdentityRequest): Promise<IdentityProto> {
80
+ async recoverIdentity(request: RecoverIdentityRequest, options?: RequestOptions): Promise<IdentityProto> {
81
+ const ctx = options?.ctx ?? Context.default();
103
82
  if (request.recoveryCode) {
104
- await this._recoveryManager.recoverIdentity({ recoveryCode: request.recoveryCode });
83
+ await this._recoveryManager.recoverIdentity(ctx, { recoveryCode: request.recoveryCode });
105
84
  } else if (request.external) {
106
- await this._recoveryManager.recoverIdentityWithExternalSignature(request.external);
85
+ await this._recoveryManager.recoverIdentityWithExternalSignature(ctx, request.external);
107
86
  } else if (request.token) {
108
- await this._recoveryManager.recoverIdentityWithToken({ token: request.token });
87
+ await this._recoveryManager.recoverIdentityWithToken(ctx, { token: request.token });
109
88
  } else {
110
89
  throw new Error('Invalid request.');
111
90
  }
@@ -140,50 +119,4 @@ export class IdentityServiceImpl extends Resource implements IdentityService {
140
119
  signer: this._keyring,
141
120
  });
142
121
  }
143
-
144
- private async _fixIdentityWithoutDefaultSpace(identity: Identity): Promise<void> {
145
- let recodedDefaultSpace = false;
146
- let foundDefaultSpace = false;
147
- const dataSpaceManager = this._dataSpaceManagerProvider();
148
-
149
- const recordedDefaultSpaceTrigger = new Trigger();
150
-
151
- const allProcessed = safeAwaitAll(
152
- dataSpaceManager.spaces.values(),
153
- async (space) => {
154
- if (space.state === SpaceState.SPACE_CLOSED) {
155
- await space.open();
156
-
157
- // Wait until the space is either READY or REQUIRES_MIGRATION.
158
- // NOTE: Space could potentially never initialize if the space data is corrupted.
159
- const requiresMigration = space.stateUpdate.waitForCondition(
160
- () => space.state === SpaceState.SPACE_REQUIRES_MIGRATION,
161
- );
162
- await Promise.race([space.initializeDataPipeline(), requiresMigration]);
163
- }
164
- if (await dataSpaceManager.isDefaultSpace(space)) {
165
- if (foundDefaultSpace) {
166
- log.warn('Multiple default spaces found. Using the first one.', { duplicate: space.id });
167
- return;
168
- }
169
-
170
- foundDefaultSpace = true;
171
- await identity.updateDefaultSpace(space.id);
172
- recodedDefaultSpace = true;
173
- recordedDefaultSpaceTrigger.wake();
174
- }
175
- },
176
- (err) => {
177
- log.catch(err);
178
- },
179
- );
180
-
181
- // Wait for all spaces to be processed or until the default space is recorded.
182
- // If the timeout is reached, create a new default space.
183
- await Promise.race([allProcessed, recordedDefaultSpaceTrigger.wait(), sleep(DEFAULT_SPACE_SEARCH_TIMEOUT)]);
184
-
185
- if (!recodedDefaultSpace) {
186
- await this._createDefaultSpace(dataSpaceManager);
187
- }
188
- }
189
122
  }
@@ -2,18 +2,18 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { onTestFinished, describe, expect, test } from 'vitest';
5
+ import { describe, expect, onTestFinished, test } from 'vitest';
6
6
 
7
7
  import { Event } from '@dxos/async';
8
8
  import { Context } from '@dxos/context';
9
- import { createDidFromIdentityKey, CredentialGenerator, verifyCredential } from '@dxos/credentials';
9
+ import { CredentialGenerator, createDidFromIdentityKey, verifyCredential } from '@dxos/credentials';
10
10
  import {
11
- createIdFromSpaceKey,
12
- MetadataStore,
13
11
  MOCK_AUTH_PROVIDER,
14
12
  MOCK_AUTH_VERIFIER,
13
+ MetadataStore,
15
14
  Space,
16
15
  SpaceProtocol,
16
+ createIdFromSpaceKey,
17
17
  valueEncoding,
18
18
  } from '@dxos/echo-pipeline';
19
19
  import { type EdgeConnection, type MessageListener } from '@dxos/edge-client';
@@ -26,7 +26,7 @@ import { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manag
26
26
  import { EdgeStatus } from '@dxos/protocols/proto/dxos/client/services';
27
27
  import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
28
28
  import { AdmittedFeed } from '@dxos/protocols/proto/dxos/halo/credentials';
29
- import { createStorage, StorageType } from '@dxos/random-access-storage';
29
+ import { StorageType, createStorage } from '@dxos/random-access-storage';
30
30
  import { BlobStore } from '@dxos/teleport-extension-object-sync';
31
31
 
32
32
  import { Identity } from './identity';
@@ -109,16 +109,16 @@ describe('identity/identity', () => {
109
109
 
110
110
  test('edge feed replicator', async () => {
111
111
  let replicationStarted = false;
112
- let status = EdgeStatus.NOT_CONNECTED;
112
+ let status = EdgeStatus.ConnectionState.NOT_CONNECTED;
113
113
  const listeners: Array<() => void> = [];
114
114
  const setup = await setupIdentity({
115
115
  edgeConnection: {
116
116
  statusChanged: new Event(),
117
117
  get status() {
118
- return status;
118
+ return { state: status };
119
119
  },
120
120
  onReconnected: (listener) => {
121
- if (status === EdgeStatus.CONNECTED) {
121
+ if (status === EdgeStatus.ConnectionState.CONNECTED) {
122
122
  listener();
123
123
  } else {
124
124
  listeners.push(listener);
@@ -130,7 +130,7 @@ describe('identity/identity', () => {
130
130
  onMessage: (_: MessageListener): (() => void) => {
131
131
  return () => {};
132
132
  },
133
- send: async (_) => {
133
+ send: async (..._) => {
134
134
  replicationStarted = true;
135
135
  },
136
136
  } as EdgeConnection,
@@ -138,7 +138,7 @@ describe('identity/identity', () => {
138
138
 
139
139
  await writeGenesisCredential(setup);
140
140
  listeners.forEach((callback) => callback());
141
- status = EdgeStatus.CONNECTED;
141
+ status = EdgeStatus.ConnectionState.CONNECTED;
142
142
 
143
143
  await expect.poll(() => replicationStarted).toBeTruthy();
144
144
  });
@@ -218,7 +218,7 @@ describe('identity/identity', () => {
218
218
  });
219
219
 
220
220
  await identity.open(new Context());
221
- await identity.joinNetwork();
221
+ await identity.joinNetwork(Context.default());
222
222
  onTestFinished(() => identity.close(new Context()));
223
223
  return { identity, identityKey, keyring, deviceKey, controlFeed, spaceKey, dataFeed };
224
224
  };