@dxos/client-services 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5

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 (239) hide show
  1. package/dist/lib/browser/{chunk-ERQJUBAW.mjs → chunk-HYGNOM23.mjs} +4279 -3342
  2. package/dist/lib/browser/chunk-HYGNOM23.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-NQSC7HOE.mjs +22 -0
  4. package/dist/lib/browser/chunk-NQSC7HOE.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/index.mjs +539 -98
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
  11. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  12. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  13. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  14. package/dist/lib/browser/packlets/locks/browser.mjs +126 -0
  15. package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
  16. package/dist/lib/browser/packlets/locks/node.mjs +66 -0
  17. package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
  18. package/dist/lib/browser/testing/index.mjs +45 -26
  19. package/dist/lib/browser/testing/index.mjs.map +3 -3
  20. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
  21. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-TMEG7JOG.mjs → chunk-GFT7MAQE.mjs} +3764 -2695
  23. package/dist/lib/node-esm/chunk-GFT7MAQE.mjs.map +7 -0
  24. package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs +22 -0
  25. package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +539 -98
  27. package/dist/lib/node-esm/index.mjs.map +4 -4
  28. package/dist/lib/node-esm/meta.json +1 -1
  29. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
  30. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  31. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  32. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  33. package/dist/lib/node-esm/packlets/locks/browser.mjs +126 -0
  34. package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
  35. package/dist/lib/node-esm/packlets/locks/node.mjs +66 -0
  36. package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
  37. package/dist/lib/node-esm/testing/index.mjs +45 -26
  38. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  39. package/dist/types/src/index.d.ts +1 -0
  40. package/dist/types/src/index.d.ts.map +1 -1
  41. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +3 -2
  42. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
  43. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +3 -2
  44. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  45. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  46. package/dist/types/src/packlets/devtools/devtools.d.ts +20 -20
  47. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  48. package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
  49. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  50. package/dist/types/src/packlets/devtools/network.d.ts +1 -1
  51. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  52. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts +1 -1
  53. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
  54. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts +1 -1
  55. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
  56. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts +2 -3
  57. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
  58. package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
  59. package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
  60. package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
  61. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  62. package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
  63. package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
  64. package/dist/types/src/packlets/identity/identity-manager.d.ts +7 -7
  65. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  66. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +7 -6
  67. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
  68. package/dist/types/src/packlets/identity/identity-service.d.ts +6 -10
  69. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  70. package/dist/types/src/packlets/identity/identity.d.ts +9 -12
  71. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  72. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +6 -5
  73. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  74. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +2 -2
  75. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
  76. package/dist/types/src/packlets/invitations/index.d.ts +1 -1
  77. package/dist/types/src/packlets/invitations/index.d.ts.map +1 -1
  78. package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
  79. package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
  80. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +8 -5
  81. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
  82. package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
  83. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
  84. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  85. package/dist/types/src/packlets/invitations/invitations-manager.d.ts +3 -3
  86. package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
  87. package/dist/types/src/packlets/invitations/invitations-service.d.ts +4 -4
  88. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  89. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +5 -4
  90. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  91. package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
  92. package/dist/types/src/packlets/locks/index.d.ts +2 -2
  93. package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
  94. package/dist/types/src/packlets/logging/logging-service.d.ts +5 -1
  95. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  96. package/dist/types/src/packlets/network/network-service.d.ts +7 -6
  97. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  98. package/dist/types/src/packlets/services/client-rpc-server.d.ts +5 -5
  99. package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
  100. package/dist/types/src/packlets/services/feed-syncer.d.ts +59 -0
  101. package/dist/types/src/packlets/services/feed-syncer.d.ts.map +1 -0
  102. package/dist/types/src/packlets/services/feed-syncer.test.d.ts +2 -0
  103. package/dist/types/src/packlets/services/feed-syncer.test.d.ts.map +1 -0
  104. package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
  105. package/dist/types/src/packlets/services/service-context.d.ts +14 -9
  106. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  107. package/dist/types/src/packlets/services/service-host.d.ts +21 -8
  108. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  109. package/dist/types/src/packlets/space-export/archive-format.d.ts +9 -0
  110. package/dist/types/src/packlets/space-export/archive-format.d.ts.map +1 -0
  111. package/dist/types/src/packlets/space-export/index.d.ts +4 -1
  112. package/dist/types/src/packlets/space-export/index.d.ts.map +1 -1
  113. package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts +23 -0
  114. package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts.map +1 -0
  115. package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts +36 -0
  116. package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts.map +1 -0
  117. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +9 -1
  118. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
  119. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts +8 -2
  120. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
  121. package/dist/types/src/packlets/space-export/space-archive.test.d.ts +2 -0
  122. package/dist/types/src/packlets/space-export/space-archive.test.d.ts.map +1 -0
  123. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +1 -1
  124. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
  125. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +29 -17
  126. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  127. package/dist/types/src/packlets/spaces/data-space.d.ts +30 -13
  128. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  129. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
  130. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  131. package/dist/types/src/packlets/spaces/genesis.d.ts +2 -1
  132. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
  133. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -6
  134. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  135. package/dist/types/src/packlets/spaces/spaces-service.d.ts +18 -8
  136. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  137. package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
  138. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  139. package/dist/types/src/packlets/system/system-service.d.ts +1 -1
  140. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  141. package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
  142. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  143. package/dist/types/src/packlets/testing/test-builder.d.ts +8 -7
  144. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  145. package/dist/types/src/packlets/worker/worker-runtime.d.ts +41 -4
  146. package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
  147. package/dist/types/src/packlets/worker/worker-session.d.ts +2 -4
  148. package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
  149. package/dist/types/src/version.d.ts +1 -1
  150. package/dist/types/src/version.d.ts.map +1 -1
  151. package/dist/types/tsconfig.tsbuildinfo +1 -1
  152. package/package.json +72 -48
  153. package/src/index.ts +1 -0
  154. package/src/packlets/agents/edge-agent-manager.ts +10 -7
  155. package/src/packlets/agents/edge-agent-service.ts +17 -5
  156. package/src/packlets/devices/devices-service.test.ts +3 -3
  157. package/src/packlets/devices/devices-service.ts +2 -2
  158. package/src/packlets/devtools/devtools.ts +29 -29
  159. package/src/packlets/devtools/feeds.ts +2 -2
  160. package/src/packlets/devtools/network.ts +1 -1
  161. package/src/packlets/diagnostics/browser-diagnostics-broadcast.ts +1 -1
  162. package/src/packlets/diagnostics/diagnostics-broadcast.ts +1 -1
  163. package/src/packlets/diagnostics/diagnostics-collector.ts +1 -1
  164. package/src/packlets/diagnostics/diagnostics.ts +2 -3
  165. package/src/packlets/diagnostics/index.ts +1 -1
  166. package/src/packlets/identity/authenticator.node.test.ts +1 -1
  167. package/src/packlets/identity/authenticator.ts +3 -3
  168. package/src/packlets/identity/contacts-service.ts +2 -2
  169. package/src/packlets/identity/identity-manager.test.ts +8 -8
  170. package/src/packlets/identity/identity-manager.ts +23 -20
  171. package/src/packlets/identity/identity-recovery-manager.ts +22 -18
  172. package/src/packlets/identity/identity-service.test.ts +8 -28
  173. package/src/packlets/identity/identity-service.ts +13 -80
  174. package/src/packlets/identity/identity.test.ts +11 -11
  175. package/src/packlets/identity/identity.ts +17 -39
  176. package/src/packlets/invitations/device-invitation-protocol.test.ts +4 -4
  177. package/src/packlets/invitations/device-invitation-protocol.ts +8 -6
  178. package/src/packlets/invitations/edge-invitation-handler.ts +10 -6
  179. package/src/packlets/invitations/index.ts +1 -1
  180. package/src/packlets/invitations/invitation-guest-extenstion.ts +7 -5
  181. package/src/packlets/invitations/invitation-host-extension.ts +8 -6
  182. package/src/packlets/invitations/invitation-protocol.ts +8 -5
  183. package/src/packlets/invitations/invitation-state.ts +0 -10
  184. package/src/packlets/invitations/invitations-handler.test.ts +301 -292
  185. package/src/packlets/invitations/invitations-handler.ts +72 -16
  186. package/src/packlets/invitations/invitations-manager.ts +43 -18
  187. package/src/packlets/invitations/invitations-service.ts +10 -10
  188. package/src/packlets/invitations/space-invitation-protocol.test.ts +26 -25
  189. package/src/packlets/invitations/space-invitation-protocol.ts +13 -17
  190. package/src/packlets/invitations/utils.ts +1 -1
  191. package/src/packlets/locks/browser.ts +1 -1
  192. package/src/packlets/locks/index.ts +2 -2
  193. package/src/packlets/logging/logging-service.ts +8 -3
  194. package/src/packlets/logging/logging.test.ts +1 -1
  195. package/src/packlets/network/network-service.test.ts +3 -3
  196. package/src/packlets/network/network-service.ts +12 -10
  197. package/src/packlets/services/client-rpc-server.ts +20 -17
  198. package/src/packlets/services/feed-syncer.test.ts +340 -0
  199. package/src/packlets/services/feed-syncer.ts +337 -0
  200. package/src/packlets/services/platform.ts +7 -1
  201. package/src/packlets/services/service-context.test.ts +4 -3
  202. package/src/packlets/services/service-context.ts +145 -59
  203. package/src/packlets/services/service-host.test.ts +10 -9
  204. package/src/packlets/services/service-host.ts +85 -38
  205. package/src/packlets/services/service-registry.test.ts +1 -1
  206. package/src/packlets/space-export/archive-format.ts +42 -0
  207. package/src/packlets/space-export/index.ts +4 -1
  208. package/src/packlets/space-export/serialized-space-reader.ts +111 -0
  209. package/src/packlets/space-export/serialized-space-writer.ts +246 -0
  210. package/src/packlets/space-export/space-archive-reader.ts +65 -4
  211. package/src/packlets/space-export/space-archive-writer.ts +44 -6
  212. package/src/packlets/space-export/space-archive.test.ts +461 -0
  213. package/src/packlets/space-export/tar.test.ts +1 -1
  214. package/src/packlets/spaces/automerge-space-state.ts +1 -1
  215. package/src/packlets/spaces/data-space-manager.test.ts +79 -13
  216. package/src/packlets/spaces/data-space-manager.ts +131 -118
  217. package/src/packlets/spaces/data-space.ts +65 -39
  218. package/src/packlets/spaces/edge-feed-replicator.test.ts +4 -4
  219. package/src/packlets/spaces/edge-feed-replicator.ts +13 -11
  220. package/src/packlets/spaces/epoch-migrations.ts +5 -5
  221. package/src/packlets/spaces/genesis.ts +6 -1
  222. package/src/packlets/spaces/notarization-plugin.test.ts +3 -3
  223. package/src/packlets/spaces/notarization-plugin.ts +13 -12
  224. package/src/packlets/spaces/spaces-service.test.ts +20 -12
  225. package/src/packlets/spaces/spaces-service.ts +138 -38
  226. package/src/packlets/storage/profile-archive.ts +1 -1
  227. package/src/packlets/storage/storage.ts +7 -8
  228. package/src/packlets/system/system-service.test.ts +1 -1
  229. package/src/packlets/system/system-service.ts +4 -4
  230. package/src/packlets/testing/invitation-utils.ts +11 -7
  231. package/src/packlets/testing/test-builder.ts +39 -13
  232. package/src/packlets/worker/worker-runtime.ts +180 -17
  233. package/src/packlets/worker/worker-session.ts +15 -21
  234. package/src/version.ts +1 -1
  235. package/dist/lib/browser/chunk-ERQJUBAW.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-TMEG7JOG.mjs.map +0 -7
  237. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
  238. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
  239. 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';
