@dxos/client-services 0.1.26 → 0.1.27-next.a0dff21
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-R2FEBB66.mjs → chunk-OTSGRZZI.mjs} +796 -579
- package/dist/lib/browser/chunk-OTSGRZZI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +19 -15
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +46 -46
- package/dist/lib/browser/packlets/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +864 -641
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +753 -631
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/packlets/deprecated/index.d.ts +0 -3
- package/dist/types/src/packlets/deprecated/index.d.ts.map +1 -1
- package/dist/types/src/packlets/{identity/devices-service-impl.d.ts → devices/devices-service.d.ts} +4 -3
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -0
- package/dist/types/src/packlets/devices/index.d.ts +2 -0
- package/dist/types/src/packlets/devices/index.d.ts.map +1 -0
- package/dist/types/src/packlets/identity/authenticator.d.ts +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -0
- 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/identity/index.d.ts +1 -0
- package/dist/types/src/packlets/identity/index.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/{halo-invitations-handler.d.ts → device-invitations-handler.d.ts} +5 -5
- package/dist/types/src/packlets/invitations/device-invitations-handler.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/device-invitations-handler.test.d.ts +2 -0
- package/dist/types/src/packlets/invitations/device-invitations-handler.test.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/{halo-invitations-proxy.d.ts → device-invitations-proxy.d.ts} +2 -2
- package/dist/types/src/packlets/invitations/device-invitations-proxy.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/{halo-invitations-service.d.ts → device-invitations-service.d.ts} +2 -2
- package/dist/types/src/packlets/invitations/device-invitations-service.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/device-invitations-service.test.d.ts +2 -0
- package/dist/types/src/packlets/invitations/device-invitations-service.test.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/index.d.ts +3 -3
- package/dist/types/src/packlets/invitations/index.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +6 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/services/index.d.ts +0 -1
- package/dist/types/src/packlets/services/index.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +3 -3
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-definitions.d.ts +5 -7
- package/dist/types/src/packlets/services/service-definitions.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 +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +12 -5
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/system/index.d.ts +2 -0
- package/dist/types/src/packlets/system/index.d.ts.map +1 -0
- package/dist/types/src/packlets/system/system-service.d.ts +28 -0
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -0
- package/dist/types/src/packlets/system/system-service.test.d.ts +2 -0
- package/dist/types/src/packlets/system/system-service.test.d.ts.map +1 -0
- package/dist/types/src/packlets/testing/index.d.ts +1 -1
- package/dist/types/src/packlets/testing/index.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +11 -4
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +6 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/index.d.ts +2 -0
- package/dist/types/src/packlets/vault/index.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/services.d.ts +9 -1
- package/dist/types/src/packlets/vault/services.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-controller.d.ts +18 -0
- package/dist/types/src/packlets/vault/shell-controller.d.ts.map +1 -0
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +45 -0
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -0
- package/dist/types/src/packlets/vault/worker-runtime.d.ts +2 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts +4 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +29 -28
- package/src/index.ts +0 -1
- package/src/packlets/deprecated/index.ts +0 -3
- package/src/packlets/{identity/devices-service-impl.ts → devices/devices-service.ts} +10 -8
- package/src/packlets/devices/index.ts +5 -0
- package/src/packlets/devtools/spaces.ts +1 -1
- package/src/packlets/identity/authenticator.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +2 -2
- package/src/packlets/identity/identity-service.ts +67 -0
- package/src/packlets/identity/identity.test.ts +1 -1
- package/src/packlets/identity/identity.ts +1 -1
- package/src/packlets/identity/index.ts +1 -0
- package/src/packlets/invitations/{halo-invitations-handler.test.ts → device-invitations-handler.test.ts} +2 -2
- package/src/packlets/invitations/{halo-invitations-handler.ts → device-invitations-handler.ts} +4 -4
- package/src/packlets/invitations/{halo-invitations-proxy.ts → device-invitations-proxy.ts} +1 -1
- package/src/packlets/invitations/{halo-invitations-service.test.ts → device-invitations-service.test.ts} +10 -10
- package/src/packlets/invitations/{halo-invitations-service.ts → device-invitations-service.ts} +1 -1
- package/src/packlets/invitations/index.ts +3 -3
- package/src/packlets/invitations/invitations-handler.ts +6 -0
- package/src/packlets/invitations/invitations-service.ts +2 -2
- package/src/packlets/invitations/space-invitations-handler.test.ts +1 -1
- package/src/packlets/invitations/space-invitations-handler.ts +55 -20
- package/src/packlets/services/index.ts +0 -1
- package/src/packlets/services/service-context.test.ts +3 -3
- package/src/packlets/services/service-context.ts +5 -5
- package/src/packlets/services/service-definitions.ts +14 -14
- package/src/packlets/services/service-host.test.ts +9 -9
- package/src/packlets/services/service-host.ts +40 -25
- package/src/packlets/spaces/data-space-manager.test.ts +1 -1
- package/src/packlets/spaces/data-space-manager.ts +4 -4
- package/src/packlets/spaces/data-space.ts +3 -3
- package/src/packlets/spaces/spaces-service.ts +93 -11
- package/src/packlets/system/index.ts +5 -0
- package/src/packlets/system/system-service.test.ts +80 -0
- package/src/packlets/system/system-service.ts +70 -0
- package/src/packlets/testing/index.ts +1 -1
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/packlets/vault/iframe-host-runtime.ts +28 -10
- package/src/packlets/vault/iframe-proxy-runtime.ts +16 -1
- package/src/packlets/vault/index.ts +2 -0
- package/src/packlets/vault/services.ts +17 -1
- package/src/packlets/vault/shell-controller.ts +56 -0
- package/src/packlets/vault/shell-runtime.ts +121 -0
- package/src/packlets/vault/worker-runtime.ts +3 -1
- package/src/packlets/vault/worker-session.ts +28 -19
- package/dist/lib/browser/chunk-R2FEBB66.mjs.map +0 -7
- package/dist/types/src/packlets/deprecated/invitations.d.ts +0 -47
- package/dist/types/src/packlets/deprecated/invitations.d.ts.map +0 -1
- package/dist/types/src/packlets/deprecated/profile.d.ts +0 -18
- package/dist/types/src/packlets/deprecated/profile.d.ts.map +0 -1
- package/dist/types/src/packlets/deprecated/space.d.ts +0 -23
- package/dist/types/src/packlets/deprecated/space.d.ts.map +0 -1
- package/dist/types/src/packlets/deprecated/system.d.ts +0 -24
- package/dist/types/src/packlets/deprecated/system.d.ts.map +0 -1
- package/dist/types/src/packlets/identity/devices-service-impl.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/halo-invitations-handler.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/halo-invitations-handler.test.d.ts +0 -2
- package/dist/types/src/packlets/invitations/halo-invitations-handler.test.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/halo-invitations-proxy.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/halo-invitations-service.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/halo-invitations-service.test.d.ts +0 -2
- package/dist/types/src/packlets/invitations/halo-invitations-service.test.d.ts.map +0 -1
- package/dist/types/src/packlets/services/signer.d.ts +0 -6
- package/dist/types/src/packlets/services/signer.d.ts.map +0 -1
- package/src/packlets/deprecated/invitations.ts +0 -63
- package/src/packlets/deprecated/profile.ts +0 -85
- package/src/packlets/deprecated/space.ts +0 -258
- package/src/packlets/deprecated/system.ts +0 -48
- package/src/packlets/services/signer.ts +0 -11
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { SecretProvider, SecretValidator } from '@dxos/credentials';
|
|
2
|
-
/**
|
|
3
|
-
* Defines a way for peers to authenticate each other through a side channel.
|
|
4
|
-
*/
|
|
5
|
-
export interface InvitationAuthenticator {
|
|
6
|
-
secretProvider?: SecretProvider;
|
|
7
|
-
secretValidator: SecretValidator;
|
|
8
|
-
}
|
|
9
|
-
export declare const defaultInvitationAuthenticator: Required<InvitationAuthenticator>;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
*/
|
|
13
|
-
export interface InvitationOptions {
|
|
14
|
-
/**
|
|
15
|
-
* A function to be called when the invitation is closed (successfully or not).
|
|
16
|
-
*/
|
|
17
|
-
onFinish?: ({ expired }: {
|
|
18
|
-
expired?: boolean;
|
|
19
|
-
}) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Date.now()-style timestamp of when this invitation should expire.
|
|
22
|
-
*/
|
|
23
|
-
expiration?: number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
*/
|
|
28
|
-
export declare type InviterInvitation = {
|
|
29
|
-
invitationCode: string;
|
|
30
|
-
secret: Uint8Array | undefined;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated
|
|
34
|
-
*/
|
|
35
|
-
export declare type InviteeInvitation = {
|
|
36
|
-
secret?: Uint8Array | undefined;
|
|
37
|
-
secretTrigger?: () => void;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated
|
|
41
|
-
*/
|
|
42
|
-
export declare type InviterInvitations = InviterInvitation[];
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated
|
|
45
|
-
*/
|
|
46
|
-
export declare type InviteeInvitations = Map<string, InviteeInvitation>;
|
|
47
|
-
//# sourceMappingURL=invitations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/deprecated/invitations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiD,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMnH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,uBAAuB,CAG5E,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAExD;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,oBAAY,iBAAiB,GAAG;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,oBAAY,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,oBAAY,kBAAkB,GAAG,iBAAiB,EAAE,CAAC;AAErD;;GAEG;AACH,oBAAY,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
-
import { CreateProfileRequest, Profile, ProfileService, RecoverProfileRequest, SignPresentationRequest, SubscribeProfileResponse } from '@dxos/protocols/proto/dxos/client';
|
|
3
|
-
import { Presentation } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
4
|
-
import { ServiceContext } from '../services';
|
|
5
|
-
/**
|
|
6
|
-
* Profile service implementation.
|
|
7
|
-
* @deprecated
|
|
8
|
-
*/
|
|
9
|
-
export declare class ProfileServiceImpl implements ProfileService {
|
|
10
|
-
private readonly context;
|
|
11
|
-
private inviteeInvitations;
|
|
12
|
-
constructor(context: ServiceContext);
|
|
13
|
-
subscribeProfile(): Stream<SubscribeProfileResponse>;
|
|
14
|
-
createProfile(request: CreateProfileRequest): Promise<Profile>;
|
|
15
|
-
recoverProfile(request: RecoverProfileRequest): Promise<Profile>;
|
|
16
|
-
signPresentation({ presentation, nonce }: SignPresentationRequest): Promise<Presentation>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/deprecated/profile.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EACL,oBAAoB,EACpB,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IAG3C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,kBAAkB,CAAiC;gBAE9B,OAAO,EAAE,cAAc;IAEpD,gBAAgB,IAAI,MAAM,CAAC,wBAAwB,CAAC;IAmB9C,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IAY9D,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IAYhE,gBAAgB,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC;CAUhG"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
-
import { AuthenticateInvitationRequest, CreateSnapshotRequest, GetSpaceDetailsRequest, Space, SpaceDetails, SpaceService, SetSpaceStateRequest, SubscribeMembersRequest, SubscribeMembersResponse, SubscribeSpacesResponse, SubscribeSpaceRequest, SubscribeSpaceResponse } from '@dxos/protocols/proto/dxos/client';
|
|
3
|
-
import { SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
|
|
4
|
-
import { ServiceContext } from '../services';
|
|
5
|
-
/**
|
|
6
|
-
* Space service implementation.
|
|
7
|
-
* @deprecated
|
|
8
|
-
*/
|
|
9
|
-
export declare class SpaceServiceImpl implements SpaceService {
|
|
10
|
-
private readonly serviceContext;
|
|
11
|
-
private inviteeInvitations;
|
|
12
|
-
constructor(serviceContext: ServiceContext);
|
|
13
|
-
subscribeToSpace(request: SubscribeSpaceRequest): Stream<SubscribeSpaceResponse>;
|
|
14
|
-
subscribeSpaces(): Stream<SubscribeSpacesResponse>;
|
|
15
|
-
getSpaceDetails(request: GetSpaceDetailsRequest): Promise<SpaceDetails>;
|
|
16
|
-
createSpace(): Promise<Space>;
|
|
17
|
-
cloneSpace(snapshot: SpaceSnapshot): Promise<Space>;
|
|
18
|
-
setSpaceState(request: SetSpaceStateRequest): Promise<never>;
|
|
19
|
-
authenticateInvitation(request: AuthenticateInvitationRequest): Promise<void>;
|
|
20
|
-
subscribeMembers(request: SubscribeMembersRequest): Stream<SubscribeMembersResponse>;
|
|
21
|
-
createSnapshot(request: CreateSnapshotRequest): Promise<SpaceSnapshot>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=space.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/deprecated/space.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,EAEL,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAGvC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAF3C,OAAO,CAAC,kBAAkB,CAAiC;gBAE9B,cAAc,EAAE,cAAc;IAE3D,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAAC,sBAAsB,CAAC;IAuDhF,eAAe;IA2DT,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC;IAQvE,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;IAa7B,UAAU,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC;IAUnD,aAAa,CAAC,OAAO,EAAE,oBAAoB;IA+B3C,sBAAsB,CAAC,OAAO,EAAE,6BAA6B;IAWnE,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAAC,wBAAwB,CAAC;IAyB9E,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;CAM7E"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Config } from '@dxos/config';
|
|
2
|
-
import { StatusResponse, SystemService } from '@dxos/protocols/proto/dxos/client';
|
|
3
|
-
import { MaybePromise } from '@dxos/util';
|
|
4
|
-
export declare type SystemServiceOptions = {
|
|
5
|
-
config: Config;
|
|
6
|
-
onInit: () => MaybePromise<void>;
|
|
7
|
-
onStatus: () => MaybePromise<StatusResponse>;
|
|
8
|
-
onReset: () => MaybePromise<void>;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
*/
|
|
13
|
-
export declare class SystemServiceImpl implements SystemService {
|
|
14
|
-
private readonly _config;
|
|
15
|
-
private readonly _onInit;
|
|
16
|
-
private readonly _onStatus;
|
|
17
|
-
private readonly _onReset;
|
|
18
|
-
constructor({ config, onInit, onStatus, onReset }: SystemServiceOptions);
|
|
19
|
-
getConfig(): Promise<import("@dxos/config").ConfigProto>;
|
|
20
|
-
getStatus(): Promise<StatusResponse>;
|
|
21
|
-
initSession(): Promise<void>;
|
|
22
|
-
reset(): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=system.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/deprecated/system.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,oBAAY,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;IAC/D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2B;gBAExC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,oBAAoB;IAOjE,SAAS;IAKT,SAAS;IAIT,WAAW;IAIX,KAAK;CAGZ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devices-service-impl.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/devices-service-impl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAE1G,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,kBAAmB,YAAW,cAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,eAAe;IAE9D,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAI/B,YAAY,IAAI,MAAM,CAAC,oBAAoB,CAAC;CAmC7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"halo-invitations-handler.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/halo-invitations-handler.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAiC,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAEpG,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAUxE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,gCAAgC,EAEhC,+BAA+B,EAIhC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEvF,aAAK,4BAA4B,GAAG;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IAEjB,WAAW,EAAE,MAAM,QAAQ,CAAC;IAC5B,cAAc,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CACrE,CAAC;AAEF;;GAEG;AAEH,qBAAa,sBAAuB,SAAQ,0BAA0B;IAGlE,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,4BAA4B;IAKxD;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,+BAA+B;IAmH9F;;;;OAIG;IACH,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,gCAAgC;CAkHzG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"halo-invitations-handler.test.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/halo-invitations-handler.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"halo-invitations-proxy.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/halo-invitations-proxy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,wBAAwB;IAChE,oBAAoB;CAGrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"halo-invitations-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/halo-invitations-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,0BAA0B;IAItE,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBADnC,eAAe,EAAE,eAAe,EACf,kBAAkB,EAAE,kBAAkB;IAKhD,UAAU,CAAC,UAAU,EAAE,UAAU;CAC3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"halo-invitations-service.test.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/halo-invitations-service.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SignRequest, SignResponse } from '@dxos/protocols/proto/dxos/client';
|
|
2
|
-
import { KeyRecord } from '@dxos/protocols/proto/dxos/halo/keys';
|
|
3
|
-
export interface HaloSigner {
|
|
4
|
-
sign: (request: SignRequest, key: KeyRecord) => Promise<SignResponse>;
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/signer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGjE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACvE"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2020 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defaultSecretProvider, defaultSecretValidator, SecretProvider, SecretValidator } from '@dxos/credentials';
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
// TODO(burdon): Deprecated pending new invitations.
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Defines a way for peers to authenticate each other through a side channel.
|
|
13
|
-
*/
|
|
14
|
-
export interface InvitationAuthenticator {
|
|
15
|
-
secretProvider?: SecretProvider;
|
|
16
|
-
secretValidator: SecretValidator;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const defaultInvitationAuthenticator: Required<InvitationAuthenticator> = {
|
|
20
|
-
secretProvider: defaultSecretProvider,
|
|
21
|
-
secretValidator: defaultSecretValidator
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated
|
|
26
|
-
*/
|
|
27
|
-
export interface InvitationOptions {
|
|
28
|
-
/**
|
|
29
|
-
* A function to be called when the invitation is closed (successfully or not).
|
|
30
|
-
*/
|
|
31
|
-
onFinish?: ({ expired }: { expired?: boolean }) => void;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Date.now()-style timestamp of when this invitation should expire.
|
|
35
|
-
*/
|
|
36
|
-
expiration?: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated
|
|
41
|
-
*/
|
|
42
|
-
export type InviterInvitation = {
|
|
43
|
-
invitationCode: string;
|
|
44
|
-
secret: Uint8Array | undefined;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated
|
|
49
|
-
*/
|
|
50
|
-
export type InviteeInvitation = {
|
|
51
|
-
secret?: Uint8Array | undefined; // Can be undefined initially, then set after receiving secret from the inviter.
|
|
52
|
-
secretTrigger?: () => void; // Is triggered after supplying the secret.
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @deprecated
|
|
57
|
-
*/
|
|
58
|
-
export type InviterInvitations = InviterInvitation[];
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated
|
|
62
|
-
*/
|
|
63
|
-
export type InviteeInvitations = Map<string, InviteeInvitation>;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import assert from 'node:assert';
|
|
6
|
-
|
|
7
|
-
import { Stream } from '@dxos/codec-protobuf';
|
|
8
|
-
import { signPresentation } from '@dxos/credentials';
|
|
9
|
-
import { todo } from '@dxos/debug';
|
|
10
|
-
import {
|
|
11
|
-
CreateProfileRequest,
|
|
12
|
-
Profile,
|
|
13
|
-
ProfileService,
|
|
14
|
-
RecoverProfileRequest,
|
|
15
|
-
SignPresentationRequest,
|
|
16
|
-
SubscribeProfileResponse
|
|
17
|
-
} from '@dxos/protocols/proto/dxos/client';
|
|
18
|
-
import { Presentation } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
19
|
-
|
|
20
|
-
import { ServiceContext } from '../services';
|
|
21
|
-
import { InviteeInvitations } from './invitations';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Profile service implementation.
|
|
25
|
-
* @deprecated
|
|
26
|
-
*/
|
|
27
|
-
export class ProfileServiceImpl implements ProfileService {
|
|
28
|
-
private inviteeInvitations: InviteeInvitations = new Map();
|
|
29
|
-
|
|
30
|
-
constructor(private readonly context: ServiceContext) {}
|
|
31
|
-
|
|
32
|
-
subscribeProfile(): Stream<SubscribeProfileResponse> {
|
|
33
|
-
return new Stream(({ next }) => {
|
|
34
|
-
const emitNext = () =>
|
|
35
|
-
next({
|
|
36
|
-
profile: this.context.identityManager.identity
|
|
37
|
-
? {
|
|
38
|
-
identityKey: this.context.identityManager.identity.identityKey,
|
|
39
|
-
deviceKey: this.context.identityManager.identity.deviceKey,
|
|
40
|
-
displayName: this.context.identityManager.identity.profileDocument?.displayName,
|
|
41
|
-
haloSpace: this.context.identityManager.identity.space.key
|
|
42
|
-
}
|
|
43
|
-
: undefined
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
emitNext();
|
|
47
|
-
return this.context.identityManager.stateUpdate.on(emitNext);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async createProfile(request: CreateProfileRequest): Promise<Profile> {
|
|
52
|
-
await this.context.createIdentity({
|
|
53
|
-
displayName: request.displayName
|
|
54
|
-
});
|
|
55
|
-
return {
|
|
56
|
-
identityKey: this.context.identityManager.identity!.identityKey,
|
|
57
|
-
deviceKey: this.context.identityManager.identity!.deviceKey,
|
|
58
|
-
displayName: this.context.identityManager.identity!.profileDocument?.displayName,
|
|
59
|
-
haloSpace: this.context.identityManager.identity!.space.key
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async recoverProfile(request: RecoverProfileRequest): Promise<Profile> {
|
|
64
|
-
return todo();
|
|
65
|
-
if (!request.seedPhrase) {
|
|
66
|
-
throw new Error('Recovery SeedPhrase not provided.');
|
|
67
|
-
}
|
|
68
|
-
// await this.echo.open();
|
|
69
|
-
// await this.echo.halo.recover(request.seed_phrase);
|
|
70
|
-
// const profile = this.echo.halo.getProfile();
|
|
71
|
-
// assert(profile, 'Recovering profile failed.');
|
|
72
|
-
// return profile;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async signPresentation({ presentation, nonce }: SignPresentationRequest): Promise<Presentation> {
|
|
76
|
-
assert(this.context.identityManager.identity, 'Identity not initialized.');
|
|
77
|
-
return await signPresentation({
|
|
78
|
-
presentation,
|
|
79
|
-
signer: this.context.keyring,
|
|
80
|
-
signerKey: this.context.identityManager.identity.deviceKey,
|
|
81
|
-
chain: this.context.identityManager.identity.deviceCredentialChain,
|
|
82
|
-
nonce
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import assert from 'node:assert';
|
|
6
|
-
|
|
7
|
-
import { Stream } from '@dxos/codec-protobuf';
|
|
8
|
-
import { todo } from '@dxos/debug';
|
|
9
|
-
import { log } from '@dxos/log';
|
|
10
|
-
import {
|
|
11
|
-
AuthenticateInvitationRequest,
|
|
12
|
-
CreateSnapshotRequest,
|
|
13
|
-
GetSpaceDetailsRequest,
|
|
14
|
-
Space,
|
|
15
|
-
SpaceMember,
|
|
16
|
-
SpaceDetails,
|
|
17
|
-
SpaceService,
|
|
18
|
-
SetSpaceStateRequest,
|
|
19
|
-
SubscribeMembersRequest,
|
|
20
|
-
SubscribeMembersResponse,
|
|
21
|
-
SubscribeSpacesResponse,
|
|
22
|
-
SubscribeSpaceRequest,
|
|
23
|
-
SubscribeSpaceResponse
|
|
24
|
-
} from '@dxos/protocols/proto/dxos/client';
|
|
25
|
-
import { SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
|
|
26
|
-
import { humanize } from '@dxos/util';
|
|
27
|
-
|
|
28
|
-
import { ServiceContext } from '../services';
|
|
29
|
-
import { InviteeInvitations } from './invitations';
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Space service implementation.
|
|
33
|
-
* @deprecated
|
|
34
|
-
*/
|
|
35
|
-
export class SpaceServiceImpl implements SpaceService {
|
|
36
|
-
private inviteeInvitations: InviteeInvitations = new Map();
|
|
37
|
-
|
|
38
|
-
constructor(private readonly serviceContext: ServiceContext) {}
|
|
39
|
-
|
|
40
|
-
subscribeToSpace(request: SubscribeSpaceRequest): Stream<SubscribeSpaceResponse> {
|
|
41
|
-
return new Stream(({ next }) => {
|
|
42
|
-
next({
|
|
43
|
-
space: {
|
|
44
|
-
publicKey: request.spaceKey,
|
|
45
|
-
isOpen: true,
|
|
46
|
-
isActive: true,
|
|
47
|
-
members: []
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// const update = (next: (message: SubscribeSpaceResponse) => void) => {
|
|
53
|
-
// try {
|
|
54
|
-
// const space = this.echo.getSpace(request.space_key);
|
|
55
|
-
// next({
|
|
56
|
-
// space: space && {
|
|
57
|
-
// public_key: space.key,
|
|
58
|
-
// is_open: space.is_open,
|
|
59
|
-
// is_active: space.is_active,
|
|
60
|
-
// members: space.queryMembers().value
|
|
61
|
-
// }
|
|
62
|
-
// });
|
|
63
|
-
// } catch (err) {
|
|
64
|
-
// if (err instanceof InvalidStateError) {
|
|
65
|
-
// // Do nothing.
|
|
66
|
-
// } else {
|
|
67
|
-
// throw err;
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
// };
|
|
71
|
-
|
|
72
|
-
// const space = this.serviceContext.brane.getSpace(request.space_key);
|
|
73
|
-
// if (space) {
|
|
74
|
-
// return new Stream(({ next }) => space.update.on(() => update(next)));
|
|
75
|
-
// } else {
|
|
76
|
-
// return new Stream(({ next }) => {
|
|
77
|
-
// let unsubscribeSpace: () => void;
|
|
78
|
-
// const unsubscribeSpaces = this.echo.querySpaces().subscribe((spaces) => {
|
|
79
|
-
// const space = spaces.find((space) => space.key.equals(request.space_key));
|
|
80
|
-
// if (space && !unsubscribeSpace) {
|
|
81
|
-
// unsubscribeSpace = space.update.on(() => update(next));
|
|
82
|
-
// }
|
|
83
|
-
// });
|
|
84
|
-
|
|
85
|
-
// update(next);
|
|
86
|
-
|
|
87
|
-
// return () => {
|
|
88
|
-
// unsubscribeSpaces();
|
|
89
|
-
// unsubscribeSpace?.();
|
|
90
|
-
// };
|
|
91
|
-
// });
|
|
92
|
-
// }
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
subscribeSpaces() {
|
|
96
|
-
return new Stream<SubscribeSpacesResponse>(({ next, ctx }) => {
|
|
97
|
-
const onUpdate = () => {
|
|
98
|
-
const spaces = Array.from(this.serviceContext.dataSpaceManager!.spaces.values())
|
|
99
|
-
.filter((space) => this.serviceContext.dataServiceSubscriptions.getDataService(space.key)) // Skip spaces without data service available.
|
|
100
|
-
.map(
|
|
101
|
-
(space): Space => ({
|
|
102
|
-
publicKey: space.key,
|
|
103
|
-
isOpen: true,
|
|
104
|
-
isActive: true,
|
|
105
|
-
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
106
|
-
identityKey: member.key,
|
|
107
|
-
profile: {
|
|
108
|
-
identityKey: member.key,
|
|
109
|
-
displayName: member.assertion.profile?.displayName ?? humanize(member.key)
|
|
110
|
-
},
|
|
111
|
-
presence:
|
|
112
|
-
this.serviceContext.identityManager.identity?.identityKey.equals(member.key) ||
|
|
113
|
-
space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0
|
|
114
|
-
? SpaceMember.PresenceState.ONLINE
|
|
115
|
-
: SpaceMember.PresenceState.OFFLINE
|
|
116
|
-
}))
|
|
117
|
-
})
|
|
118
|
-
);
|
|
119
|
-
log('update', { spaces });
|
|
120
|
-
next({ spaces });
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
setTimeout(async () => {
|
|
124
|
-
if (!this.serviceContext.dataSpaceManager) {
|
|
125
|
-
next({ spaces: [] });
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
await this.serviceContext.initialized.wait();
|
|
129
|
-
|
|
130
|
-
// TODO(dmaretskyi): Create a pattern for subscribing to a set of objects.
|
|
131
|
-
const subscribeSpaces = () => {
|
|
132
|
-
for (const space of this.serviceContext.dataSpaceManager!.spaces.values()) {
|
|
133
|
-
if (!this.serviceContext.dataServiceSubscriptions.getDataService(space.key)) {
|
|
134
|
-
// Skip spaces without data service available.
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
space.stateUpdate.on(ctx, onUpdate);
|
|
139
|
-
space.presence.updated.on(ctx, onUpdate);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
this.serviceContext.dataSpaceManager!.updated.on(ctx, () => {
|
|
144
|
-
subscribeSpaces();
|
|
145
|
-
onUpdate();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
subscribeSpaces();
|
|
149
|
-
onUpdate();
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
async getSpaceDetails(request: GetSpaceDetailsRequest): Promise<SpaceDetails> {
|
|
155
|
-
return todo();
|
|
156
|
-
// const space = this.echo.getSpace(request.space_key) ?? raise(new SpaceNotFoundError(request.space_key));
|
|
157
|
-
// return {
|
|
158
|
-
// processedTimeframe: space.timeframe
|
|
159
|
-
// };
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async createSpace(): Promise<Space> {
|
|
163
|
-
if (!this.serviceContext.identityManager.identity) {
|
|
164
|
-
throw new Error('This device has no HALO identity available. See https://docs.dxos.org/guide/halo');
|
|
165
|
-
}
|
|
166
|
-
await this.serviceContext.initialized.wait();
|
|
167
|
-
const space = await this.serviceContext.dataSpaceManager!.createSpace();
|
|
168
|
-
return {
|
|
169
|
-
publicKey: space.key,
|
|
170
|
-
isOpen: true,
|
|
171
|
-
isActive: true
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
async cloneSpace(snapshot: SpaceSnapshot): Promise<Space> {
|
|
176
|
-
return todo();
|
|
177
|
-
// const space = await this.echo.cloneSpace(snapshot);
|
|
178
|
-
// return {
|
|
179
|
-
// public_key: space.key,
|
|
180
|
-
// is_open: space.is_open,
|
|
181
|
-
// is_active: space.is_active
|
|
182
|
-
// };
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async setSpaceState(request: SetSpaceStateRequest) {
|
|
186
|
-
return todo();
|
|
187
|
-
// const space = this.echo.getSpace(request.space_key);
|
|
188
|
-
// if (!space) {
|
|
189
|
-
// throw new Error('Space not found');
|
|
190
|
-
// }
|
|
191
|
-
|
|
192
|
-
// if (request.open === true) {
|
|
193
|
-
// await space.open();
|
|
194
|
-
// } else if (request.open === false) {
|
|
195
|
-
// await space.close();
|
|
196
|
-
// } // Undefined preserves previous state.
|
|
197
|
-
|
|
198
|
-
// if (request.active_global === true) {
|
|
199
|
-
// await space.activate({ global: true });
|
|
200
|
-
// } else if (request.active_global === false) {
|
|
201
|
-
// await space.deactivate({ global: true });
|
|
202
|
-
// } // Undefined preserves previous state.
|
|
203
|
-
|
|
204
|
-
// if (request.active_device === true) {
|
|
205
|
-
// await space.activate({ device: true });
|
|
206
|
-
// } else if (request.active_device === false) {
|
|
207
|
-
// await space.deactivate({ device: true });
|
|
208
|
-
// } // Undefined preserves previous state.
|
|
209
|
-
// return {
|
|
210
|
-
// public_key: space.key,
|
|
211
|
-
// is_open: space.is_open,
|
|
212
|
-
// is_active: space.is_active
|
|
213
|
-
// };
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
async authenticateInvitation(request: AuthenticateInvitationRequest) {
|
|
217
|
-
assert(request.processId, 'Process ID is missing.');
|
|
218
|
-
const invitation = this.inviteeInvitations.get(request.processId);
|
|
219
|
-
assert(invitation, 'Invitation not found.');
|
|
220
|
-
assert(request.secret, 'Secret not provided.');
|
|
221
|
-
|
|
222
|
-
// Supply the secret, and move the internal invitation process by triggering the secretTrigger.
|
|
223
|
-
invitation.secret = request.secret;
|
|
224
|
-
invitation.secretTrigger?.();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
subscribeMembers(request: SubscribeMembersRequest): Stream<SubscribeMembersResponse> {
|
|
228
|
-
return todo();
|
|
229
|
-
// const space = this.echo.getSpace(request.space_key);
|
|
230
|
-
// if (space) {
|
|
231
|
-
// return resultSetToStream(space.queryMembers(), (members): SubscribeMembersResponse => ({ members }));
|
|
232
|
-
// } else {
|
|
233
|
-
// return new Stream(({ next }) => {
|
|
234
|
-
// let unsubscribeMembers: () => void;
|
|
235
|
-
// const unsubscribeSpaces = this.echo.querySpaces().subscribe((spaces) => {
|
|
236
|
-
// const space = spaces.find((space) => space.key.equals(request.space_key));
|
|
237
|
-
// if (!unsubscribeMembers && space) {
|
|
238
|
-
// const resultSet = space.queryMembers();
|
|
239
|
-
// next({ members: resultSet.value });
|
|
240
|
-
// unsubscribeMembers = resultSet.update.on(() => next({ members: resultSet.value }));
|
|
241
|
-
// }
|
|
242
|
-
// });
|
|
243
|
-
|
|
244
|
-
// return () => {
|
|
245
|
-
// unsubscribeSpaces();
|
|
246
|
-
// unsubscribeMembers();
|
|
247
|
-
// };
|
|
248
|
-
// });
|
|
249
|
-
// }
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
async createSnapshot(request: CreateSnapshotRequest): Promise<SpaceSnapshot> {
|
|
253
|
-
return todo();
|
|
254
|
-
// assert(request.space_key);
|
|
255
|
-
// const space = this.echo.getSpace(request.space_key) ?? raise(new SpaceNotFoundError(request.space_key));
|
|
256
|
-
// return space.createSnapshot();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Config } from '@dxos/config';
|
|
6
|
-
import { StatusResponse, SystemService } from '@dxos/protocols/proto/dxos/client';
|
|
7
|
-
import { MaybePromise } from '@dxos/util';
|
|
8
|
-
|
|
9
|
-
export type SystemServiceOptions = {
|
|
10
|
-
config: Config;
|
|
11
|
-
onInit: () => MaybePromise<void>;
|
|
12
|
-
onStatus: () => MaybePromise<StatusResponse>;
|
|
13
|
-
onReset: () => MaybePromise<void>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated
|
|
18
|
-
*/
|
|
19
|
-
export class SystemServiceImpl implements SystemService {
|
|
20
|
-
private readonly _config: Config;
|
|
21
|
-
private readonly _onInit: () => MaybePromise<void>;
|
|
22
|
-
private readonly _onStatus: () => MaybePromise<StatusResponse>;
|
|
23
|
-
private readonly _onReset: () => MaybePromise<void>;
|
|
24
|
-
|
|
25
|
-
constructor({ config, onInit, onStatus, onReset }: SystemServiceOptions) {
|
|
26
|
-
this._config = config;
|
|
27
|
-
this._onInit = onInit;
|
|
28
|
-
this._onStatus = onStatus;
|
|
29
|
-
this._onReset = onReset;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async getConfig() {
|
|
33
|
-
return this._config.values;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// TODO(burdon): Connect to iframe RPC heartbeat for network status?
|
|
37
|
-
async getStatus() {
|
|
38
|
-
return this._onStatus();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async initSession() {
|
|
42
|
-
await this._onInit();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async reset() {
|
|
46
|
-
await this._onReset();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { SignRequest, SignResponse } from '@dxos/protocols/proto/dxos/client';
|
|
6
|
-
import { KeyRecord } from '@dxos/protocols/proto/dxos/halo/keys';
|
|
7
|
-
|
|
8
|
-
// TODO(burdon): Remove (was required for registry client).
|
|
9
|
-
export interface HaloSigner {
|
|
10
|
-
sign: (request: SignRequest, key: KeyRecord) => Promise<SignResponse>;
|
|
11
|
-
}
|