@dxos/client-services 0.5.1-next.260c093 → 0.5.1-next.26de2f3
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-55TEJXLO.mjs → chunk-LPIE23D2.mjs} +1263 -907
- package/dist/lib/browser/chunk-LPIE23D2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +31 -2
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +28 -8
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-3ZUQNDPT.cjs → chunk-MVAX2L2C.cjs} +1417 -1069
- package/dist/lib/node/chunk-MVAX2L2C.cjs.map +7 -0
- package/dist/lib/node/index.cjs +73 -44
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +34 -14
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -1
- 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 +39 -0
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/{invitation-extension.d.ts → invitation-host-extension.d.ts} +17 -31
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +6 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts +37 -0
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +19 -10
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.test.d.ts +2 -0
- package/dist/types/src/packlets/invitations/invitations-handler.test.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts +2 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts +6 -0
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -0
- package/dist/types/src/packlets/services/service-context.d.ts +6 -3
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +2 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +10 -2
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/invitations/device-invitation-protocol.ts +5 -1
- package/src/packlets/invitations/invitation-guest-extenstion.ts +126 -0
- package/src/packlets/invitations/{invitation-extension.ts → invitation-host-extension.ts} +99 -105
- package/src/packlets/invitations/invitation-protocol.ts +7 -1
- package/src/packlets/invitations/invitation-topology.ts +87 -0
- package/src/packlets/invitations/invitations-handler.test.ts +361 -0
- package/src/packlets/invitations/invitations-handler.ts +246 -149
- package/src/packlets/invitations/invitations-manager.ts +42 -3
- package/src/packlets/invitations/space-invitation-protocol.ts +19 -1
- package/src/packlets/invitations/utils.ts +27 -0
- package/src/packlets/services/service-context.ts +5 -3
- package/src/packlets/testing/invitation-utils.ts +23 -3
- package/src/packlets/testing/test-builder.ts +3 -1
- package/src/packlets/vault/shell-runtime.ts +40 -2
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-55TEJXLO.mjs.map +0 -7
- package/dist/lib/node/chunk-3ZUQNDPT.cjs.map +0 -7
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Mutex, type MutexGuard } from '@dxos/async';
|
|
2
|
+
import { type Context } from '@dxos/context';
|
|
3
|
+
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
4
|
+
export declare const stateToString: (state: Invitation.State) => string;
|
|
5
|
+
export declare const tryAcquireBeforeContextDisposed: (ctx: Context, mutex: Mutex) => Promise<MutexGuard>;
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAqB,KAAK,OAAO,EAAwB,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAExE,eAAO,MAAM,aAAa,UAAW,WAAW,KAAK,KAAG,MAEvD,CAAC;AAEF,eAAO,MAAM,+BAA+B,QAAe,OAAO,SAAS,KAAK,KAAG,QAAQ,UAAU,CAcpG,CAAC"}
|
|
@@ -11,12 +11,15 @@ import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
|
11
11
|
import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
12
12
|
import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
13
13
|
import { type Storage } from '@dxos/random-access-storage';
|
|
14
|
+
import type { TeleportParams } from '@dxos/teleport';
|
|
14
15
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
15
16
|
import { IdentityManager, type CreateIdentityOptions, type IdentityManagerRuntimeParams } from '../identity';
|
|
16
17
|
import { InvitationsHandler, type InvitationProtocol } from '../invitations';
|
|
17
18
|
import { InvitationsManager } from '../invitations/invitations-manager';
|
|
18
19
|
import { DataSpaceManager, type DataSpaceManagerRuntimeParams } from '../spaces';
|
|
19
|
-
export type ServiceContextRuntimeParams = IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams
|
|
20
|
+
export type ServiceContextRuntimeParams = IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams & {
|
|
21
|
+
invitationConnectionDefaultParams?: Partial<TeleportParams>;
|
|
22
|
+
};
|
|
20
23
|
/**
|
|
21
24
|
* Shared backend for all client services.
|
|
22
25
|
*/
|
|
@@ -25,7 +28,7 @@ export declare class ServiceContext extends Resource {
|
|
|
25
28
|
readonly level: LevelDB;
|
|
26
29
|
readonly networkManager: NetworkManager;
|
|
27
30
|
readonly signalManager: SignalManager;
|
|
28
|
-
readonly _runtimeParams?:
|
|
31
|
+
readonly _runtimeParams?: ServiceContextRuntimeParams | undefined;
|
|
29
32
|
readonly initialized: Trigger<void>;
|
|
30
33
|
readonly metadataStore: MetadataStore;
|
|
31
34
|
/**
|
|
@@ -44,7 +47,7 @@ export declare class ServiceContext extends Resource {
|
|
|
44
47
|
private readonly _handlerFactories;
|
|
45
48
|
private _deviceSpaceSync?;
|
|
46
49
|
private readonly _instanceId;
|
|
47
|
-
constructor(storage: Storage, level: LevelDB, networkManager: NetworkManager, signalManager: SignalManager, _runtimeParams?:
|
|
50
|
+
constructor(storage: Storage, level: LevelDB, networkManager: NetworkManager, signalManager: SignalManager, _runtimeParams?: ServiceContextRuntimeParams | undefined);
|
|
48
51
|
protected _open(ctx: Context): Promise<void>;
|
|
49
52
|
protected _close(ctx: Context): Promise<void>;
|
|
50
53
|
createIdentity(params?: CreateIdentityOptions): Promise<import("../identity").Identity>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-context.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OA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est?: PerformInvitationCallbacks<AuthenticatingInvitation>;
|
|
32
32
|
};
|
|
33
33
|
guestDeviceProfile?: DeviceProfileDocument;
|
|
34
|
+
codeInputDelay?: number;
|
|
34
35
|
};
|
|
35
36
|
export type Result = {
|
|
36
37
|
invitation?: Invitation;
|
|
37
38
|
error?: Error;
|
|
38
39
|
};
|
|
39
|
-
export declare const performInvitation: ({ host, guest, options, hooks, guestDeviceProfile, }: PerformInvitationParams) => [Promise<Result>, Promise<Result>];
|
|
40
|
+
export declare const performInvitation: ({ host, guest, options, hooks, guestDeviceProfile, codeInputDelay, }: PerformInvitationParams) => [Promise<Result>, Promise<Result>];
|
|
40
41
|
//# sourceMappingURL=invitation-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation-utils.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/testing/invitation-utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqB,KAAK,wBAAwB,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAErH,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,kBAAkB,eAAgB,UAAU,KAAG,UAE3D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,qBAAqB,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,EAAE,aAAa,CAAC,EAAE,qBAAqB,GAAG,wBAAwB,CAAC;CACxG,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,CAAC,IAAI;IAC1C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,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;IAED,IAAI,aAAa,kBAEhB;IAED,IAAI,cAAc,mBAKjB;IAED,IAAI,YAAY,iBAQf;IAED,IAAI,QAAQ,mBAEX;IAED,IAAI,QAAQ,aAKX;IAED,IAAI,gBAAgB,IAAI,gBAAgB,CAUvC;IAED,IAAI,kBAAkB,uBAYrB;IAEK,cAAc;IAId,OAAO;CAId;AAED,eAAO,MAAM,oBAAoB,YAAmB,OAAO,KAAG,QAAQ,cAAc,CAiBnF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
2
|
import { type ShellRuntime } from '@dxos/client-protocol';
|
|
3
3
|
import { type PublicKey } from '@dxos/keys';
|
|
4
|
-
import { type AppContextRequest, type LayoutRequest, ShellLayout } from '@dxos/protocols/proto/dxos/iframe';
|
|
4
|
+
import { type AppContextRequest, type LayoutRequest, ShellLayout, type InvitationUrlRequest } from '@dxos/protocols/proto/dxos/iframe';
|
|
5
5
|
import { type RpcPort } from '@dxos/rpc';
|
|
6
6
|
/**
|
|
7
7
|
* Endpoint that handles shell services.
|
|
@@ -9,15 +9,23 @@ import { type RpcPort } from '@dxos/rpc';
|
|
|
9
9
|
export declare class ShellRuntimeImpl implements ShellRuntime {
|
|
10
10
|
private readonly _port;
|
|
11
11
|
readonly layoutUpdate: Event<LayoutRequest>;
|
|
12
|
+
readonly invitationUrlUpdate: Event<InvitationUrlRequest>;
|
|
12
13
|
private _appRpc?;
|
|
13
14
|
private _layout;
|
|
14
|
-
private _invitationCode?;
|
|
15
15
|
private _spaceKey?;
|
|
16
|
+
private _invitationCode?;
|
|
17
|
+
private _invitationUrl?;
|
|
18
|
+
private _deviceInvitationParam;
|
|
19
|
+
private _spaceInvitationParam;
|
|
16
20
|
constructor(_port: RpcPort);
|
|
17
21
|
get layout(): ShellLayout;
|
|
18
22
|
get invitationCode(): string | undefined;
|
|
19
23
|
get spaceKey(): PublicKey | undefined;
|
|
24
|
+
get invitationUrl(): string;
|
|
25
|
+
get deviceInvitationParam(): string;
|
|
26
|
+
get spaceInvitationParam(): string;
|
|
20
27
|
setLayout({ layout, invitationCode, spaceKey }: LayoutRequest): void;
|
|
28
|
+
setInvitationUrl({ invitationUrl, deviceInvitationParam, spaceInvitationParam }: InvitationUrlRequest): void;
|
|
21
29
|
setAppContext(context: AppContextRequest): Promise<void>;
|
|
22
30
|
open(): Promise<void>;
|
|
23
31
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/shell-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAA2C,KAAK,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AAEvH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"shell-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/shell-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAA2C,KAAK,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AAEvH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,oBAAoB,EAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAyC,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhF;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAevC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAdlC,QAAQ,CAAC,YAAY,uBAA8B;IACnD,QAAQ,CAAC,mBAAmB,8BAAqC;IAEjE,OAAO,CAAC,OAAO,CAAC,CAAiC;IACjD,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAC,CAAY;IAE9B,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,cAAc,CAAC,CAAsE;IAG7F,OAAO,CAAC,sBAAsB,CAA0B;IACxD,OAAO,CAAC,qBAAqB,CAAyB;gBAEzB,KAAK,EAAE,OAAO;IAE3C,IAAI,MAAM,gBAET;IAED,IAAI,cAAc,uBAEjB;IAED,IAAI,QAAQ,0BAEX;IAED,IAAI,aAAa,WAEhB;IAED,IAAI,qBAAqB,WAExB;IAED,IAAI,oBAAoB,WAEvB;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,aAAa;IAO7D,gBAAgB,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,EAAE,oBAAoB;IAO/F,aAAa,CAAC,OAAO,EAAE,iBAAiB;IAMxC,IAAI;IA0BJ,KAAK;CAIZ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.5.1-next.
|
|
1
|
+
export declare const DXOS_VERSION = "0.5.1-next.26de2f3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.26de2f3",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,45 +23,45 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"platform": "^1.3.6",
|
|
26
|
-
"@dxos/
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/automerge": "0.5.1-next.
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/context": "0.5.1-next.
|
|
32
|
-
"@dxos/credentials": "0.5.1-next.
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/echo-pipeline": "0.5.1-next.
|
|
37
|
-
"@dxos/echo-protocol": "0.5.1-next.
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/echo-schema": "0.5.1-next.
|
|
42
|
-
"@dxos/keyring": "0.5.1-next.
|
|
43
|
-
"@dxos/keys": "0.5.1-next.
|
|
44
|
-
"@dxos/kv-store": "0.5.1-next.
|
|
45
|
-
"@dxos/lock-file": "0.5.1-next.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/network-manager": "0.5.1-next.
|
|
49
|
-
"@dxos/node-std": "0.5.1-next.
|
|
50
|
-
"@dxos/protocols": "0.5.1-next.
|
|
51
|
-
"@dxos/random-access-storage": "0.5.1-next.
|
|
52
|
-
"@dxos/teleport": "0.5.1-next.
|
|
53
|
-
"@dxos/rpc": "0.5.1-next.
|
|
54
|
-
"@dxos/teleport-extension-gossip": "0.5.1-next.
|
|
55
|
-
"@dxos/teleport-extension-object-sync": "0.5.1-next.
|
|
56
|
-
"@dxos/timeframe": "0.5.1-next.
|
|
57
|
-
"@dxos/tracing": "0.5.1-next.
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
26
|
+
"@dxos/client-protocol": "0.5.1-next.26de2f3",
|
|
27
|
+
"@dxos/async": "0.5.1-next.26de2f3",
|
|
28
|
+
"@dxos/automerge": "0.5.1-next.26de2f3",
|
|
29
|
+
"@dxos/config": "0.5.1-next.26de2f3",
|
|
30
|
+
"@dxos/codec-protobuf": "0.5.1-next.26de2f3",
|
|
31
|
+
"@dxos/context": "0.5.1-next.26de2f3",
|
|
32
|
+
"@dxos/credentials": "0.5.1-next.26de2f3",
|
|
33
|
+
"@dxos/debug": "0.5.1-next.26de2f3",
|
|
34
|
+
"@dxos/echo-db": "0.5.1-next.26de2f3",
|
|
35
|
+
"@dxos/crypto": "0.5.1-next.26de2f3",
|
|
36
|
+
"@dxos/echo-pipeline": "0.5.1-next.26de2f3",
|
|
37
|
+
"@dxos/echo-protocol": "0.5.1-next.26de2f3",
|
|
38
|
+
"@dxos/indexing": "0.5.1-next.26de2f3",
|
|
39
|
+
"@dxos/invariant": "0.5.1-next.26de2f3",
|
|
40
|
+
"@dxos/feed-store": "0.5.1-next.26de2f3",
|
|
41
|
+
"@dxos/echo-schema": "0.5.1-next.26de2f3",
|
|
42
|
+
"@dxos/keyring": "0.5.1-next.26de2f3",
|
|
43
|
+
"@dxos/keys": "0.5.1-next.26de2f3",
|
|
44
|
+
"@dxos/kv-store": "0.5.1-next.26de2f3",
|
|
45
|
+
"@dxos/lock-file": "0.5.1-next.26de2f3",
|
|
46
|
+
"@dxos/messaging": "0.5.1-next.26de2f3",
|
|
47
|
+
"@dxos/log": "0.5.1-next.26de2f3",
|
|
48
|
+
"@dxos/network-manager": "0.5.1-next.26de2f3",
|
|
49
|
+
"@dxos/node-std": "0.5.1-next.26de2f3",
|
|
50
|
+
"@dxos/protocols": "0.5.1-next.26de2f3",
|
|
51
|
+
"@dxos/random-access-storage": "0.5.1-next.26de2f3",
|
|
52
|
+
"@dxos/teleport": "0.5.1-next.26de2f3",
|
|
53
|
+
"@dxos/rpc": "0.5.1-next.26de2f3",
|
|
54
|
+
"@dxos/teleport-extension-gossip": "0.5.1-next.26de2f3",
|
|
55
|
+
"@dxos/teleport-extension-object-sync": "0.5.1-next.26de2f3",
|
|
56
|
+
"@dxos/timeframe": "0.5.1-next.26de2f3",
|
|
57
|
+
"@dxos/tracing": "0.5.1-next.26de2f3",
|
|
58
|
+
"@dxos/websocket-rpc": "0.5.1-next.26de2f3",
|
|
59
|
+
"@dxos/util": "0.5.1-next.26de2f3"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/platform": "^1.3.4",
|
|
63
63
|
"@types/readable-stream": "^2.3.9",
|
|
64
|
-
"@dxos/signal": "0.5.1-next.
|
|
64
|
+
"@dxos/signal": "0.5.1-next.26de2f3"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
@@ -34,7 +34,11 @@ export class DeviceInvitationProtocol implements InvitationProtocol {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
async delegate(
|
|
37
|
+
async delegate(): Promise<PublicKey> {
|
|
38
|
+
throw new Error('delegation not supported');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async cancelDelegation(): Promise<void> {
|
|
38
42
|
throw new Error('delegation not supported');
|
|
39
43
|
}
|
|
40
44
|
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Mutex, type MutexGuard, Trigger } from '@dxos/async';
|
|
6
|
+
import { cancelWithContext, Context } from '@dxos/context';
|
|
7
|
+
import { invariant } from '@dxos/invariant';
|
|
8
|
+
import { log } from '@dxos/log';
|
|
9
|
+
import { InvalidInvitationExtensionRoleError, schema } from '@dxos/protocols';
|
|
10
|
+
import { type Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
|
+
import { type InvitationHostService, Options } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
12
|
+
import { type ExtensionContext, RpcExtension } from '@dxos/teleport';
|
|
13
|
+
|
|
14
|
+
import { tryAcquireBeforeContextDisposed } from './utils';
|
|
15
|
+
|
|
16
|
+
const OPTIONS_TIMEOUT = 10_000;
|
|
17
|
+
|
|
18
|
+
type InvitationGuestExtensionCallbacks = {
|
|
19
|
+
// Deliberately not async to not block the extensions opening.
|
|
20
|
+
onOpen: (ctx: Context, extensionCtx: ExtensionContext) => void;
|
|
21
|
+
onError: (error: Error) => void;
|
|
22
|
+
|
|
23
|
+
onStateUpdate: (newState: Invitation.State) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Guest's side for a connection to a concrete peer in p2p network during invitation.
|
|
28
|
+
*/
|
|
29
|
+
export class InvitationGuestExtension extends RpcExtension<
|
|
30
|
+
{ InvitationHostService: InvitationHostService },
|
|
31
|
+
{ InvitationHostService: InvitationHostService }
|
|
32
|
+
> {
|
|
33
|
+
private _ctx = new Context();
|
|
34
|
+
private _remoteOptions?: Options;
|
|
35
|
+
private _remoteOptionsTrigger = new Trigger();
|
|
36
|
+
/**
|
|
37
|
+
* Held to allow only one invitation flow at a time to be active.
|
|
38
|
+
*/
|
|
39
|
+
private _invitationFlowLock: MutexGuard | null = null;
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
private readonly _invitationFlowMutex: Mutex,
|
|
43
|
+
private readonly _callbacks: InvitationGuestExtensionCallbacks,
|
|
44
|
+
) {
|
|
45
|
+
super({
|
|
46
|
+
requested: {
|
|
47
|
+
InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService'),
|
|
48
|
+
},
|
|
49
|
+
exposed: {
|
|
50
|
+
InvitationHostService: schema.getService('dxos.halo.invitations.InvitationHostService'),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public hasFlowLock(): boolean {
|
|
56
|
+
return this._invitationFlowLock != null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected override async getHandlers(): Promise<{ InvitationHostService: InvitationHostService }> {
|
|
60
|
+
return {
|
|
61
|
+
InvitationHostService: {
|
|
62
|
+
options: async (options) => {
|
|
63
|
+
invariant(!this._remoteOptions, 'Remote options already set.');
|
|
64
|
+
this._remoteOptions = options;
|
|
65
|
+
this._remoteOptionsTrigger.wake();
|
|
66
|
+
},
|
|
67
|
+
introduce: () => {
|
|
68
|
+
throw new Error('Method not allowed.');
|
|
69
|
+
},
|
|
70
|
+
authenticate: () => {
|
|
71
|
+
throw new Error('Method not allowed.');
|
|
72
|
+
},
|
|
73
|
+
admit: () => {
|
|
74
|
+
throw new Error('Method not allowed.');
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
override async onOpen(context: ExtensionContext) {
|
|
81
|
+
await super.onOpen(context);
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
log('guest acquire lock');
|
|
85
|
+
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
86
|
+
log('guest lock acquired');
|
|
87
|
+
await cancelWithContext(this._ctx, this.rpc.InvitationHostService.options({ role: Options.Role.GUEST }));
|
|
88
|
+
log('options sent');
|
|
89
|
+
await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT }));
|
|
90
|
+
log('options received');
|
|
91
|
+
if (this._remoteOptions?.role !== Options.Role.HOST) {
|
|
92
|
+
throw new InvalidInvitationExtensionRoleError(undefined, {
|
|
93
|
+
expected: Options.Role.HOST,
|
|
94
|
+
remoteOptions: this._remoteOptions,
|
|
95
|
+
remotePeerId: context.remotePeerId,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this._callbacks.onOpen(this._ctx, context);
|
|
100
|
+
} catch (err: any) {
|
|
101
|
+
if (this._invitationFlowLock != null) {
|
|
102
|
+
this._callbacks.onError(err);
|
|
103
|
+
}
|
|
104
|
+
if (!this._ctx.disposed) {
|
|
105
|
+
context.close(err);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
override async onClose() {
|
|
111
|
+
await this._destroy();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
override async onAbort(): Promise<void> {
|
|
115
|
+
await this._destroy();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private async _destroy() {
|
|
119
|
+
await this._ctx.dispose();
|
|
120
|
+
if (this._invitationFlowLock != null) {
|
|
121
|
+
this._invitationFlowLock.release();
|
|
122
|
+
this._invitationFlowLock = null;
|
|
123
|
+
log('invitation flow lock released');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|