@@ -20,15 +20,15 @@ import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
20
20
  import { type IdentityRecord, type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
21
21
  import {
22
22
  AdmittedFeed,
23
+ type Credential,
23
24
  type DeviceProfileDocument,
24
25
  DeviceType,
25
26
  type ProfileDocument,
26
- type Credential,
27
27
  } from '@dxos/protocols/proto/dxos/halo/credentials';
28
28
  import { Gossip, Presence } from '@dxos/teleport-extension-gossip';
29
29
  import { Timeframe } from '@dxos/timeframe';
30
30
  import { trace as Trace } from '@dxos/tracing';
31
- import { isNode, deferFunction } from '@dxos/util';
31
+ import { deferFunction, isNode, isTauri } from '@dxos/util';
32
32
 
33
33
  import { createAuthProvider } from './authenticator';
34
34
  import { Identity } from './identity';
@@ -36,14 +36,14 @@ import { Identity } from './identity';
36
36
  const DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 10_000;
37
37
  const DEVICE_PRESENCE_OFFLINE_TIMEOUT = 20_000;
38
38
 
39
- interface ConstructSpaceParams {
39
+ interface ConstructSpaceProps {
40
40
  spaceRecord: SpaceMetadata;
41
41
  swarmIdentity: SwarmIdentity;
42
42
  identityKey: PublicKey;
43
43
  gossip: Gossip;
44
44
  }
45
45
 
46
- export type JoinIdentityParams = {
46
+ export type JoinIdentityProps = {
47
47
  identityKey: PublicKey;
48
48
  deviceKey: PublicKey;
49
49
  haloSpaceKey: PublicKey;
@@ -67,7 +67,7 @@ export type CreateIdentityOptions = {
67
67
  deviceProfile?: DeviceProfileDocument;
68
68
  };
69
69
 
70
- export type IdentityManagerParams = {
70
+ export type IdentityManagerProps = {
71
71
  metadataStore: MetadataStore;
72
72
  keyring: Keyring;
73
73
  feedStore: FeedStore<FeedMessage>;
@@ -95,7 +95,7 @@ export class IdentityManager {
95
95
  private _identity?: Identity;
96
96
 
97
97
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
98
- constructor(params: IdentityManagerParams) {
98
+ constructor(params: IdentityManagerProps) {
99
99
  this._metadataStore = params.metadataStore;
100
100
  this._keyring = params.keyring;
101
101
  this._feedStore = params.feedStore;
@@ -131,12 +131,11 @@ export class IdentityManager {
131
131
  log.trace('dxos.halo.identity-manager.open', trace.end({ id: traceId }));
132
132
  }
133
133
 
134
- async close(): Promise<void> {
135
- await this._identity?.close(new Context());
134
+ async close(ctx: Context): Promise<void> {
135
+ await this._identity?.close(ctx);
136
136
  }
137
137
 
138
- async createIdentity({ profile, deviceProfile }: CreateIdentityOptions = {}): Promise<Identity> {
139
- // TODO(nf): populate using context from ServiceContext?
138
+ async createIdentity({ profile, deviceProfile }: CreateIdentityOptions = {}, ctx?: Context): Promise<Identity> {
140
139
  invariant(!this._identity, 'Identity already exists.');
141
140
  log('creating identity...');
142
141
 
@@ -153,7 +152,7 @@ export class IdentityManager {
153
152
  };
154
153
 
155
154
  const identity = await this._constructIdentity(identityRecord);
156
- await identity.open(new Context());
155
+ await identity.open(ctx ?? Context.default());
157
156
 
158
157
  {
159
158
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
@@ -211,28 +210,32 @@ export class IdentityManager {
211
210
  return identity;
212
211
  }
213
212
 
214
- // TODO(nf): receive platform info rather than generating it here.
215
213
  createDefaultDeviceProfile(): DeviceProfileDocument {
214
+ // See TODOs in credentials.proto.
216
215
  let type: DeviceType;
217
- // TODO(nf): call Platform service instead?
218
216
  if (isNode()) {
219
217
  type = DeviceType.AGENT;
220
218
  } else {
221
219
  if (platform.name?.startsWith('iOS') || platform.name?.startsWith('Android')) {
222
220
  type = DeviceType.MOBILE;
223
- } else if ((globalThis as any).__args) {
221
+ } else if (isTauri() || !platform.name) {
222
+ // Tauri's __TAURI__ global isn't available in web workers. Fallback: WKWebView
223
+ // (Tauri on macOS) reports null for platform.name; all standard browsers don't.
224
224
  type = DeviceType.NATIVE;
225
225
  } else {
226
226
  type = DeviceType.BROWSER;
227
227
  }
228
228
  }
229
229
 
230
+ const os = platform.os?.family === 'OS X' ? 'macOS' : platform.os?.family;
231
+ const name = type === DeviceType.NATIVE || type === DeviceType.MOBILE ? 'App' : platform.name;
232
+
230
233
  return {
231
234
  type,
232
- platform: platform.name,
235
+ platform: name,
233
236
  platformVersion: platform.version,
234
237
  architecture: typeof platform.os?.architecture === 'number' ? String(platform.os.architecture) : undefined,
235
- os: platform.os?.family,
238
+ os,
236
239
  osVersion: platform.os?.version,
237
240
  };
238
241
  }
@@ -240,7 +243,7 @@ export class IdentityManager {
240
243
  /**
241
244
  * Prepare an identity object as the first step of acceptIdentity flow.
242
245
  */
243
- async prepareIdentity(params: JoinIdentityParams) {
246
+ async prepareIdentity(params: JoinIdentityProps, ctx?: Context) {
244
247
  log('accepting identity', { params });
245
248
  invariant(!this._identity, 'Identity already exists.');
246
249
 
@@ -256,7 +259,7 @@ export class IdentityManager {
256
259
  },
257
260
  };
258
261
  const identity = await this._constructIdentity(identityRecord);
259
- await identity.open(new Context());
262
+ await identity.open(ctx ?? Context.default());
260
263
  return { identity, identityRecord };
261
264
  }
262
265
 
@@ -395,7 +398,7 @@ export class IdentityManager {
395
398
  return identity;
396
399
  }
397
400
 
398
- private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceParams) {
401
+ private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceProps) {
399
402
  return this._spaceManager.constructSpace({
400
403
  metadata: {
401
404
  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
  };