@dxos/client-services 0.6.12 → 0.6.13-main.09887cd
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.
- package/dist/lib/browser/{chunk-TOAILL4T.mjs → chunk-XOKN3TE7.mjs} +5890 -5165
- package/dist/lib/browser/chunk-XOKN3TE7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -3
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +12 -7
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-H6C4XY6B.cjs → chunk-IFHGVXW2.cjs} +5922 -5201
- package/dist/lib/node/chunk-IFHGVXW2.cjs.map +7 -0
- package/dist/lib/node/index.cjs +46 -46
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +18 -13
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/chunk-FTEPRZ23.mjs +8441 -0
- package/dist/lib/node-esm/chunk-FTEPRZ23.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +416 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +424 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.node.test.d.ts +2 -0
- package/dist/types/src/packlets/identity/authenticator.node.test.d.ts.map +1 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +25 -9
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +11 -3
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +30 -0
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts +2 -1
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts +2 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-state.d.ts +19 -0
- package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +8 -8
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +10 -9
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +6 -3
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +4 -3
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +3 -0
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.test.d.ts +2 -0
- package/dist/types/src/packlets/spaces/edge-feed-replicator.test.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +31 -6
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -2
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/testing/setup.d.ts +3 -0
- package/dist/types/src/testing/setup.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +43 -39
- package/src/packlets/devices/devices-service.test.ts +4 -5
- package/src/packlets/diagnostics/diagnostics-broadcast.ts +1 -0
- package/src/packlets/identity/{authenticator.test.ts → authenticator.node.test.ts} +2 -3
- package/src/packlets/identity/authenticator.ts +5 -2
- package/src/packlets/identity/contacts-service.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +31 -16
- package/src/packlets/identity/identity-manager.ts +47 -31
- package/src/packlets/identity/identity-service.test.ts +4 -8
- package/src/packlets/identity/identity.test.ts +130 -239
- package/src/packlets/identity/identity.ts +56 -17
- package/src/packlets/invitations/device-invitation-protocol.test.ts +7 -4
- package/src/packlets/invitations/device-invitation-protocol.ts +5 -1
- package/src/packlets/invitations/edge-invitation-handler.ts +184 -0
- package/src/packlets/invitations/invitation-guest-extenstion.ts +8 -4
- package/src/packlets/invitations/invitation-host-extension.ts +8 -7
- package/src/packlets/invitations/invitation-state.ts +111 -0
- package/src/packlets/invitations/invitations-handler.test.ts +16 -9
- package/src/packlets/invitations/invitations-handler.ts +23 -92
- package/src/packlets/invitations/space-invitation-protocol.test.ts +4 -3
- package/src/packlets/invitations/space-invitation-protocol.ts +4 -0
- package/src/packlets/logging/logging.test.ts +1 -2
- package/src/packlets/network/network-service.test.ts +2 -3
- package/src/packlets/services/service-context.test.ts +3 -1
- package/src/packlets/services/service-context.ts +93 -37
- package/src/packlets/services/service-host.test.ts +8 -12
- package/src/packlets/services/service-host.ts +8 -6
- package/src/packlets/services/service-registry.test.ts +1 -2
- package/src/packlets/spaces/data-space-manager.test.ts +2 -2
- package/src/packlets/spaces/data-space-manager.ts +40 -5
- package/src/packlets/spaces/data-space.ts +35 -6
- package/src/packlets/spaces/edge-feed-replicator.test.ts +253 -0
- package/src/packlets/spaces/edge-feed-replicator.ts +80 -22
- package/src/packlets/spaces/epoch-migrations.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.test.ts +10 -7
- package/src/packlets/spaces/notarization-plugin.ts +169 -29
- package/src/packlets/spaces/spaces-service.test.ts +5 -9
- package/src/packlets/spaces/spaces-service.ts +6 -1
- package/src/packlets/storage/storage.ts +0 -1
- package/src/packlets/system/system-service.test.ts +1 -2
- package/src/packlets/testing/test-builder.ts +7 -4
- package/src/packlets/worker/worker-runtime.ts +2 -2
- package/src/testing/setup.ts +11 -0
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-TOAILL4T.mjs.map +0 -7
- package/dist/lib/node/chunk-H6C4XY6B.cjs.map +0 -7
- package/dist/types/src/packlets/identity/authenticator.test.d.ts +0 -2
- package/dist/types/src/packlets/identity/authenticator.test.d.ts.map +0 -1
- package/dist/types/src/packlets/services/automerge-host.test.d.ts +0 -2
- package/dist/types/src/packlets/services/automerge-host.test.d.ts.map +0 -1
- package/src/packlets/services/automerge-host.test.ts +0 -60
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaces-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/spaces-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAWxD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,E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GAAG,MAAM,CAAC,UAAU,CAAC;IAmB7E,gBAAgB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,uBAAuB;IAmBnE,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOxG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IASzD,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAMvE,gBAAgB;IAmB9B,OAAO,CAAC,eAAe;IAgDvB,OAAO,CAAC,gBAAgB;YASV,cAAc;CAS7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/storage/storage.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAO5D,eAAO,MAAM,oBAAoB,WAAY,OAAO,CAAC,MAAM,CAAC,OAAO;;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/storage/storage.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAO5D,eAAO,MAAM,oBAAoB,WAAY,OAAO,CAAC,MAAM,CAAC,OAAO;;CAqBlE,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Config } from '@dxos/config';
|
|
2
|
-
import { EchoHost } from '@dxos/echo-
|
|
3
|
-
import { MetadataStore, SpaceManager, MeshEchoReplicator } from '@dxos/echo-pipeline';
|
|
2
|
+
import { EchoHost, MetadataStore, SpaceManager, MeshEchoReplicator } from '@dxos/echo-pipeline';
|
|
4
3
|
import { FeedStore } from '@dxos/feed-store';
|
|
5
4
|
import { Keyring } from '@dxos/keyring';
|
|
6
5
|
import { type LevelDB } from '@dxos/kv-store';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAiB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/G,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAuB,0BAA0B,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAA0B,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,OAAO,EAAiB,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,OAAO,EAAsB,kBAAkB,EAA2B,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,KAAK,2BAA2B,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,KAAK,6BAA6B,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAMtG,eAAO,MAAM,iBAAiB,WAAY,MAAM,wBAAwB,0BAA0B,uBAMjG,CAAC;AAEF,eAAO,MAAM,oBAAoB,uDAO9B;IACD,oBAAoB,CAAC,EAAE,MAAM,OAAO,CA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,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,iBAAiB,CAAC,CAAmB;IAC7C,OAAO,CAAC,qBAAqB,CAAC,CAAgB;IAC9C,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,mBAAmB,CAAsC;IACjE,OAAO,CAAC,uBAAuB,CAAkB;gBAErC,EACV,OAA0C,EAC1C,cAAc,EACd,WAAW,EACX,WAAW,EACX,MAAM,GACP,EAAE,oBAAoB;IAavB,IAAI,IAAI,uBAEP;IAEK,KAAK;IAwCL,IAAI;IASV;;OAEG;IACG,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,mBAAmB;IAoC3E;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAoBzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/testing/setup.ts"],"names":[],"mappings":";AAQA,wBAEE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.6.
|
|
1
|
+
export declare const DXOS_VERSION = "0.6.13-main.09887cd";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13-main.09887cd",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,14 +10,16 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
12
|
"node": {
|
|
13
|
-
"
|
|
13
|
+
"require": "./dist/lib/node/index.cjs",
|
|
14
|
+
"default": "./dist/lib/node-esm/index.mjs"
|
|
14
15
|
},
|
|
15
16
|
"types": "./dist/types/src/index.d.ts"
|
|
16
17
|
},
|
|
17
18
|
"./testing": {
|
|
18
19
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
19
20
|
"node": {
|
|
20
|
-
"
|
|
21
|
+
"require": "./dist/lib/node/testing/index.cjs",
|
|
22
|
+
"default": "./dist/lib/node-esm/testing/index.mjs"
|
|
21
23
|
},
|
|
22
24
|
"types": "./dist/types/src/testing/index.d.ts"
|
|
23
25
|
}
|
|
@@ -45,46 +47,48 @@
|
|
|
45
47
|
"dependencies": {
|
|
46
48
|
"cbor-x": "^1.5.4",
|
|
47
49
|
"platform": "^1.3.6",
|
|
48
|
-
"@dxos/async": "0.6.
|
|
49
|
-
"@dxos/automerge": "0.6.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/context": "0.6.
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/echo-db": "0.6.
|
|
58
|
-
"@dxos/echo-pipeline": "0.6.
|
|
59
|
-
"@dxos/echo-
|
|
60
|
-
"@dxos/echo-
|
|
61
|
-
"@dxos/edge-client": "0.6.
|
|
62
|
-
"@dxos/feed-store": "0.6.
|
|
63
|
-
"@dxos/indexing": "0.6.
|
|
64
|
-
"@dxos/invariant": "0.6.
|
|
65
|
-
"@dxos/keyring": "0.6.
|
|
66
|
-
"@dxos/keys": "0.6.
|
|
67
|
-
"@dxos/kv-store": "0.6.
|
|
68
|
-
"@dxos/lock-file": "0.6.
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/rpc": "0.6.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/teleport": "0.6.
|
|
77
|
-
"@dxos/teleport-extension-
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/tracing": "0.6.
|
|
81
|
-
"@dxos/util": "0.6.
|
|
82
|
-
"@dxos/websocket-rpc": "0.6.
|
|
50
|
+
"@dxos/async": "0.6.13-main.09887cd",
|
|
51
|
+
"@dxos/automerge": "0.6.13-main.09887cd",
|
|
52
|
+
"@dxos/client-protocol": "0.6.13-main.09887cd",
|
|
53
|
+
"@dxos/codec-protobuf": "0.6.13-main.09887cd",
|
|
54
|
+
"@dxos/credentials": "0.6.13-main.09887cd",
|
|
55
|
+
"@dxos/context": "0.6.13-main.09887cd",
|
|
56
|
+
"@dxos/config": "0.6.13-main.09887cd",
|
|
57
|
+
"@dxos/crypto": "0.6.13-main.09887cd",
|
|
58
|
+
"@dxos/debug": "0.6.13-main.09887cd",
|
|
59
|
+
"@dxos/echo-db": "0.6.13-main.09887cd",
|
|
60
|
+
"@dxos/echo-pipeline": "0.6.13-main.09887cd",
|
|
61
|
+
"@dxos/echo-schema": "0.6.13-main.09887cd",
|
|
62
|
+
"@dxos/echo-protocol": "0.6.13-main.09887cd",
|
|
63
|
+
"@dxos/edge-client": "0.6.13-main.09887cd",
|
|
64
|
+
"@dxos/feed-store": "0.6.13-main.09887cd",
|
|
65
|
+
"@dxos/indexing": "0.6.13-main.09887cd",
|
|
66
|
+
"@dxos/invariant": "0.6.13-main.09887cd",
|
|
67
|
+
"@dxos/keyring": "0.6.13-main.09887cd",
|
|
68
|
+
"@dxos/keys": "0.6.13-main.09887cd",
|
|
69
|
+
"@dxos/kv-store": "0.6.13-main.09887cd",
|
|
70
|
+
"@dxos/lock-file": "0.6.13-main.09887cd",
|
|
71
|
+
"@dxos/log": "0.6.13-main.09887cd",
|
|
72
|
+
"@dxos/messaging": "0.6.13-main.09887cd",
|
|
73
|
+
"@dxos/node-std": "0.6.13-main.09887cd",
|
|
74
|
+
"@dxos/network-manager": "0.6.13-main.09887cd",
|
|
75
|
+
"@dxos/random-access-storage": "0.6.13-main.09887cd",
|
|
76
|
+
"@dxos/rpc": "0.6.13-main.09887cd",
|
|
77
|
+
"@dxos/protocols": "0.6.13-main.09887cd",
|
|
78
|
+
"@dxos/teleport": "0.6.13-main.09887cd",
|
|
79
|
+
"@dxos/teleport-extension-object-sync": "0.6.13-main.09887cd",
|
|
80
|
+
"@dxos/teleport-extension-gossip": "0.6.13-main.09887cd",
|
|
81
|
+
"@dxos/timeframe": "0.6.13-main.09887cd",
|
|
82
|
+
"@dxos/tracing": "0.6.13-main.09887cd",
|
|
83
|
+
"@dxos/util": "0.6.13-main.09887cd",
|
|
84
|
+
"@dxos/websocket-rpc": "0.6.13-main.09887cd"
|
|
83
85
|
},
|
|
84
86
|
"devDependencies": {
|
|
85
87
|
"@types/platform": "^1.3.4",
|
|
86
88
|
"@types/readable-stream": "^2.3.9",
|
|
87
|
-
"
|
|
89
|
+
"get-port-please": "^3.1.1",
|
|
90
|
+
"@dxos/signal": "0.6.13-main.09887cd",
|
|
91
|
+
"@dxos/test-utils": "0.6.13-main.09887cd"
|
|
88
92
|
},
|
|
89
93
|
"publishConfig": {
|
|
90
94
|
"access": "public"
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { expect } from '
|
|
5
|
+
import { afterEach, onTestFinished, beforeEach, describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
10
|
import { type DevicesService, type Device } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
|
-
import { afterEach, afterTest, beforeEach, describe, test } from '@dxos/test';
|
|
12
11
|
|
|
13
12
|
import { DevicesServiceImpl } from './devices-service';
|
|
14
13
|
import { type ServiceContext } from '../services';
|
|
@@ -36,7 +35,7 @@ describe('DevicesService', () => {
|
|
|
36
35
|
query.subscribe(({ devices }) => {
|
|
37
36
|
result.wake(devices);
|
|
38
37
|
});
|
|
39
|
-
|
|
38
|
+
onTestFinished(() => query.close());
|
|
40
39
|
expect(device.profile?.label).to.equal('test-device');
|
|
41
40
|
});
|
|
42
41
|
});
|
|
@@ -51,7 +50,7 @@ describe('DevicesService', () => {
|
|
|
51
50
|
},
|
|
52
51
|
(err) => log.catch(err),
|
|
53
52
|
);
|
|
54
|
-
|
|
53
|
+
onTestFinished(() => query.close().catch((err) => log.catch(err)));
|
|
55
54
|
expect(await result.wait()).to.be.length(0);
|
|
56
55
|
});
|
|
57
56
|
|
|
@@ -61,7 +60,7 @@ describe('DevicesService', () => {
|
|
|
61
60
|
query.subscribe(({ devices }) => {
|
|
62
61
|
result.wake(devices);
|
|
63
62
|
});
|
|
64
|
-
|
|
63
|
+
onTestFinished(() => query.close());
|
|
65
64
|
expect(await result.wait()).to.be.length(0);
|
|
66
65
|
|
|
67
66
|
result = new Trigger<Device[] | undefined>();
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import expect from '
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Event } from '@dxos/async';
|
|
8
8
|
import { createCredentialSignerWithKey } from '@dxos/credentials';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { Keyring } from '@dxos/keyring';
|
|
11
11
|
import { PublicKey } from '@dxos/keys';
|
|
12
|
-
import { describe, test } from '@dxos/test';
|
|
13
12
|
import { ComplexSet } from '@dxos/util';
|
|
14
13
|
|
|
15
14
|
import { createAuthProvider, TrustedKeySetAuthVerifier } from './authenticator';
|
|
@@ -30,5 +29,5 @@ describe('identity/authenticator', () => {
|
|
|
30
29
|
const credential = await authProvider(nonce);
|
|
31
30
|
invariant(credential);
|
|
32
31
|
expect(await authVerifier.verifier(nonce, credential)).toBeTruthy();
|
|
33
|
-
})
|
|
32
|
+
});
|
|
34
33
|
});
|
|
@@ -67,7 +67,7 @@ export class TrustedKeySetAuthVerifier {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (this._isTrustedKey(credential.issuer)) {
|
|
70
|
-
log('key is
|
|
70
|
+
log('key is trusted -- auth success', { key: credential.issuer });
|
|
71
71
|
return true;
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -81,7 +81,10 @@ export class TrustedKeySetAuthVerifier {
|
|
|
81
81
|
log('auth success', { key: credential.issuer });
|
|
82
82
|
trigger.wake(true);
|
|
83
83
|
} else {
|
|
84
|
-
log('key is not currently in trusted set, waiting...', {
|
|
84
|
+
log('key is not currently in trusted set, waiting...', {
|
|
85
|
+
key: credential.issuer,
|
|
86
|
+
trusted: [...this._params.trustedKeysProvider()],
|
|
87
|
+
});
|
|
85
88
|
}
|
|
86
89
|
});
|
|
87
90
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { EventSubscriptions, scheduleTask, UpdateScheduler } from '@dxos/async';
|
|
6
6
|
import { Stream } from '@dxos/codec-protobuf';
|
|
7
7
|
import { type MemberInfo } from '@dxos/credentials';
|
|
8
|
-
import type
|
|
8
|
+
import { type SpaceManager } from '@dxos/echo-pipeline';
|
|
9
9
|
import { PublicKey } from '@dxos/keys';
|
|
10
10
|
import { type Contact, type ContactBook, type ContactsService } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
11
|
import { ComplexMap, ComplexSet } from '@dxos/util';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { expect } from '
|
|
5
|
+
import { describe, expect, test, onTestFinished } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Context } from '@dxos/context';
|
|
8
8
|
import { valueEncoding, MetadataStore, SpaceManager, AuthStatus } from '@dxos/echo-pipeline';
|
|
@@ -13,7 +13,6 @@ import { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manag
|
|
|
13
13
|
import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
14
14
|
import { createStorage, type Storage, StorageType } from '@dxos/random-access-storage';
|
|
15
15
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
16
|
-
import { describe, test, afterTest } from '@dxos/test';
|
|
17
16
|
|
|
18
17
|
import { IdentityManager } from './identity-manager';
|
|
19
18
|
|
|
@@ -39,7 +38,7 @@ describe('identity/identity-manager', () => {
|
|
|
39
38
|
}),
|
|
40
39
|
});
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
onTestFinished(() => feedStore.close());
|
|
43
42
|
|
|
44
43
|
const networkManager = new SwarmNetworkManager({
|
|
45
44
|
signalManager: new MemorySignalManager(signalContext),
|
|
@@ -51,9 +50,10 @@ describe('identity/identity-manager', () => {
|
|
|
51
50
|
blobStore,
|
|
52
51
|
metadataStore,
|
|
53
52
|
});
|
|
54
|
-
const identityManager = new IdentityManager(metadataStore, keyring, feedStore, spaceManager);
|
|
53
|
+
const identityManager = new IdentityManager({ metadataStore, keyring, feedStore, spaceManager });
|
|
55
54
|
|
|
56
55
|
return {
|
|
56
|
+
networkManager,
|
|
57
57
|
metadataStore,
|
|
58
58
|
identityManager,
|
|
59
59
|
feedStore,
|
|
@@ -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
|
-
|
|
67
|
+
onTestFinished(() => identityManager.close());
|
|
68
68
|
|
|
69
69
|
const identity = await identityManager.createIdentity();
|
|
70
70
|
expect(identity).to.exist;
|
|
@@ -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
|
-
|
|
98
|
+
onTestFinished(() => identityManager.close());
|
|
99
99
|
|
|
100
100
|
const identity = await identityManager.createIdentity();
|
|
101
101
|
expect(identity.profileDocument?.displayName).to.be.undefined;
|
|
@@ -108,6 +108,11 @@ describe('identity/identity-manager', () => {
|
|
|
108
108
|
|
|
109
109
|
const peer1 = await setupPeer({ signalContext });
|
|
110
110
|
const identity1 = await peer1.identityManager.createIdentity();
|
|
111
|
+
peer1.networkManager.setPeerInfo({
|
|
112
|
+
peerKey: identity1.deviceKey.toHex(),
|
|
113
|
+
identityKey: identity1.identityKey.toHex(),
|
|
114
|
+
});
|
|
115
|
+
await identity1.joinNetwork();
|
|
111
116
|
|
|
112
117
|
const peer2 = await setupPeer({ signalContext });
|
|
113
118
|
|
|
@@ -115,28 +120,38 @@ describe('identity/identity-manager', () => {
|
|
|
115
120
|
const controlFeedKey = await peer2.keyring.createKey();
|
|
116
121
|
const dataFeedKey = await peer2.keyring.createKey();
|
|
117
122
|
|
|
123
|
+
const credential = await identity1.getIdentityCredentialSigner().createCredential({
|
|
124
|
+
subject: deviceKey,
|
|
125
|
+
assertion: {
|
|
126
|
+
'@type': 'dxos.halo.credentials.AuthorizedDevice',
|
|
127
|
+
identityKey: identity1.identityKey,
|
|
128
|
+
deviceKey,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
|
|
118
132
|
await identity1.controlPipeline.writer.write({
|
|
119
133
|
credential: {
|
|
120
|
-
credential
|
|
121
|
-
subject: deviceKey,
|
|
122
|
-
assertion: {
|
|
123
|
-
'@type': 'dxos.halo.credentials.AuthorizedDevice',
|
|
124
|
-
identityKey: identity1.identityKey,
|
|
125
|
-
deviceKey,
|
|
126
|
-
},
|
|
127
|
-
}),
|
|
134
|
+
credential,
|
|
128
135
|
},
|
|
129
136
|
});
|
|
130
137
|
|
|
131
|
-
|
|
132
|
-
const identity2 = await peer2.identityManager.acceptIdentity({
|
|
138
|
+
const { identity: identity2, identityRecord } = await peer2.identityManager.prepareIdentity({
|
|
133
139
|
identityKey: identity1.identityKey,
|
|
134
140
|
deviceKey,
|
|
135
141
|
haloSpaceKey: identity1.haloSpaceKey,
|
|
136
142
|
haloGenesisFeedKey: identity1.haloGenesisFeedKey,
|
|
137
143
|
controlFeedKey,
|
|
138
144
|
dataFeedKey,
|
|
145
|
+
authorizedDeviceCredential: credential,
|
|
146
|
+
});
|
|
147
|
+
peer2.networkManager.setPeerInfo({
|
|
148
|
+
peerKey: identity2.deviceKey.toHex(),
|
|
149
|
+
identityKey: identity2.identityKey.toHex(),
|
|
139
150
|
});
|
|
151
|
+
await identity2.joinNetwork();
|
|
152
|
+
|
|
153
|
+
// Identity2 is not yet ready at this point. Peer1 needs to admit peer2 device key and feed keys.
|
|
154
|
+
await peer2.identityManager.acceptIdentity(identity2, identityRecord);
|
|
140
155
|
|
|
141
156
|
// TODO(dmaretskyi): We'd also need to admit device2's feeds otherwise messages from them won't be processed by the pipeline.
|
|
142
157
|
// This would mean that peer2 has replicated it's device credential chain from peer1 and is ready to issue credentials.
|
|
@@ -7,6 +7,7 @@ import { Event } from '@dxos/async';
|
|
|
7
7
|
import { Context } from '@dxos/context';
|
|
8
8
|
import { createCredentialSignerWithKey, CredentialGenerator } from '@dxos/credentials';
|
|
9
9
|
import { type MetadataStore, type SpaceManager, type SwarmIdentity } from '@dxos/echo-pipeline';
|
|
10
|
+
import { type EdgeConnection } from '@dxos/edge-client';
|
|
10
11
|
import { type FeedStore } from '@dxos/feed-store';
|
|
11
12
|
import { invariant } from '@dxos/invariant';
|
|
12
13
|
import { type Keyring } from '@dxos/keyring';
|
|
@@ -14,6 +15,7 @@ import { PublicKey } from '@dxos/keys';
|
|
|
14
15
|
import { log } from '@dxos/log';
|
|
15
16
|
import { trace } from '@dxos/protocols';
|
|
16
17
|
import { Device, DeviceKind } from '@dxos/protocols/proto/dxos/client/services';
|
|
18
|
+
import { type Runtime } from '@dxos/protocols/proto/dxos/config';
|
|
17
19
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
18
20
|
import { type IdentityRecord, type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
19
21
|
import {
|
|
@@ -21,6 +23,7 @@ import {
|
|
|
21
23
|
type DeviceProfileDocument,
|
|
22
24
|
DeviceType,
|
|
23
25
|
type ProfileDocument,
|
|
26
|
+
type Credential,
|
|
24
27
|
} from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
25
28
|
import { Gossip, Presence } from '@dxos/teleport-extension-gossip';
|
|
26
29
|
import { Timeframe } from '@dxos/timeframe';
|
|
@@ -47,6 +50,7 @@ export type JoinIdentityParams = {
|
|
|
47
50
|
haloGenesisFeedKey: PublicKey;
|
|
48
51
|
controlFeedKey: PublicKey;
|
|
49
52
|
dataFeedKey: PublicKey;
|
|
53
|
+
authorizedDeviceCredential: Credential;
|
|
50
54
|
|
|
51
55
|
/**
|
|
52
56
|
* Latest known timeframe for the control pipeline.
|
|
@@ -63,7 +67,13 @@ export type CreateIdentityOptions = {
|
|
|
63
67
|
deviceProfile?: DeviceProfileDocument;
|
|
64
68
|
};
|
|
65
69
|
|
|
66
|
-
export type
|
|
70
|
+
export type IdentityManagerParams = {
|
|
71
|
+
metadataStore: MetadataStore;
|
|
72
|
+
keyring: Keyring;
|
|
73
|
+
feedStore: FeedStore<FeedMessage>;
|
|
74
|
+
spaceManager: SpaceManager;
|
|
75
|
+
edgeConnection?: EdgeConnection;
|
|
76
|
+
edgeFeatures?: Runtime.Client.EdgeFeatures;
|
|
67
77
|
devicePresenceAnnounceInterval?: number;
|
|
68
78
|
devicePresenceOfflineTimeout?: number;
|
|
69
79
|
};
|
|
@@ -73,28 +83,27 @@ export type IdentityManagerRuntimeParams = {
|
|
|
73
83
|
export class IdentityManager {
|
|
74
84
|
readonly stateUpdate = new Event();
|
|
75
85
|
|
|
76
|
-
private
|
|
86
|
+
private readonly _metadataStore: MetadataStore;
|
|
87
|
+
private readonly _keyring: Keyring;
|
|
88
|
+
private readonly _feedStore: FeedStore<FeedMessage>;
|
|
89
|
+
private readonly _spaceManager: SpaceManager;
|
|
77
90
|
private readonly _devicePresenceAnnounceInterval: number;
|
|
78
91
|
private readonly _devicePresenceOfflineTimeout: number;
|
|
92
|
+
private readonly _edgeConnection: EdgeConnection | undefined;
|
|
93
|
+
private readonly _edgeFeatures: Runtime.Client.EdgeFeatures | undefined;
|
|
94
|
+
|
|
95
|
+
private _identity?: Identity;
|
|
79
96
|
|
|
80
|
-
// TODO(burdon): IdentityManagerParams.
|
|
81
97
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
82
|
-
constructor(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
params
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
) {
|
|
92
|
-
const {
|
|
93
|
-
devicePresenceAnnounceInterval = DEVICE_PRESENCE_ANNOUNCE_INTERVAL,
|
|
94
|
-
devicePresenceOfflineTimeout = DEVICE_PRESENCE_OFFLINE_TIMEOUT,
|
|
95
|
-
} = params ?? {};
|
|
96
|
-
this._devicePresenceAnnounceInterval = devicePresenceAnnounceInterval;
|
|
97
|
-
this._devicePresenceOfflineTimeout = devicePresenceOfflineTimeout;
|
|
98
|
+
constructor(params: IdentityManagerParams) {
|
|
99
|
+
this._metadataStore = params.metadataStore;
|
|
100
|
+
this._keyring = params.keyring;
|
|
101
|
+
this._feedStore = params.feedStore;
|
|
102
|
+
this._spaceManager = params.spaceManager;
|
|
103
|
+
this._edgeConnection = params.edgeConnection;
|
|
104
|
+
this._edgeFeatures = params.edgeFeatures;
|
|
105
|
+
this._devicePresenceAnnounceInterval = params.devicePresenceAnnounceInterval ?? DEVICE_PRESENCE_ANNOUNCE_INTERVAL;
|
|
106
|
+
this._devicePresenceOfflineTimeout = params.devicePresenceOfflineTimeout ?? DEVICE_PRESENCE_OFFLINE_TIMEOUT;
|
|
98
107
|
}
|
|
99
108
|
|
|
100
109
|
get identity() {
|
|
@@ -184,10 +193,6 @@ export class IdentityManager {
|
|
|
184
193
|
}
|
|
185
194
|
}
|
|
186
195
|
|
|
187
|
-
// TODO(burdon): ???
|
|
188
|
-
// await this._keyring.deleteKey(identityRecord.identity_key);
|
|
189
|
-
// await this._keyring.deleteKey(identityRecord.halo_space.space_key);
|
|
190
|
-
|
|
191
196
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
192
197
|
this._identity = identity;
|
|
193
198
|
await this._identity.ready();
|
|
@@ -202,6 +207,7 @@ export class IdentityManager {
|
|
|
202
207
|
deviceKey: identity.deviceKey,
|
|
203
208
|
profile: identity.profileDocument,
|
|
204
209
|
});
|
|
210
|
+
|
|
205
211
|
return identity;
|
|
206
212
|
}
|
|
207
213
|
|
|
@@ -232,9 +238,9 @@ export class IdentityManager {
|
|
|
232
238
|
}
|
|
233
239
|
|
|
234
240
|
/**
|
|
235
|
-
*
|
|
241
|
+
* Prepare an identity object as the first step of acceptIdentity flow.
|
|
236
242
|
*/
|
|
237
|
-
async
|
|
243
|
+
async prepareIdentity(params: JoinIdentityParams) {
|
|
238
244
|
log('accepting identity', { params });
|
|
239
245
|
invariant(!this._identity, 'Identity already exists.');
|
|
240
246
|
|
|
@@ -249,24 +255,33 @@ export class IdentityManager {
|
|
|
249
255
|
controlTimeframe: params.controlTimeframe,
|
|
250
256
|
},
|
|
251
257
|
};
|
|
252
|
-
|
|
253
258
|
const identity = await this._constructIdentity(identityRecord);
|
|
254
259
|
await identity.open(new Context());
|
|
260
|
+
return { identity, identityRecord };
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Accept an existing identity. Expects its device key to be authorized (now or later).
|
|
265
|
+
*/
|
|
266
|
+
public async acceptIdentity(identity: Identity, identityRecord: IdentityRecord, profile?: DeviceProfileDocument) {
|
|
255
267
|
this._identity = identity;
|
|
256
|
-
|
|
268
|
+
|
|
269
|
+
// Identity becomes ready after device chain is replicated. Wait for it before storing the record.
|
|
257
270
|
await this._identity.ready();
|
|
271
|
+
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
272
|
+
|
|
258
273
|
log.trace('dxos.halo.identity', {
|
|
259
|
-
identityKey:
|
|
274
|
+
identityKey: this._identity!.identityKey,
|
|
260
275
|
displayName: this._identity.profileDocument?.displayName,
|
|
261
276
|
});
|
|
262
277
|
|
|
263
278
|
await this.updateDeviceProfile({
|
|
264
279
|
...this.createDefaultDeviceProfile(),
|
|
265
|
-
...
|
|
280
|
+
...profile,
|
|
266
281
|
});
|
|
267
282
|
this.stateUpdate.emit();
|
|
283
|
+
|
|
268
284
|
log('accepted identity', { identityKey: identity.identityKey, deviceKey: identity.deviceKey });
|
|
269
|
-
return identity;
|
|
270
285
|
}
|
|
271
286
|
|
|
272
287
|
/**
|
|
@@ -360,9 +375,10 @@ export class IdentityManager {
|
|
|
360
375
|
signer: this._keyring,
|
|
361
376
|
identityKey: identityRecord.identityKey,
|
|
362
377
|
deviceKey: identityRecord.deviceKey,
|
|
378
|
+
edgeConnection: this._edgeConnection,
|
|
379
|
+
edgeFeatures: this._edgeFeatures,
|
|
363
380
|
});
|
|
364
381
|
log('done', { identityKey: identityRecord.identityKey });
|
|
365
|
-
this._callbacks?.onIdentityConstruction?.(identity);
|
|
366
382
|
|
|
367
383
|
// TODO(mykola): Set new timeframe on a write to a feed.
|
|
368
384
|
if (identityRecord.haloSpace.controlTimeframe) {
|
|
@@ -2,21 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import chaiAsPromised from 'chai-as-promised';
|
|
5
|
+
import { afterEach, onTestFinished, beforeEach, describe, expect, test } from 'vitest';
|
|
7
6
|
|
|
8
7
|
import { Trigger } from '@dxos/async';
|
|
9
8
|
import { Context } from '@dxos/context';
|
|
10
9
|
import { PublicKey } from '@dxos/keys';
|
|
11
10
|
import { type Identity, type IdentityService } from '@dxos/protocols/proto/dxos/client/services';
|
|
12
|
-
import { afterEach, afterTest, beforeEach, describe, test } from '@dxos/test';
|
|
13
11
|
|
|
14
12
|
import { IdentityServiceImpl } from './identity-service';
|
|
15
13
|
import { type ServiceContext } from '../services';
|
|
16
14
|
import { createServiceContext } from '../testing';
|
|
17
15
|
|
|
18
|
-
chai.use(chaiAsPromised);
|
|
19
|
-
|
|
20
16
|
describe('IdentityService', () => {
|
|
21
17
|
let serviceContext: ServiceContext;
|
|
22
18
|
let identityService: IdentityService;
|
|
@@ -49,7 +45,7 @@ describe('IdentityService', () => {
|
|
|
49
45
|
|
|
50
46
|
test('fails to create identity if one already exists', async () => {
|
|
51
47
|
await identityService.createIdentity({});
|
|
52
|
-
await expect(identityService.createIdentity({})).
|
|
48
|
+
await expect(identityService.createIdentity({})).rejects.toThrowError('Identity already exists');
|
|
53
49
|
});
|
|
54
50
|
});
|
|
55
51
|
|
|
@@ -72,7 +68,7 @@ describe('IdentityService', () => {
|
|
|
72
68
|
query.subscribe(({ identity }) => {
|
|
73
69
|
result.wake(identity);
|
|
74
70
|
});
|
|
75
|
-
|
|
71
|
+
onTestFinished(() => query.close());
|
|
76
72
|
expect(await result.wait()).to.be.undefined;
|
|
77
73
|
});
|
|
78
74
|
|
|
@@ -82,7 +78,7 @@ describe('IdentityService', () => {
|
|
|
82
78
|
query.subscribe(({ identity }) => {
|
|
83
79
|
result.wake(identity);
|
|
84
80
|
});
|
|
85
|
-
|
|
81
|
+
onTestFinished(() => query.close());
|
|
86
82
|
expect(await result.wait()).to.be.undefined;
|
|
87
83
|
|
|
88
84
|
result = new Trigger<Identity | undefined>();
|