@dxos/client-services 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-KPYVJG6G.mjs → chunk-J33W6T4Q.mjs} +1025 -1331
- package/dist/lib/browser/chunk-J33W6T4Q.mjs.map +7 -0
- package/dist/lib/browser/chunk-NQSC7HOE.mjs +22 -0
- package/dist/lib/browser/chunk-NQSC7HOE.mjs.map +7 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +432 -65
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/browser.mjs +126 -0
- package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/node.mjs +66 -0
- package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +24 -12
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BBBSS6UL.mjs → chunk-34HKLADW.mjs} +517 -692
- package/dist/lib/node-esm/chunk-34HKLADW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs +22 -0
- package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +432 -65
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs +126 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs +66 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +24 -12
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/packlets/devtools/devtools.d.ts +2 -2
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +2 -2
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +4 -4
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +4 -4
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -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.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +2 -3
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +2 -2
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/index.d.ts +1 -1
- package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +2 -2
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +13 -7
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +19 -5
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -5
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +2 -2
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -6
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +6 -5
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts +23 -4
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-session.d.ts +2 -2
- package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +70 -48
- package/src/packlets/devtools/devtools.ts +2 -2
- package/src/packlets/diagnostics/index.ts +1 -1
- package/src/packlets/identity/authenticator.ts +2 -2
- package/src/packlets/identity/default-space-state-machine.ts +2 -2
- package/src/packlets/identity/identity-manager.ts +6 -6
- package/src/packlets/identity/identity-recovery-manager.ts +2 -2
- package/src/packlets/identity/identity.ts +2 -2
- package/src/packlets/invitations/device-invitation-protocol.ts +5 -5
- package/src/packlets/invitations/invitation-guest-extenstion.ts +6 -4
- package/src/packlets/invitations/invitation-host-extension.ts +6 -4
- package/src/packlets/invitations/invitation-protocol.ts +2 -3
- package/src/packlets/invitations/invitations-handler.ts +7 -7
- package/src/packlets/invitations/space-invitation-protocol.ts +7 -13
- package/src/packlets/locks/index.ts +1 -1
- package/src/packlets/logging/logging-service.ts +1 -1
- package/src/packlets/services/client-rpc-server.ts +4 -4
- package/src/packlets/services/service-context.ts +30 -19
- package/src/packlets/services/service-host.ts +56 -16
- package/src/packlets/space-export/space-archive-reader.ts +1 -1
- package/src/packlets/space-export/space-archive-writer.ts +3 -1
- package/src/packlets/spaces/data-space-manager.ts +43 -20
- package/src/packlets/spaces/data-space.ts +7 -6
- package/src/packlets/spaces/edge-feed-replicator.ts +2 -2
- package/src/packlets/spaces/epoch-migrations.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.test.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.ts +8 -8
- package/src/packlets/spaces/spaces-service.ts +10 -7
- package/src/packlets/storage/storage.ts +4 -4
- package/src/packlets/testing/invitation-utils.ts +7 -4
- package/src/packlets/testing/test-builder.ts +36 -10
- package/src/packlets/worker/worker-runtime.ts +141 -11
- package/src/packlets/worker/worker-session.ts +4 -4
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-KPYVJG6G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BBBSS6UL.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bc674ce",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#locks-platform": {
|
|
17
|
+
"source": {
|
|
18
|
+
"browser": "./src/packlets/locks/browser.ts",
|
|
19
|
+
"default": "./src/packlets/locks/node.ts"
|
|
20
|
+
},
|
|
21
|
+
"types": "./dist/types/src/packlets/locks/node.d.ts",
|
|
22
|
+
"browser": "./dist/lib/browser/packlets/locks/browser.mjs",
|
|
23
|
+
"default": "./dist/lib/node-esm/packlets/locks/node.mjs"
|
|
24
|
+
},
|
|
25
|
+
"#diagnostics-broadcast": {
|
|
26
|
+
"source": {
|
|
27
|
+
"browser": "./src/packlets/diagnostics/browser-diagnostics-broadcast.ts",
|
|
28
|
+
"default": "./src/packlets/diagnostics/diagnostics-broadcast.ts"
|
|
29
|
+
},
|
|
30
|
+
"types": "./dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts",
|
|
31
|
+
"browser": "./dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs",
|
|
32
|
+
"default": "./dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
11
35
|
"exports": {
|
|
12
36
|
".": {
|
|
13
37
|
"source": "./src/index.ts",
|
|
@@ -22,12 +46,6 @@
|
|
|
22
46
|
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
23
47
|
}
|
|
24
48
|
},
|
|
25
|
-
"browser": {
|
|
26
|
-
"jsondown": false,
|
|
27
|
-
"./src/packlets/locks/node.ts": "./src/packlets/locks/browser.ts",
|
|
28
|
-
"./src/packlets/diagnostics/diagnostics-broadcast.ts": "./src/packlets/diagnostics/browser-diagnostics-broadcast.ts",
|
|
29
|
-
"./testing.js": "./dist/lib/browser/packlets/testing/index.mjs"
|
|
30
|
-
},
|
|
31
49
|
"types": "dist/types/src/index.d.ts",
|
|
32
50
|
"typesVersions": {
|
|
33
51
|
"*": {
|
|
@@ -37,58 +55,62 @@
|
|
|
37
55
|
}
|
|
38
56
|
},
|
|
39
57
|
"files": [
|
|
40
|
-
"testing.d.ts",
|
|
41
|
-
"testing.js",
|
|
42
58
|
"dist",
|
|
43
59
|
"src"
|
|
44
60
|
],
|
|
45
61
|
"dependencies": {
|
|
46
|
-
"@automerge/automerge": "3.
|
|
47
|
-
"@automerge/automerge-repo": "2.
|
|
62
|
+
"@automerge/automerge": "3.2.3",
|
|
63
|
+
"@automerge/automerge-repo": "2.5.1",
|
|
64
|
+
"@effect/experimental": "0.57.11",
|
|
65
|
+
"@effect/sql": "0.48.6",
|
|
66
|
+
"@effect/sql-sqlite-node": "0.49.1",
|
|
48
67
|
"@obsidize/tar-browserify": "^5.2.0",
|
|
49
68
|
"cbor-x": "^1.5.4",
|
|
69
|
+
"effect": "3.19.11",
|
|
50
70
|
"platform": "^1.3.6",
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/config": "0.8.4-main.
|
|
55
|
-
"@dxos/context": "0.8.4-main.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/echo
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/echo-pipeline": "0.8.4-main.
|
|
62
|
-
"@dxos/echo-
|
|
63
|
-
"@dxos/edge-client": "0.8.4-main.
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/indexing": "0.8.4-main.
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/kv-store": "0.8.4-main.
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/rpc": "0.8.4-main.
|
|
79
|
-
"@dxos/teleport
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
71
|
+
"@dxos/client-protocol": "0.8.4-main.bc674ce",
|
|
72
|
+
"@dxos/async": "0.8.4-main.bc674ce",
|
|
73
|
+
"@dxos/codec-protobuf": "0.8.4-main.bc674ce",
|
|
74
|
+
"@dxos/config": "0.8.4-main.bc674ce",
|
|
75
|
+
"@dxos/context": "0.8.4-main.bc674ce",
|
|
76
|
+
"@dxos/crypto": "0.8.4-main.bc674ce",
|
|
77
|
+
"@dxos/debug": "0.8.4-main.bc674ce",
|
|
78
|
+
"@dxos/credentials": "0.8.4-main.bc674ce",
|
|
79
|
+
"@dxos/echo": "0.8.4-main.bc674ce",
|
|
80
|
+
"@dxos/echo-protocol": "0.8.4-main.bc674ce",
|
|
81
|
+
"@dxos/echo-pipeline": "0.8.4-main.bc674ce",
|
|
82
|
+
"@dxos/echo-db": "0.8.4-main.bc674ce",
|
|
83
|
+
"@dxos/edge-client": "0.8.4-main.bc674ce",
|
|
84
|
+
"@dxos/effect": "0.8.4-main.bc674ce",
|
|
85
|
+
"@dxos/indexing": "0.8.4-main.bc674ce",
|
|
86
|
+
"@dxos/invariant": "0.8.4-main.bc674ce",
|
|
87
|
+
"@dxos/feed-store": "0.8.4-main.bc674ce",
|
|
88
|
+
"@dxos/keyring": "0.8.4-main.bc674ce",
|
|
89
|
+
"@dxos/kv-store": "0.8.4-main.bc674ce",
|
|
90
|
+
"@dxos/keys": "0.8.4-main.bc674ce",
|
|
91
|
+
"@dxos/lock-file": "0.8.4-main.bc674ce",
|
|
92
|
+
"@dxos/messaging": "0.8.4-main.bc674ce",
|
|
93
|
+
"@dxos/log": "0.8.4-main.bc674ce",
|
|
94
|
+
"@dxos/node-std": "0.8.4-main.bc674ce",
|
|
95
|
+
"@dxos/network-manager": "0.8.4-main.bc674ce",
|
|
96
|
+
"@dxos/protocols": "0.8.4-main.bc674ce",
|
|
97
|
+
"@dxos/sql-sqlite": "0.8.4-main.bc674ce",
|
|
98
|
+
"@dxos/rpc": "0.8.4-main.bc674ce",
|
|
99
|
+
"@dxos/teleport": "0.8.4-main.bc674ce",
|
|
100
|
+
"@dxos/teleport-extension-object-sync": "0.8.4-main.bc674ce",
|
|
101
|
+
"@dxos/teleport-extension-gossip": "0.8.4-main.bc674ce",
|
|
102
|
+
"@dxos/timeframe": "0.8.4-main.bc674ce",
|
|
103
|
+
"@dxos/util": "0.8.4-main.bc674ce",
|
|
104
|
+
"@dxos/tracing": "0.8.4-main.bc674ce",
|
|
105
|
+
"@dxos/websocket-rpc": "0.8.4-main.bc674ce",
|
|
106
|
+
"@dxos/random-access-storage": "0.8.4-main.bc674ce"
|
|
85
107
|
},
|
|
86
108
|
"devDependencies": {
|
|
87
109
|
"@types/platform": "^1.3.4",
|
|
88
110
|
"@types/readable-stream": "^2.3.9",
|
|
89
111
|
"get-port-please": "^3.1.1",
|
|
90
|
-
"@dxos/signal": "0.8.4-main.
|
|
91
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
112
|
+
"@dxos/signal": "0.8.4-main.bc674ce",
|
|
113
|
+
"@dxos/test-utils": "0.8.4-main.bc674ce"
|
|
92
114
|
},
|
|
93
115
|
"publishConfig": {
|
|
94
116
|
"access": "public"
|
|
@@ -53,7 +53,7 @@ export class DevtoolsHostEvents {
|
|
|
53
53
|
readonly ready = new AsyncEvent();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export type
|
|
56
|
+
export type DevtoolsServiceProps = {
|
|
57
57
|
events: DevtoolsHostEvents;
|
|
58
58
|
config: Config;
|
|
59
59
|
context: ServiceContext;
|
|
@@ -63,7 +63,7 @@ export type DevtoolsServiceParams = {
|
|
|
63
63
|
* @deprecated
|
|
64
64
|
*/
|
|
65
65
|
export class DevtoolsServiceImpl implements DevtoolsHost {
|
|
66
|
-
constructor(private readonly params:
|
|
66
|
+
constructor(private readonly params: DevtoolsServiceProps) {}
|
|
67
67
|
|
|
68
68
|
events(_request: void): Stream<Event> {
|
|
69
69
|
return new Stream<Event>(({ next }) => {
|
|
@@ -27,7 +27,7 @@ export const createAuthProvider =
|
|
|
27
27
|
return Credential.encode(credential);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export type
|
|
30
|
+
export type TrustedKeySetAuthVerifierProps = {
|
|
31
31
|
// TODO(dmaretskyi): Change to `isTrusted: (key) => bool`.
|
|
32
32
|
trustedKeysProvider: () => ComplexSet<PublicKey>;
|
|
33
33
|
update: Event<void>;
|
|
@@ -44,7 +44,7 @@ export type TrustedKeySetAuthVerifierParams = {
|
|
|
44
44
|
export class TrustedKeySetAuthVerifier {
|
|
45
45
|
private _ctx = new Context();
|
|
46
46
|
|
|
47
|
-
constructor(private readonly _params:
|
|
47
|
+
constructor(private readonly _params: TrustedKeySetAuthVerifierProps) {}
|
|
48
48
|
|
|
49
49
|
async close(): Promise<void> {
|
|
50
50
|
await this._ctx.dispose();
|
|
@@ -7,7 +7,7 @@ import { type PublicKey, SpaceId } from '@dxos/keys';
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type DefaultSpaceStateMachineProps = {
|
|
11
11
|
identityKey: PublicKey;
|
|
12
12
|
onUpdate?: () => void;
|
|
13
13
|
};
|
|
@@ -18,7 +18,7 @@ type DefaultSpaceStateMachineParams = {
|
|
|
18
18
|
export class DefaultSpaceStateMachine implements CredentialProcessor {
|
|
19
19
|
private _spaceId: SpaceId | undefined;
|
|
20
20
|
|
|
21
|
-
constructor(private readonly _params:
|
|
21
|
+
constructor(private readonly _params: DefaultSpaceStateMachineProps) {}
|
|
22
22
|
|
|
23
23
|
public get spaceId(): SpaceId | undefined {
|
|
24
24
|
return this._spaceId;
|
|
@@ -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
|
|
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
|
|
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
|
|
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:
|
|
98
|
+
constructor(params: IdentityManagerProps) {
|
|
99
99
|
this._metadataStore = params.metadataStore;
|
|
100
100
|
this._keyring = params.keyring;
|
|
101
101
|
this._feedStore = params.feedStore;
|
|
@@ -240,7 +240,7 @@ export class IdentityManager {
|
|
|
240
240
|
/**
|
|
241
241
|
* Prepare an identity object as the first step of acceptIdentity flow.
|
|
242
242
|
*/
|
|
243
|
-
async prepareIdentity(params:
|
|
243
|
+
async prepareIdentity(params: JoinIdentityProps) {
|
|
244
244
|
log('accepting identity', { params });
|
|
245
245
|
invariant(!this._identity, 'Identity already exists.');
|
|
246
246
|
|
|
@@ -395,7 +395,7 @@ export class IdentityManager {
|
|
|
395
395
|
return identity;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }:
|
|
398
|
+
private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceProps) {
|
|
399
399
|
return this._spaceManager.constructSpace({
|
|
400
400
|
metadata: {
|
|
401
401
|
key: spaceRecord.key,
|
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
import { Timeframe } from '@dxos/timeframe';
|
|
23
23
|
|
|
24
24
|
import { type Identity } from './identity';
|
|
25
|
-
import { type
|
|
25
|
+
import { type JoinIdentityProps } from './identity-manager';
|
|
26
26
|
|
|
27
27
|
export class EdgeIdentityRecoveryManager {
|
|
28
28
|
constructor(
|
|
29
29
|
private readonly _keyring: Keyring,
|
|
30
30
|
private readonly _edgeClient: EdgeHttpClient | undefined,
|
|
31
31
|
private readonly _identityProvider: () => Identity | undefined,
|
|
32
|
-
private readonly _acceptRecoveredIdentity: (params:
|
|
32
|
+
private readonly _acceptRecoveredIdentity: (params: JoinIdentityProps) => Promise<Identity>,
|
|
33
33
|
) {}
|
|
34
34
|
|
|
35
35
|
public async createRecoveryCredential({
|
|
@@ -38,7 +38,7 @@ import { EdgeFeedReplicator } from '../spaces';
|
|
|
38
38
|
import { TrustedKeySetAuthVerifier } from './authenticator';
|
|
39
39
|
import { DefaultSpaceStateMachine } from './default-space-state-machine';
|
|
40
40
|
|
|
41
|
-
export type
|
|
41
|
+
export type IdentityProps = {
|
|
42
42
|
did: IdentityDid;
|
|
43
43
|
identityKey: PublicKey;
|
|
44
44
|
deviceKey: PublicKey;
|
|
@@ -71,7 +71,7 @@ export class Identity {
|
|
|
71
71
|
|
|
72
72
|
public readonly stateUpdate = new Event();
|
|
73
73
|
|
|
74
|
-
constructor(params:
|
|
74
|
+
constructor(params: IdentityProps) {
|
|
75
75
|
this.space = params.space;
|
|
76
76
|
this._signer = params.signer;
|
|
77
77
|
this._presence = params.presence;
|
|
@@ -6,7 +6,7 @@ import { getCredentialAssertion } from '@dxos/credentials';
|
|
|
6
6
|
import { invariant } from '@dxos/invariant';
|
|
7
7
|
import { type Keyring } from '@dxos/keyring';
|
|
8
8
|
import { type PublicKey } from '@dxos/keys';
|
|
9
|
-
import { AlreadyJoinedError
|
|
9
|
+
import { AlreadyJoinedError } from '@dxos/protocols';
|
|
10
10
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
11
|
import type { DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
12
12
|
import {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type IntroductionRequest,
|
|
16
16
|
} from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
17
17
|
|
|
18
|
-
import { type Identity, type
|
|
18
|
+
import { type Identity, type JoinIdentityProps } from '../identity';
|
|
19
19
|
|
|
20
20
|
import { type InvitationProtocol } from './invitation-protocol';
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
|
|
|
23
23
|
constructor(
|
|
24
24
|
private readonly _keyring: Keyring,
|
|
25
25
|
private readonly _getIdentity: () => Identity,
|
|
26
|
-
private readonly _acceptIdentity: (identity:
|
|
26
|
+
private readonly _acceptIdentity: (identity: JoinIdentityProps) => Promise<Identity>,
|
|
27
27
|
) {}
|
|
28
28
|
|
|
29
29
|
toJSON(): object {
|
|
@@ -32,7 +32,7 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
checkCanInviteNewMembers():
|
|
35
|
+
checkCanInviteNewMembers(): Error | undefined {
|
|
36
36
|
return undefined;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -71,7 +71,7 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
|
|
|
71
71
|
try {
|
|
72
72
|
const identity = this._getIdentity();
|
|
73
73
|
if (identity) {
|
|
74
|
-
return new AlreadyJoinedError('Currently only one identity per client is supported.');
|
|
74
|
+
return new AlreadyJoinedError({ message: 'Currently only one identity per client is supported.' });
|
|
75
75
|
}
|
|
76
76
|
} catch {
|
|
77
77
|
// No identity.
|
|
@@ -97,10 +97,12 @@ export class InvitationGuestExtension
|
|
|
97
97
|
await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT }));
|
|
98
98
|
log.verbose('options received');
|
|
99
99
|
if (this._remoteOptions?.role !== InvitationOptions.Role.HOST) {
|
|
100
|
-
throw new InvalidInvitationExtensionRoleError(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
throw new InvalidInvitationExtensionRoleError({
|
|
101
|
+
context: {
|
|
102
|
+
expected: InvitationOptions.Role.HOST,
|
|
103
|
+
remoteOptions: this._remoteOptions,
|
|
104
|
+
remotePeerId: context.remotePeerId,
|
|
105
|
+
},
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -245,10 +245,12 @@ export class InvitationHostExtension
|
|
|
245
245
|
await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT }));
|
|
246
246
|
log.verbose('options received');
|
|
247
247
|
if (this._remoteOptions?.role !== InvitationOptions.Role.GUEST) {
|
|
248
|
-
throw new InvalidInvitationExtensionRoleError(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
throw new InvalidInvitationExtensionRoleError({
|
|
249
|
+
context: {
|
|
250
|
+
expected: InvitationOptions.Role.GUEST,
|
|
251
|
+
remoteOptions: this._remoteOptions,
|
|
252
|
+
remotePeerId: context.remotePeerId,
|
|
253
|
+
},
|
|
252
254
|
});
|
|
253
255
|
}
|
|
254
256
|
this._callbacks.onStateUpdate(Invitation.State.CONNECTED);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PublicKey } from '@dxos/keys';
|
|
6
|
-
import type { ApiError } from '@dxos/protocols';
|
|
7
6
|
import type { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
8
7
|
import type { DeviceProfileDocument, ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
8
|
import type {
|
|
@@ -26,7 +25,7 @@ export interface InvitationProtocol {
|
|
|
26
25
|
// Host
|
|
27
26
|
//
|
|
28
27
|
|
|
29
|
-
checkCanInviteNewMembers():
|
|
28
|
+
checkCanInviteNewMembers(): Error | undefined;
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* Protocol-specific information to include in the invitation.
|
|
@@ -58,7 +57,7 @@ export interface InvitationProtocol {
|
|
|
58
57
|
*
|
|
59
58
|
* For example, the guest may already be a member of the space.
|
|
60
59
|
*/
|
|
61
|
-
checkInvitation(invitation: Partial<Invitation>):
|
|
60
|
+
checkInvitation(invitation: Partial<Invitation>): Error | undefined;
|
|
62
61
|
|
|
63
62
|
/**
|
|
64
63
|
* Get profile information to send to the host to identify the guest.
|
|
@@ -16,7 +16,7 @@ import { type AdmissionKeypair, Invitation } from '@dxos/protocols/proto/dxos/cl
|
|
|
16
16
|
import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
17
17
|
import { AuthenticationResponse, type IntroductionResponse } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
18
18
|
import { InvitationOptions } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
19
|
-
import { type ExtensionContext, type TeleportExtension, type
|
|
19
|
+
import { type ExtensionContext, type TeleportExtension, type TeleportProps } from '@dxos/teleport';
|
|
20
20
|
import { trace as _trace } from '@dxos/tracing';
|
|
21
21
|
import { ComplexSet } from '@dxos/util';
|
|
22
22
|
|
|
@@ -31,8 +31,8 @@ const metrics = _trace.metrics;
|
|
|
31
31
|
|
|
32
32
|
const MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
33
33
|
|
|
34
|
-
export type
|
|
35
|
-
teleport: Partial<
|
|
34
|
+
export type InvitationConnectionProps = {
|
|
35
|
+
teleport: Partial<TeleportProps>;
|
|
36
36
|
edgeInvitations?: EdgeInvitationConfig;
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -71,7 +71,7 @@ export class InvitationsHandler {
|
|
|
71
71
|
constructor(
|
|
72
72
|
private readonly _networkManager: SwarmNetworkManager,
|
|
73
73
|
private readonly _edgeClient?: EdgeHttpClient,
|
|
74
|
-
private readonly
|
|
74
|
+
private readonly _connectionProps?: InvitationConnectionProps,
|
|
75
75
|
) {}
|
|
76
76
|
|
|
77
77
|
handleInvitationFlow(
|
|
@@ -388,7 +388,7 @@ export class InvitationsHandler {
|
|
|
388
388
|
return extension;
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
-
const edgeInvitationHandler = new EdgeInvitationHandler(this.
|
|
391
|
+
const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionProps?.edgeInvitations, this._edgeClient, {
|
|
392
392
|
onInvitationSuccess: async (admissionResponse, admissionRequest) => {
|
|
393
393
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
394
394
|
log.info('admitted by edge', { ...protocol.toJSON() });
|
|
@@ -440,7 +440,7 @@ export class InvitationsHandler {
|
|
|
440
440
|
topic: invitation.swarmKey,
|
|
441
441
|
protocolProvider: createTeleportProtocolFactory(async (teleport) => {
|
|
442
442
|
teleport.addExtension('dxos.halo.invitations', extensionFactory());
|
|
443
|
-
}, this.
|
|
443
|
+
}, this._connectionProps?.teleport),
|
|
444
444
|
topology: new InvitationTopology(role),
|
|
445
445
|
label,
|
|
446
446
|
});
|
|
@@ -503,7 +503,7 @@ export class InvitationsHandler {
|
|
|
503
503
|
const checkInvitation = (protocol: InvitationProtocol, invitation: Partial<Invitation>) => {
|
|
504
504
|
const expiresOn = getExpirationTime(invitation);
|
|
505
505
|
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
506
|
-
return new InvalidInvitationError('Invitation already expired.');
|
|
506
|
+
return new InvalidInvitationError({ message: 'Invitation already expired.' });
|
|
507
507
|
}
|
|
508
508
|
return protocol.checkInvitation(invitation);
|
|
509
509
|
};
|
|
@@ -12,13 +12,7 @@ import { invariant } from '@dxos/invariant';
|
|
|
12
12
|
import { type Keyring } from '@dxos/keyring';
|
|
13
13
|
import { type PublicKey } from '@dxos/keys';
|
|
14
14
|
import { log } from '@dxos/log';
|
|
15
|
-
import {
|
|
16
|
-
AlreadyJoinedError,
|
|
17
|
-
type ApiError,
|
|
18
|
-
AuthorizationError,
|
|
19
|
-
InvalidInvitationError,
|
|
20
|
-
SpaceNotFoundError,
|
|
21
|
-
} from '@dxos/protocols';
|
|
15
|
+
import { AlreadyJoinedError, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from '@dxos/protocols';
|
|
22
16
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
23
17
|
import { type ProfileDocument, SpaceMember } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
24
18
|
import {
|
|
@@ -48,16 +42,16 @@ export class SpaceInvitationProtocol implements InvitationProtocol {
|
|
|
48
42
|
};
|
|
49
43
|
}
|
|
50
44
|
|
|
51
|
-
checkCanInviteNewMembers():
|
|
45
|
+
checkCanInviteNewMembers(): Error | undefined {
|
|
52
46
|
if (this._spaceKey == null) {
|
|
53
|
-
return new InvalidInvitationError('No spaceKey was provided for a space invitation.');
|
|
47
|
+
return new InvalidInvitationError({ message: 'No spaceKey was provided for a space invitation.' });
|
|
54
48
|
}
|
|
55
49
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
56
50
|
if (space == null) {
|
|
57
51
|
return new SpaceNotFoundError(this._spaceKey);
|
|
58
52
|
}
|
|
59
53
|
if (!space?.inner.spaceState.hasMembershipManagementPermission(this._signingContext.identityKey)) {
|
|
60
|
-
return new AuthorizationError('No member management permission.');
|
|
54
|
+
return new AuthorizationError({ message: 'No member management permission.' });
|
|
61
55
|
}
|
|
62
56
|
return undefined;
|
|
63
57
|
}
|
|
@@ -148,10 +142,10 @@ export class SpaceInvitationProtocol implements InvitationProtocol {
|
|
|
148
142
|
|
|
149
143
|
checkInvitation(invitation: Partial<Invitation>): InvalidInvitationError | AlreadyJoinedError | undefined {
|
|
150
144
|
if (invitation.spaceKey == null) {
|
|
151
|
-
return new InvalidInvitationError('No spaceKey was provided for a space invitation.');
|
|
145
|
+
return new InvalidInvitationError({ message: 'No spaceKey was provided for a space invitation.' });
|
|
152
146
|
}
|
|
153
147
|
if (this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
154
|
-
return new AlreadyJoinedError('Already joined space.');
|
|
148
|
+
return new AlreadyJoinedError({ message: 'Already joined space.' });
|
|
155
149
|
}
|
|
156
150
|
}
|
|
157
151
|
|
|
@@ -184,7 +178,7 @@ export class SpaceInvitationProtocol implements InvitationProtocol {
|
|
|
184
178
|
invariant(credential.subject.id.equals(this._signingContext.identityKey));
|
|
185
179
|
|
|
186
180
|
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
187
|
-
throw new AlreadyJoinedError('Already joined space.');
|
|
181
|
+
throw new AlreadyJoinedError({ message: 'Already joined space.' });
|
|
188
182
|
}
|
|
189
183
|
|
|
190
184
|
// Create local space.
|
|
@@ -37,7 +37,7 @@ export class LoggingServiceImpl implements LoggingService {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
async close(): Promise<void> {
|
|
40
|
-
const index = log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
40
|
+
const index = log.runtimeConfig.processors.findIndex((processor: LogProcessor) => processor === this._logProcessor);
|
|
41
41
|
log.runtimeConfig.processors.splice(index, 1);
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -11,7 +11,7 @@ import { type MaybePromise } from '@dxos/util';
|
|
|
11
11
|
|
|
12
12
|
import { type ServiceRegistry } from './service-registry';
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type ClientRpcServerProps = {
|
|
15
15
|
serviceRegistry: ServiceRegistry<ClientServices>;
|
|
16
16
|
handleCall?: (
|
|
17
17
|
method: string,
|
|
@@ -30,8 +30,8 @@ export class ClientRpcServer {
|
|
|
30
30
|
private readonly _serviceRegistry: ServiceRegistry<ClientServices>;
|
|
31
31
|
private readonly _rpcPeer: RpcPeer;
|
|
32
32
|
private readonly _handlerCache = new Map<string, ServiceHandler<any>>();
|
|
33
|
-
private readonly _handleCall:
|
|
34
|
-
private readonly _handleStream:
|
|
33
|
+
private readonly _handleCall: ClientRpcServerProps['handleCall'];
|
|
34
|
+
private readonly _handleStream: ClientRpcServerProps['handleStream'];
|
|
35
35
|
|
|
36
36
|
@trace.metricsCounter()
|
|
37
37
|
private readonly _callMetrics = new MapCounter();
|
|
@@ -41,7 +41,7 @@ export class ClientRpcServer {
|
|
|
41
41
|
return Object.keys(this._serviceRegistry.services);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
constructor(params:
|
|
44
|
+
constructor(params: ClientRpcServerProps) {
|
|
45
45
|
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
46
46
|
this._handleCall = handleCall;
|
|
47
47
|
this._handleStream = handleStream;
|