@dxos/client-services 0.1.56-main.a25bb93 → 0.1.56-main.ad054df
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-MAHWP5I6.mjs → chunk-U5CCSPX6.mjs} +215 -140
- package/dist/lib/browser/chunk-U5CCSPX6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -12
- 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 +2 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +210 -133
- 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 +197 -122
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts +2 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +3 -2
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +2 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +3 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +34 -33
- package/src/packlets/devices/devices-service.test.ts +2 -1
- package/src/packlets/identity/identity-manager.test.ts +4 -3
- package/src/packlets/identity/identity-manager.ts +9 -5
- package/src/packlets/identity/identity-service.test.ts +2 -1
- package/src/packlets/identity/identity.test.ts +7 -6
- package/src/packlets/identity/identity.ts +8 -3
- package/src/packlets/invitations/device-invitation-protocol.test.ts +2 -1
- package/src/packlets/network/network-service.test.ts +2 -1
- package/src/packlets/services/client-rpc-server.ts +4 -4
- package/src/packlets/services/service-context.ts +11 -6
- package/src/packlets/services/service-host.test.ts +6 -5
- package/src/packlets/services/service-host.ts +15 -3
- package/src/packlets/services/service-registry.test.ts +2 -1
- package/src/packlets/spaces/data-space.ts +1 -1
- package/src/packlets/spaces/spaces-service.test.ts +2 -1
- package/src/packlets/testing/test-builder.ts +1 -1
- package/src/packlets/vault/iframe-host-runtime.ts +2 -1
- package/src/packlets/vault/worker-runtime.ts +2 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-MAHWP5I6.mjs.map +0 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
|
+
import { Context } from '@dxos/context';
|
|
2
3
|
import { MetadataStore, SpaceManager } from '@dxos/echo-pipeline';
|
|
3
4
|
import { FeedStore } from '@dxos/feed-store';
|
|
4
5
|
import { Keyring } from '@dxos/keyring';
|
|
@@ -31,7 +32,7 @@ export declare class IdentityManager {
|
|
|
31
32
|
private _identity?;
|
|
32
33
|
constructor(_metadataStore: MetadataStore, _keyring: Keyring, _feedStore: FeedStore<FeedMessage>, _spaceManager: SpaceManager);
|
|
33
34
|
get identity(): Identity | undefined;
|
|
34
|
-
open(): Promise<void>;
|
|
35
|
+
open(ctx: Context): Promise<void>;
|
|
35
36
|
close(): Promise<void>;
|
|
36
37
|
createIdentity({ displayName }?: CreateIdentityOptions): Promise<Identity>;
|
|
37
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-manager.ts"],"names":[],"mappings":"AAIA,O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,EAAE,OAAO;IAoBjB,KAAK;IAIL,cAAc,CAAC,EAAE,WAAW,EAAE,GAAE,qBAA0B;IAmEhE;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,kBAAkB;YA+BjC,kBAAkB;YA2ClB,eAAe;CAc9B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
|
+
import { Context } from '@dxos/context';
|
|
2
3
|
import { CredentialSigner } from '@dxos/credentials';
|
|
3
4
|
import { Signer } from '@dxos/crypto';
|
|
4
5
|
import { Space } from '@dxos/echo-pipeline';
|
|
@@ -27,8 +28,8 @@ export declare class Identity {
|
|
|
27
28
|
readonly stateUpdate: Event<void>;
|
|
28
29
|
constructor({ space, signer, identityKey, deviceKey }: IdentityParams);
|
|
29
30
|
get authorizedDeviceKeys(): ComplexSet<PublicKey>;
|
|
30
|
-
open(): Promise<void>;
|
|
31
|
-
close(): Promise<void>;
|
|
31
|
+
open(ctx: Context): Promise<void>;
|
|
32
|
+
close(ctx: Context): Promise<void>;
|
|
32
33
|
ready(): Promise<void>;
|
|
33
34
|
get profileDocument(): ProfileDocument | undefined;
|
|
34
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAEL,gBAAgB,EAIjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAgB,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"identity.d.ts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G,EAAE,OAAO;IAOjB,KAAK,CAAC,GAAG,EAAE,OAAO;IAOlB,KAAK;IAMX,IAAI,eAAe,IAAI,eAAe,GAAG,SAAS,CAEjD;IAED;;OAEG;IACH,IAAI,eAAe,mDAElB;IAED,IAAI,YAAY,cAEf;IAED,IAAI,kBAAkB,cAErB;IAED,IAAI,qBAAqB,4EAExB;IAED,uBAAuB,IAAI,sBAAsB;IAQjD;;;OAGG;IACH,2BAA2B,IAAI,gBAAgB;IAS/C;;OAEG;IACH,yBAAyB,IAAI,gBAAgB;IAIvC,WAAW,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,sBAAsB;CA2CrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-rpc-server.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/client-rpc-server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAkB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAA4B,cAAc,
|
|
1
|
+
{"version":3,"file":"client-rpc-server.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/client-rpc-server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAkB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAA4B,cAAc,EAAiB,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,YAAY,CAAC,GAAG,CAAC,KACxD,OAAO,CAAC,GAAG,CAAC,CAAC;IAClB,YAAY,CAAC,EAAE,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,KAClD,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;CAChC,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,eAAe,CAAC,CAAC;AAE1D,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkC;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsC;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwC;gBAE1D,MAAM,EAAE,qBAAqB;IAgCnC,IAAI;IAIJ,KAAK;IAIX,OAAO,CAAC,kBAAkB;CAiB3B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Trigger } from '@dxos/async';
|
|
2
|
+
import { Context } from '@dxos/context';
|
|
2
3
|
import { MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from '@dxos/echo-pipeline';
|
|
3
4
|
import { FeedStore } from '@dxos/feed-store';
|
|
4
5
|
import { Keyring } from '@dxos/keyring';
|
|
@@ -38,7 +39,7 @@ export declare class ServiceContext {
|
|
|
38
39
|
private _deviceSpaceSync?;
|
|
39
40
|
private readonly _instanceId;
|
|
40
41
|
constructor(storage: Storage, networkManager: NetworkManager, signalManager: SignalManager, modelFactory: ModelFactory);
|
|
41
|
-
open(): Promise<void>;
|
|
42
|
+
open(ctx: Context): Promise<void>;
|
|
42
43
|
close(): Promise<void>;
|
|
43
44
|
createIdentity(params?: CreateIdentityOptions): Promise<import("../identity").Identity>;
|
|
44
45
|
getInvitationHandler(invitation: Partial<Invitation> & Pick<Invitation, 'kind'>): InvitationProtocol;
|
|
@@ -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;
|
|
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,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGjE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAsB,MAAM,aAAa,CAAC;AACzF,OAAO,EAEL,kBAAkB,EAClB,kBAAkB,EAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAkB,MAAM,WAAW,CAAC;AAE7D;;GAEG;AAEH,qBACa,cAAc;aA6BP,OAAO,EAAE,OAAO;aAChB,cAAc,EAAE,cAAc;aAC9B,aAAa,EAAE,aAAa;aAC5B,YAAY,EAAE,YAAY;IA/B5C,SAAgB,WAAW,gBAAiB;IAC5C,SAAgB,wBAAwB,2BAAkC;IAC1E,SAAgB,aAAa,EAAE,aAAa,CAAC;IAC7C;;OAEG;IACH,SAAgB,aAAa,EAAE,aAAa,CAAC;IAC7C,SAAgB,SAAS,EAAE,SAAS,CAAC;IACrC,SAAgB,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClD,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,YAAY,EAAE,YAAY,CAAC;IAC3C,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,WAAW,EAAE,kBAAkB,CAAC;IAGzC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAG9B;IAEJ,OAAO,CAAC,gBAAgB,CAAC,CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8B;gBAIxC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY;IAkDtC,IAAI,CAAC,GAAG,EAAE,OAAO;IAgBjB,KAAK;IAeL,cAAc,CAAC,MAAM,GAAE,qBAA0B;IAOvD,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,kBAAkB;YAMtF,eAAe;YAOf,oBAAoB;YAUpB,WAAW;CA6D1B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClientServices } from '@dxos/client-protocol';
|
|
2
2
|
import { Config } from '@dxos/config';
|
|
3
|
+
import { Context } from '@dxos/context';
|
|
3
4
|
import { SignalManager } from '@dxos/messaging';
|
|
4
5
|
import { ModelFactory } from '@dxos/model-factory';
|
|
5
6
|
import { TransportFactory } from '@dxos/network-manager';
|
|
@@ -37,6 +38,7 @@ export declare class ClientServicesHost {
|
|
|
37
38
|
private readonly _serviceRegistry;
|
|
38
39
|
private readonly _systemService;
|
|
39
40
|
private readonly _loggingService;
|
|
41
|
+
private readonly _tracingService;
|
|
40
42
|
private _config?;
|
|
41
43
|
private readonly _statusUpdate;
|
|
42
44
|
private readonly _modelFactory;
|
|
@@ -60,7 +62,7 @@ export declare class ClientServicesHost {
|
|
|
60
62
|
* Can only be called once.
|
|
61
63
|
*/
|
|
62
64
|
initialize({ config, ...options }: InitializeOptions): void;
|
|
63
|
-
open(): Promise<void>;
|
|
65
|
+
open(ctx: Context): Promise<void>;
|
|
64
66
|
close(): Promise<void>;
|
|
65
67
|
reset(): Promise<void>;
|
|
66
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMxC,OAAO,EAAE,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAgD,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGvG,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAetD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,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O,CAAC,UAAU,CAAC,CAA8B;IAEjD,OAAO,CAAC,eAAe,CAAkB;IAGzC,OAAO,CAAC,QAAQ,CAAS;IAGzB,OAAO,CAAC,KAAK,CAAS;gBAEV,EACV,MAAM,EACN,YAA0C,EAC1C,gBAAgB,EAChB,aAAa,EACb,OAAO,EAEP,OAAO,EACP,SAAS,GACV,GAAE,wBAA6B;IAgDhC,IAAI,MAAM,YAET;IAED,IAAI,MAAM,uBAET;IAED,IAAI,OAAO,mBAEV;IAED,IAAI,eAAe,oCAElB;IAED,IAAI,WAAW,sDAEd;IAED,IAAI,QAAQ,4BAEX;IAED;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,iBAAiB;IAiC9C,IAAI,CAAC,GAAG,EAAE,OAAO;IAyEjB,KAAK;IAeL,KAAK;CAWZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe-host-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/iframe-host-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"iframe-host-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/iframe-host-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAKtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAiB,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMjD,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAoC;IACpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE3D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAU;IACtC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,iBAAiB,CAAoB;IAG7C,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,UAAU,CAAmB;IACrC,OAAO,CAAC,aAAa,CAAC,CAAmB;IAGlC,MAAM,EAAE,MAAM,CAAC;gBAEV,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,uBAAuB;IAW3E,IAAI,QAAQ,uBAEX;IAED,IAAI,KAAK,IAAI,YAAY,GAAG,SAAS,CAEpC;IAEK,KAAK;IAmDL,IAAI;CAOX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/worker-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"worker-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/vault/worker-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAKtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,aAAa;IAUtB,OAAO,CAAC,QAAQ,CAAC,eAAe;IATlC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAqC;IACvE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;IACrD,OAAO,CAAC,qBAAqB,CAAC,CAAgB;IAC9C,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,OAAO,CAAU;gBAIN,eAAe,EAAE,MAAM,YAAY,CAAC,MAAM,CAAC;IAK9D,IAAI,IAAI,uBAEP;IAEK,KAAK;IAsBL,IAAI;IAKV;;OAEG;IACG,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,mBAAmB;IAqB3E;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAoBzB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.1.56-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.1.56-main.ad054df";
|
|
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.1.56-main.
|
|
3
|
+
"version": "0.1.56-main.ad054df",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -21,41 +21,42 @@
|
|
|
21
21
|
"src"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dxos/async": "0.1.56-main.
|
|
25
|
-
"@dxos/client-protocol": "0.1.56-main.
|
|
26
|
-
"@dxos/codec-protobuf": "0.1.56-main.
|
|
27
|
-
"@dxos/config": "0.1.56-main.
|
|
28
|
-
"@dxos/context": "0.1.56-main.
|
|
29
|
-
"@dxos/credentials": "0.1.56-main.
|
|
30
|
-
"@dxos/crypto": "0.1.56-main.
|
|
31
|
-
"@dxos/debug": "0.1.56-main.
|
|
32
|
-
"@dxos/document-model": "0.1.56-main.
|
|
33
|
-
"@dxos/echo-db": "0.1.56-main.
|
|
34
|
-
"@dxos/echo-pipeline": "0.1.56-main.
|
|
35
|
-
"@dxos/errors": "0.1.56-main.
|
|
36
|
-
"@dxos/feed-store": "0.1.56-main.
|
|
37
|
-
"@dxos/invariant": "0.1.56-main.
|
|
38
|
-
"@dxos/keyring": "0.1.56-main.
|
|
39
|
-
"@dxos/keys": "0.1.56-main.
|
|
40
|
-
"@dxos/lock-file": "0.1.56-main.
|
|
41
|
-
"@dxos/log": "0.1.56-main.
|
|
42
|
-
"@dxos/messaging": "0.1.56-main.
|
|
43
|
-
"@dxos/model-factory": "0.1.56-main.
|
|
44
|
-
"@dxos/network-manager": "0.1.56-main.
|
|
45
|
-
"@dxos/node-std": "0.1.56-main.
|
|
46
|
-
"@dxos/protocols": "0.1.56-main.
|
|
47
|
-
"@dxos/random-access-storage": "0.1.56-main.
|
|
48
|
-
"@dxos/rpc": "0.1.56-main.
|
|
49
|
-
"@dxos/teleport": "0.1.56-main.
|
|
50
|
-
"@dxos/teleport-extension-gossip": "0.1.56-main.
|
|
51
|
-
"@dxos/teleport-extension-object-sync": "0.1.56-main.
|
|
52
|
-
"@dxos/text-model": "0.1.56-main.
|
|
53
|
-
"@dxos/timeframe": "0.1.56-main.
|
|
54
|
-
"@dxos/
|
|
24
|
+
"@dxos/async": "0.1.56-main.ad054df",
|
|
25
|
+
"@dxos/client-protocol": "0.1.56-main.ad054df",
|
|
26
|
+
"@dxos/codec-protobuf": "0.1.56-main.ad054df",
|
|
27
|
+
"@dxos/config": "0.1.56-main.ad054df",
|
|
28
|
+
"@dxos/context": "0.1.56-main.ad054df",
|
|
29
|
+
"@dxos/credentials": "0.1.56-main.ad054df",
|
|
30
|
+
"@dxos/crypto": "0.1.56-main.ad054df",
|
|
31
|
+
"@dxos/debug": "0.1.56-main.ad054df",
|
|
32
|
+
"@dxos/document-model": "0.1.56-main.ad054df",
|
|
33
|
+
"@dxos/echo-db": "0.1.56-main.ad054df",
|
|
34
|
+
"@dxos/echo-pipeline": "0.1.56-main.ad054df",
|
|
35
|
+
"@dxos/errors": "0.1.56-main.ad054df",
|
|
36
|
+
"@dxos/feed-store": "0.1.56-main.ad054df",
|
|
37
|
+
"@dxos/invariant": "0.1.56-main.ad054df",
|
|
38
|
+
"@dxos/keyring": "0.1.56-main.ad054df",
|
|
39
|
+
"@dxos/keys": "0.1.56-main.ad054df",
|
|
40
|
+
"@dxos/lock-file": "0.1.56-main.ad054df",
|
|
41
|
+
"@dxos/log": "0.1.56-main.ad054df",
|
|
42
|
+
"@dxos/messaging": "0.1.56-main.ad054df",
|
|
43
|
+
"@dxos/model-factory": "0.1.56-main.ad054df",
|
|
44
|
+
"@dxos/network-manager": "0.1.56-main.ad054df",
|
|
45
|
+
"@dxos/node-std": "0.1.56-main.ad054df",
|
|
46
|
+
"@dxos/protocols": "0.1.56-main.ad054df",
|
|
47
|
+
"@dxos/random-access-storage": "0.1.56-main.ad054df",
|
|
48
|
+
"@dxos/rpc": "0.1.56-main.ad054df",
|
|
49
|
+
"@dxos/teleport": "0.1.56-main.ad054df",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.1.56-main.ad054df",
|
|
51
|
+
"@dxos/teleport-extension-object-sync": "0.1.56-main.ad054df",
|
|
52
|
+
"@dxos/text-model": "0.1.56-main.ad054df",
|
|
53
|
+
"@dxos/timeframe": "0.1.56-main.ad054df",
|
|
54
|
+
"@dxos/tracing": "0.1.56-main.ad054df",
|
|
55
|
+
"@dxos/util": "0.1.56-main.ad054df"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@types/readable-stream": "^2.3.9",
|
|
58
|
-
"@dxos/signal": "0.1.56-main.
|
|
59
|
+
"@dxos/signal": "0.1.56-main.ad054df"
|
|
59
60
|
},
|
|
60
61
|
"publishConfig": {
|
|
61
62
|
"access": "public"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { expect } from 'chai';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
|
+
import { Context } from '@dxos/context';
|
|
8
9
|
import { DevicesService, Device } from '@dxos/protocols/proto/dxos/client/services';
|
|
9
10
|
import { afterEach, afterTest, beforeEach, describe, test } from '@dxos/test';
|
|
10
11
|
|
|
@@ -18,7 +19,7 @@ describe('DevicesService', () => {
|
|
|
18
19
|
|
|
19
20
|
beforeEach(async () => {
|
|
20
21
|
serviceContext = createServiceContext();
|
|
21
|
-
await serviceContext.open();
|
|
22
|
+
await serviceContext.open(new Context());
|
|
22
23
|
devicesService = new DevicesServiceImpl(serviceContext.identityManager);
|
|
23
24
|
});
|
|
24
25
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { expect } from 'chai';
|
|
6
6
|
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
7
8
|
import { valueEncoding, MetadataStore, SpaceManager, AuthStatus, SnapshotStore } from '@dxos/echo-pipeline';
|
|
8
9
|
import { FeedFactory, FeedStore } from '@dxos/feed-store';
|
|
9
10
|
import { Keyring } from '@dxos/keyring';
|
|
@@ -64,7 +65,7 @@ describe('identity/identity-manager', () => {
|
|
|
64
65
|
|
|
65
66
|
test('creates identity', async () => {
|
|
66
67
|
const { identityManager } = await setupPeer();
|
|
67
|
-
await identityManager.open();
|
|
68
|
+
await identityManager.open(new Context());
|
|
68
69
|
afterTest(() => identityManager.close());
|
|
69
70
|
|
|
70
71
|
const identity = await identityManager.createIdentity();
|
|
@@ -75,13 +76,13 @@ describe('identity/identity-manager', () => {
|
|
|
75
76
|
const storage = createStorage({ type: StorageType.RAM });
|
|
76
77
|
|
|
77
78
|
const peer1 = await setupPeer({ storage });
|
|
78
|
-
await peer1.identityManager.open();
|
|
79
|
+
await peer1.identityManager.open(new Context());
|
|
79
80
|
const identity1 = await peer1.identityManager.createIdentity();
|
|
80
81
|
await peer1.identityManager.close();
|
|
81
82
|
await peer1.feedStore.close();
|
|
82
83
|
|
|
83
84
|
const peer2 = await setupPeer({ storage });
|
|
84
|
-
await peer2.identityManager.open();
|
|
85
|
+
await peer2.identityManager.open(new Context());
|
|
85
86
|
|
|
86
87
|
expect(peer2.identityManager.identity).to.exist;
|
|
87
88
|
expect(peer2.identityManager.identity!.identityKey).to.deep.eq(identity1.identityKey);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
|
+
import { Context } from '@dxos/context';
|
|
6
7
|
import { createCredentialSignerWithKey, CredentialGenerator } from '@dxos/credentials';
|
|
7
8
|
import { MetadataStore, SpaceManager, SwarmIdentity } from '@dxos/echo-pipeline';
|
|
8
9
|
import { FeedStore } from '@dxos/feed-store';
|
|
@@ -15,6 +16,7 @@ import { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
|
15
16
|
import { IdentityRecord, SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
16
17
|
import { AdmittedFeed } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
17
18
|
import { Timeframe } from '@dxos/timeframe';
|
|
19
|
+
import { trace as Trace } from '@dxos/tracing';
|
|
18
20
|
import { deferFunction } from '@dxos/util';
|
|
19
21
|
|
|
20
22
|
import { createAuthProvider } from './authenticator';
|
|
@@ -46,6 +48,7 @@ export type CreateIdentityOptions = {
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
// TODO(dmaretskyi): Rename: represents the peer's state machine.
|
|
51
|
+
@Trace.resource()
|
|
49
52
|
export class IdentityManager {
|
|
50
53
|
readonly stateUpdate = new Event();
|
|
51
54
|
|
|
@@ -64,7 +67,8 @@ export class IdentityManager {
|
|
|
64
67
|
return this._identity;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
@Trace.span()
|
|
71
|
+
async open(ctx: Context) {
|
|
68
72
|
const traceId = PublicKey.random().toHex();
|
|
69
73
|
log.trace('dxos.halo.identity-manager.open', trace.begin({ id: traceId }));
|
|
70
74
|
await this._metadataStore.load();
|
|
@@ -73,7 +77,7 @@ export class IdentityManager {
|
|
|
73
77
|
log('identity record', { identityRecord });
|
|
74
78
|
if (identityRecord) {
|
|
75
79
|
this._identity = await this._constructIdentity(identityRecord);
|
|
76
|
-
await this._identity.open();
|
|
80
|
+
await this._identity.open(ctx);
|
|
77
81
|
await this._identity.ready();
|
|
78
82
|
log.trace('dxos.halo.identity', {
|
|
79
83
|
identityKey: identityRecord.identityKey,
|
|
@@ -85,7 +89,7 @@ export class IdentityManager {
|
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
async close() {
|
|
88
|
-
await this._identity?.close();
|
|
92
|
+
await this._identity?.close(new Context());
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
async createIdentity({ displayName }: CreateIdentityOptions = {}) {
|
|
@@ -105,7 +109,7 @@ export class IdentityManager {
|
|
|
105
109
|
};
|
|
106
110
|
|
|
107
111
|
const identity = await this._constructIdentity(identityRecord);
|
|
108
|
-
await identity.open();
|
|
112
|
+
await identity.open(new Context());
|
|
109
113
|
|
|
110
114
|
{
|
|
111
115
|
const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
@@ -175,7 +179,7 @@ export class IdentityManager {
|
|
|
175
179
|
};
|
|
176
180
|
const identity = await this._constructIdentity(identityRecord);
|
|
177
181
|
|
|
178
|
-
await identity.open();
|
|
182
|
+
await identity.open(new Context());
|
|
179
183
|
this._identity = identity;
|
|
180
184
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
181
185
|
await this._identity.ready();
|
|
@@ -6,6 +6,7 @@ import chai, { expect } from 'chai';
|
|
|
6
6
|
import chaiAsPromised from 'chai-as-promised';
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
|
+
import { Context } from '@dxos/context';
|
|
9
10
|
import { PublicKey } from '@dxos/keys';
|
|
10
11
|
import { Identity, IdentityService } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
12
|
import { afterEach, afterTest, beforeEach, describe, test } from '@dxos/test';
|
|
@@ -22,7 +23,7 @@ describe('IdentityService', () => {
|
|
|
22
23
|
|
|
23
24
|
beforeEach(async () => {
|
|
24
25
|
serviceContext = createServiceContext();
|
|
25
|
-
await serviceContext.open();
|
|
26
|
+
await serviceContext.open(new Context());
|
|
26
27
|
identityService = new IdentityServiceImpl(serviceContext);
|
|
27
28
|
});
|
|
28
29
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
7
8
|
import { CredentialGenerator, verifyCredential } from '@dxos/credentials';
|
|
8
9
|
import {
|
|
9
10
|
MetadataStore,
|
|
@@ -106,8 +107,8 @@ describe('identity/identity', () => {
|
|
|
106
107
|
space,
|
|
107
108
|
});
|
|
108
109
|
|
|
109
|
-
await identity.open();
|
|
110
|
-
afterTest(() => identity.close());
|
|
110
|
+
await identity.open(new Context());
|
|
111
|
+
afterTest(() => identity.close(new Context()));
|
|
111
112
|
|
|
112
113
|
//
|
|
113
114
|
// Identity genesis
|
|
@@ -219,8 +220,8 @@ describe('identity/identity', () => {
|
|
|
219
220
|
space,
|
|
220
221
|
}));
|
|
221
222
|
|
|
222
|
-
await identity.open();
|
|
223
|
-
afterTest(() => identity.close());
|
|
223
|
+
await identity.open(new Context());
|
|
224
|
+
afterTest(() => identity.close(new Context()));
|
|
224
225
|
|
|
225
226
|
//
|
|
226
227
|
// Identity genesis
|
|
@@ -310,8 +311,8 @@ describe('identity/identity', () => {
|
|
|
310
311
|
space,
|
|
311
312
|
}));
|
|
312
313
|
|
|
313
|
-
await identity.open();
|
|
314
|
-
afterTest(() => identity.close());
|
|
314
|
+
await identity.open(new Context());
|
|
315
|
+
afterTest(() => identity.close(new Context()));
|
|
315
316
|
}
|
|
316
317
|
|
|
317
318
|
//
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
6
|
import { AUTH_TIMEOUT, LOAD_CONTROL_FEEDS_TIMEOUT } from '@dxos/client-protocol';
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
7
8
|
import {
|
|
8
9
|
DeviceStateMachine,
|
|
9
10
|
CredentialSigner,
|
|
@@ -21,6 +22,7 @@ import { log } from '@dxos/log';
|
|
|
21
22
|
import { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
22
23
|
import { AdmittedFeed, ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
23
24
|
import { DeviceAdmissionRequest } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
25
|
+
import { trace } from '@dxos/tracing';
|
|
24
26
|
import { ComplexSet } from '@dxos/util';
|
|
25
27
|
|
|
26
28
|
import { TrustedKeySetAuthVerifier } from './authenticator';
|
|
@@ -35,6 +37,7 @@ export type IdentityParams = {
|
|
|
35
37
|
/**
|
|
36
38
|
* Agent identity manager, which includes the agent's Halo space.
|
|
37
39
|
*/
|
|
40
|
+
@trace.resource()
|
|
38
41
|
export class Identity {
|
|
39
42
|
public readonly space: Space;
|
|
40
43
|
private readonly _signer: Signer;
|
|
@@ -76,13 +79,15 @@ export class Identity {
|
|
|
76
79
|
return this._deviceStateMachine.authorizedDeviceKeys;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
@trace.span()
|
|
83
|
+
async open(ctx: Context) {
|
|
80
84
|
await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
|
|
81
85
|
await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
|
|
82
|
-
await this.space.open();
|
|
86
|
+
await this.space.open(ctx);
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
|
|
89
|
+
@trace.span()
|
|
90
|
+
async close(ctx: Context) {
|
|
86
91
|
await this.authVerifier.close();
|
|
87
92
|
await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
|
|
88
93
|
await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { expect } from 'chai';
|
|
6
6
|
|
|
7
7
|
import { asyncChain } from '@dxos/async';
|
|
8
|
+
import { Context } from '@dxos/context';
|
|
8
9
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
9
10
|
import { describe, test, afterTest } from '@dxos/test';
|
|
10
11
|
|
|
@@ -19,7 +20,7 @@ const closeAfterTest = async (peer: ServiceContext) => {
|
|
|
19
20
|
describe('services/device', () => {
|
|
20
21
|
test('creates identity', async () => {
|
|
21
22
|
const peer = createServiceContext();
|
|
22
|
-
await peer.open();
|
|
23
|
+
await peer.open(new Context());
|
|
23
24
|
afterTest(() => peer.close());
|
|
24
25
|
|
|
25
26
|
const identity = await peer.createIdentity();
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { expect } from 'chai';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
|
+
import { Context } from '@dxos/context';
|
|
8
9
|
import { NetworkService, ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
9
10
|
import { afterEach, afterTest, beforeEach, describe, test } from '@dxos/test';
|
|
10
11
|
|
|
@@ -18,7 +19,7 @@ describe('NetworkService', () => {
|
|
|
18
19
|
|
|
19
20
|
beforeEach(async () => {
|
|
20
21
|
serviceContext = createServiceContext();
|
|
21
|
-
await serviceContext.open();
|
|
22
|
+
await serviceContext.open(new Context());
|
|
22
23
|
networkService = new NetworkServiceImpl(serviceContext.networkManager, serviceContext.signalManager);
|
|
23
24
|
});
|
|
24
25
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { ClientServices } from '@dxos/client-protocol';
|
|
6
6
|
import { Any, ServiceHandler, Stream } from '@dxos/codec-protobuf';
|
|
7
7
|
import { raise } from '@dxos/debug';
|
|
8
|
-
import { parseMethodName, RpcPeer, RpcPeerOptions } from '@dxos/rpc';
|
|
8
|
+
import { parseMethodName, RpcPeer, RpcPeerOptions, ServiceBundle } from '@dxos/rpc';
|
|
9
9
|
import { MaybePromise } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
import { ServiceRegistry } from './service-registry';
|
|
@@ -74,16 +74,16 @@ export class ClientRpcServer {
|
|
|
74
74
|
private _getServiceHandler(serviceName: string) {
|
|
75
75
|
if (!this._handlerCache.has(serviceName)) {
|
|
76
76
|
const [key, descriptor] =
|
|
77
|
-
Object.entries(this._serviceRegistry.descriptors).find(
|
|
77
|
+
Object.entries(this._serviceRegistry.descriptors as ServiceBundle<Record<string, any>>).find(
|
|
78
78
|
([key, descriptor]) => descriptor.name === serviceName,
|
|
79
79
|
) ?? raise(new Error(`Service not available: ${serviceName}`));
|
|
80
80
|
|
|
81
|
-
const service = this._serviceRegistry.services[key as keyof ClientServices];
|
|
81
|
+
const service = this._serviceRegistry.services[key as keyof ClientServices] as any;
|
|
82
82
|
if (!service) {
|
|
83
83
|
throw new Error(`Service not available: ${serviceName}`);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
this._handlerCache.set(serviceName, descriptor.createServer(service
|
|
86
|
+
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
return this._handlerCache.get(serviceName)!;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Trigger } from '@dxos/async';
|
|
6
|
+
import { Context } from '@dxos/context';
|
|
6
7
|
import { CredentialProcessor, getCredentialAssertion } from '@dxos/credentials';
|
|
7
8
|
import { failUndefined } from '@dxos/debug';
|
|
8
9
|
import {
|
|
@@ -26,6 +27,7 @@ import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
|
26
27
|
import { Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
27
28
|
import { Storage } from '@dxos/random-access-storage';
|
|
28
29
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
30
|
+
import { trace as Trace } from '@dxos/tracing';
|
|
29
31
|
|
|
30
32
|
import { CreateIdentityOptions, IdentityManager, JoinIdentityParams } from '../identity';
|
|
31
33
|
import {
|
|
@@ -40,6 +42,7 @@ import { DataSpaceManager, SigningContext } from '../spaces';
|
|
|
40
42
|
* Shared backend for all client services.
|
|
41
43
|
*/
|
|
42
44
|
// TODO(burdon): Rename/break-up into smaller components. And/or make members private.
|
|
45
|
+
@Trace.resource()
|
|
43
46
|
export class ServiceContext {
|
|
44
47
|
public readonly initialized = new Trigger();
|
|
45
48
|
public readonly dataServiceSubscriptions = new DataServiceSubscriptions();
|
|
@@ -121,7 +124,8 @@ export class ServiceContext {
|
|
|
121
124
|
);
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
@Trace.span()
|
|
128
|
+
async open(ctx: Context) {
|
|
125
129
|
await this._checkStorageVersion();
|
|
126
130
|
|
|
127
131
|
log('opening...');
|
|
@@ -129,9 +133,9 @@ export class ServiceContext {
|
|
|
129
133
|
await this.signalManager.open();
|
|
130
134
|
await this.networkManager.open();
|
|
131
135
|
await this.spaceManager.open();
|
|
132
|
-
await this.identityManager.open();
|
|
136
|
+
await this.identityManager.open(ctx);
|
|
133
137
|
if (this.identityManager.identity) {
|
|
134
|
-
await this._initialize();
|
|
138
|
+
await this._initialize(ctx);
|
|
135
139
|
}
|
|
136
140
|
log.trace('dxos.sdk.service-context.open', trace.end({ id: this._instanceId }));
|
|
137
141
|
log('opened');
|
|
@@ -155,7 +159,7 @@ export class ServiceContext {
|
|
|
155
159
|
async createIdentity(params: CreateIdentityOptions = {}) {
|
|
156
160
|
const identity = await this.identityManager.createIdentity(params);
|
|
157
161
|
|
|
158
|
-
await this._initialize();
|
|
162
|
+
await this._initialize(new Context());
|
|
159
163
|
return identity;
|
|
160
164
|
}
|
|
161
165
|
|
|
@@ -168,7 +172,7 @@ export class ServiceContext {
|
|
|
168
172
|
private async _acceptIdentity(params: JoinIdentityParams) {
|
|
169
173
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
170
174
|
|
|
171
|
-
await this._initialize();
|
|
175
|
+
await this._initialize(new Context());
|
|
172
176
|
return identity;
|
|
173
177
|
}
|
|
174
178
|
|
|
@@ -181,7 +185,8 @@ export class ServiceContext {
|
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
// Called when identity is created.
|
|
184
|
-
|
|
188
|
+
@Trace.span()
|
|
189
|
+
private async _initialize(ctx: Context) {
|
|
185
190
|
log('initializing spaces...');
|
|
186
191
|
const identity = this.identityManager.identity ?? failUndefined();
|
|
187
192
|
const signingContext: SigningContext = {
|
|
@@ -8,6 +8,7 @@ import { rmSync } from 'node:fs';
|
|
|
8
8
|
|
|
9
9
|
import { asyncTimeout, latch, Trigger } from '@dxos/async';
|
|
10
10
|
import { Config } from '@dxos/config';
|
|
11
|
+
import { Context } from '@dxos/context';
|
|
11
12
|
import { verifyPresentation } from '@dxos/credentials';
|
|
12
13
|
import { PublicKey } from '@dxos/keys';
|
|
13
14
|
import { MemorySignalManagerContext } from '@dxos/messaging';
|
|
@@ -30,7 +31,7 @@ describe('ClientServicesHost', () => {
|
|
|
30
31
|
|
|
31
32
|
test('queryCredentials', async () => {
|
|
32
33
|
const host = createServiceHost(new Config(), new MemorySignalManagerContext());
|
|
33
|
-
await host.open();
|
|
34
|
+
await host.open(new Context());
|
|
34
35
|
afterTest(() => host.close());
|
|
35
36
|
|
|
36
37
|
await host.services.IdentityService!.createIdentity({});
|
|
@@ -49,7 +50,7 @@ describe('ClientServicesHost', () => {
|
|
|
49
50
|
|
|
50
51
|
test('write and query credentials', async () => {
|
|
51
52
|
const host = createServiceHost(new Config(), new MemorySignalManagerContext());
|
|
52
|
-
await host.open();
|
|
53
|
+
await host.open(new Context());
|
|
53
54
|
afterTest(() => host.close());
|
|
54
55
|
|
|
55
56
|
await host.services.IdentityService!.createIdentity({});
|
|
@@ -86,7 +87,7 @@ describe('ClientServicesHost', () => {
|
|
|
86
87
|
|
|
87
88
|
test('sign presentation', async () => {
|
|
88
89
|
const host = createServiceHost(new Config(), new MemorySignalManagerContext());
|
|
89
|
-
await host.open();
|
|
90
|
+
await host.open(new Context());
|
|
90
91
|
afterTest(() => host.close());
|
|
91
92
|
|
|
92
93
|
await host.services.IdentityService!.createIdentity({});
|
|
@@ -117,7 +118,7 @@ describe('ClientServicesHost', () => {
|
|
|
117
118
|
});
|
|
118
119
|
{
|
|
119
120
|
const host = createServiceHost(config, new MemorySignalManagerContext());
|
|
120
|
-
await host.open();
|
|
121
|
+
await host.open(new Context());
|
|
121
122
|
|
|
122
123
|
await host.services.IdentityService?.createIdentity({});
|
|
123
124
|
|
|
@@ -129,7 +130,7 @@ describe('ClientServicesHost', () => {
|
|
|
129
130
|
|
|
130
131
|
{
|
|
131
132
|
const host = createServiceHost(config, new MemorySignalManagerContext());
|
|
132
|
-
await host.open();
|
|
133
|
+
await host.open(new Context());
|
|
133
134
|
const trigger = new Trigger<Identity>();
|
|
134
135
|
|
|
135
136
|
const stream = host.services.IdentityService?.queryIdentity();
|