@dxos/client-services 0.4.7-main.be31fed → 0.4.7-main.dca306f
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-6PRM6Q53.mjs → chunk-J2QTHPSP.mjs} +202 -133
- package/dist/lib/browser/chunk-J2QTHPSP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-WEDFRSR5.cjs → chunk-WNC3SLGD.cjs} +194 -125
- package/dist/lib/node/chunk-WNC3SLGD.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -37
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +8 -2
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +5 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +5 -3
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +4 -2
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.test.ts +8 -4
- package/src/packlets/devices/devices-service.ts +47 -11
- package/src/packlets/identity/identity-manager.ts +47 -5
- package/src/packlets/identity/identity.ts +9 -1
- package/src/packlets/services/service-context.ts +17 -3
- package/src/packlets/services/service-host.ts +6 -1
- package/src/packlets/spaces/data-space-manager.ts +18 -3
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-6PRM6Q53.mjs.map +0 -7
- package/dist/lib/node/chunk-WEDFRSR5.cjs.map +0 -7
|
@@ -31,7 +31,7 @@ __export(testing_exports, {
|
|
|
31
31
|
syncItemsLocal: () => syncItemsLocal
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(testing_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_chunk_WNC3SLGD = require("../../chunk-WNC3SLGD.cjs");
|
|
35
35
|
var import_credentials = require("@dxos/credentials");
|
|
36
36
|
var import_keys = require("@dxos/keys");
|
|
37
37
|
var import_async = require("@dxos/async");
|
|
@@ -209,7 +209,7 @@ var createInvitation = (host, options) => {
|
|
|
209
209
|
authMethod: import_services.Invitation.AuthMethod.NONE,
|
|
210
210
|
...options ?? {}
|
|
211
211
|
};
|
|
212
|
-
if (host instanceof
|
|
212
|
+
if (host instanceof import_chunk_WNC3SLGD.ServiceContext) {
|
|
213
213
|
const hostHandler = host.getInvitationHandler({
|
|
214
214
|
kind: import_services.Invitation.Kind.SPACE,
|
|
215
215
|
...options
|
|
@@ -220,7 +220,7 @@ var createInvitation = (host, options) => {
|
|
|
220
220
|
};
|
|
221
221
|
var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
222
222
|
invitation = sanitizeInvitation(invitation);
|
|
223
|
-
if (guest instanceof
|
|
223
|
+
if (guest instanceof import_chunk_WNC3SLGD.ServiceContext) {
|
|
224
224
|
const guestHandler = guest.getInvitationHandler({
|
|
225
225
|
kind: invitation.kind
|
|
226
226
|
});
|
|
@@ -229,7 +229,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
|
229
229
|
return guest.join(invitation, guestDeviceProfile);
|
|
230
230
|
};
|
|
231
231
|
var createServiceHost = (config, signalManagerContext) => {
|
|
232
|
-
return new
|
|
232
|
+
return new import_chunk_WNC3SLGD.ClientServicesHost({
|
|
233
233
|
config,
|
|
234
234
|
signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
|
|
235
235
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
@@ -243,8 +243,8 @@ var createServiceContext = ({ signalContext = new import_messaging.MemorySignalM
|
|
|
243
243
|
signalManager,
|
|
244
244
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
245
245
|
});
|
|
246
|
-
const modelFactory = (0,
|
|
247
|
-
return new
|
|
246
|
+
const modelFactory = (0, import_chunk_WNC3SLGD.createDefaultModelFactory)();
|
|
247
|
+
return new import_chunk_WNC3SLGD.ServiceContext(storage, networkManager, signalManager, modelFactory);
|
|
248
248
|
};
|
|
249
249
|
var createPeers = async (numPeers) => {
|
|
250
250
|
const signalContext = new import_messaging.MemorySignalManagerContext();
|
|
@@ -328,7 +328,7 @@ var TestPeer = class {
|
|
|
328
328
|
feedStore: this.feedStore,
|
|
329
329
|
networkManager: this.networkManager,
|
|
330
330
|
metadataStore: this.metadataStore,
|
|
331
|
-
modelFactory: (0,
|
|
331
|
+
modelFactory: (0, import_chunk_WNC3SLGD.createDefaultModelFactory)(),
|
|
332
332
|
snapshotStore: this.snapshotStore,
|
|
333
333
|
blobStore: this.blobStore
|
|
334
334
|
});
|
|
@@ -340,7 +340,7 @@ var TestPeer = class {
|
|
|
340
340
|
return this._props.automergeHost ??= new import_echo_pipeline.AutomergeHost(this.storage.createDirectory("automerge"));
|
|
341
341
|
}
|
|
342
342
|
get dataSpaceManager() {
|
|
343
|
-
return this._props.dataSpaceManager ??= new
|
|
343
|
+
return this._props.dataSpaceManager ??= new import_chunk_WNC3SLGD.DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore, this.automergeHost);
|
|
344
344
|
}
|
|
345
345
|
async createIdentity() {
|
|
346
346
|
this._props.signingContext ??= await createSigningContext(this.keyring);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
-
import {
|
|
2
|
+
import { Device, type DevicesService, type QueryDevicesResponse } from '@dxos/protocols/proto/dxos/client/services';
|
|
3
3
|
import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
4
4
|
import { type IdentityManager } from '../identity';
|
|
5
5
|
export declare class DevicesServiceImpl implements DevicesService {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devices-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devices/devices-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"devices-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/devices/devices-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EACL,MAAM,EAEN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,qBAAa,kBAAmB,YAAW,cAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,eAAe;IAExD,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAInE,YAAY,IAAI,MAAM,CAAC,oBAAoB,CAAC;CAwE7C"}
|
|
@@ -4,7 +4,7 @@ import { type MetadataStore, type SpaceManager } from '@dxos/echo-pipeline';
|
|
|
4
4
|
import { type FeedStore } from '@dxos/feed-store';
|
|
5
5
|
import { type Keyring } from '@dxos/keyring';
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
|
-
import {
|
|
7
|
+
import { Device } from '@dxos/protocols/proto/dxos/client/services';
|
|
8
8
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
9
9
|
import { type DeviceProfileDocument, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
10
10
|
import { Timeframe } from '@dxos/timeframe';
|
|
@@ -27,6 +27,10 @@ export type CreateIdentityOptions = {
|
|
|
27
27
|
displayName?: string;
|
|
28
28
|
deviceProfile?: DeviceProfileDocument;
|
|
29
29
|
};
|
|
30
|
+
export type IdentityManagerRuntimeParams = {
|
|
31
|
+
devicePresenceAnnounceInterval?: number;
|
|
32
|
+
devicePresenceOfflineTimeout?: number;
|
|
33
|
+
};
|
|
30
34
|
export declare class IdentityManager {
|
|
31
35
|
private readonly _metadataStore;
|
|
32
36
|
private readonly _keyring;
|
|
@@ -34,7 +38,9 @@ export declare class IdentityManager {
|
|
|
34
38
|
private readonly _spaceManager;
|
|
35
39
|
readonly stateUpdate: Event<void>;
|
|
36
40
|
private _identity?;
|
|
37
|
-
|
|
41
|
+
private readonly _devicePresenceAnnounceInterval;
|
|
42
|
+
private readonly _devicePresenceOfflineTimeout;
|
|
43
|
+
constructor(_metadataStore: MetadataStore, _keyring: Keyring, _feedStore: FeedStore<FeedMessage>, _spaceManager: SpaceManager, params?: IdentityManagerRuntimeParams);
|
|
38
44
|
get identity(): Identity | undefined;
|
|
39
45
|
open(ctx: Context): Promise<void>;
|
|
40
46
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-manager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAA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AA4B,GAAG;IACzC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAGF,qBACa,eAAe;IAUxB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAZhC,QAAQ,CAAC,WAAW,cAAe;IAEnC,OAAO,CAAC,SAAS,CAAC,CAAW;IAC7B,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CAAS;IACzD,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAS;gBAKpC,cAAc,EAAE,aAAa,EAC7B,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,EAClC,aAAa,EAAE,YAAY,EAC5C,MAAM,CAAC,EAAE,4BAA4B;IAUvC,IAAI,QAAQ,yBAEX;IAGK,IAAI,CAAC,GAAG,EAAE,OAAO;IAoBjB,KAAK;IAIL,cAAc,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,GAAE,qBAA0B;IAgF/E,0BAA0B,IAAI,qBAAqB;IAyBnD;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,kBAAkB;IAmC/C;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,eAAe;IAiBtC,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;YA0B5D,kBAAkB;YAwDlB,eAAe;CAmB9B"}
|
|
@@ -6,6 +6,7 @@ import { type Space } from '@dxos/echo-pipeline';
|
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
7
|
import { type DeviceProfileDocument, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
8
|
import { type DeviceAdmissionRequest } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
9
|
+
import { type Presence } from '@dxos/teleport-extension-gossip';
|
|
9
10
|
import { type ComplexMap } from '@dxos/util';
|
|
10
11
|
import { TrustedKeySetAuthVerifier } from './authenticator';
|
|
11
12
|
export type IdentityParams = {
|
|
@@ -13,6 +14,7 @@ export type IdentityParams = {
|
|
|
13
14
|
deviceKey: PublicKey;
|
|
14
15
|
signer: Signer;
|
|
15
16
|
space: Space;
|
|
17
|
+
presence?: Presence;
|
|
16
18
|
};
|
|
17
19
|
/**
|
|
18
20
|
* Agent identity manager, which includes the agent's Halo space.
|
|
@@ -20,13 +22,14 @@ export type IdentityParams = {
|
|
|
20
22
|
export declare class Identity {
|
|
21
23
|
readonly space: Space;
|
|
22
24
|
private readonly _signer;
|
|
25
|
+
private readonly _presence?;
|
|
23
26
|
private readonly _deviceStateMachine;
|
|
24
27
|
private readonly _profileStateMachine;
|
|
25
28
|
readonly authVerifier: TrustedKeySetAuthVerifier;
|
|
26
29
|
readonly identityKey: PublicKey;
|
|
27
30
|
readonly deviceKey: PublicKey;
|
|
28
31
|
readonly stateUpdate: Event<void>;
|
|
29
|
-
constructor({ space, signer, identityKey, deviceKey }: IdentityParams);
|
|
32
|
+
constructor({ space, signer, identityKey, deviceKey, presence }: IdentityParams);
|
|
30
33
|
get authorizedDeviceKeys(): ComplexMap<PublicKey, DeviceProfileDocument>;
|
|
31
34
|
open(ctx: Context): Promise<void>;
|
|
32
35
|
close(ctx: Context): Promise<void>;
|
|
@@ -39,6 +42,7 @@ export declare class Identity {
|
|
|
39
42
|
get haloSpaceKey(): PublicKey;
|
|
40
43
|
get haloGenesisFeedKey(): PublicKey;
|
|
41
44
|
get deviceCredentialChain(): import("@dxos/protocols/proto/dxos/halo/credentials").Chain | undefined;
|
|
45
|
+
get presence(): Presence | undefined;
|
|
42
46
|
/**
|
|
43
47
|
* Issues credentials as identity.
|
|
44
48
|
* Requires identity to be ready.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/ident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os/echo/feed';
|
|
|
11
11
|
import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
12
12
|
import { type Storage } from '@dxos/random-access-storage';
|
|
13
13
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
14
|
-
import { type CreateIdentityOptions, IdentityManager } from '../identity';
|
|
14
|
+
import { type CreateIdentityOptions, IdentityManager, type IdentityManagerRuntimeParams } from '../identity';
|
|
15
15
|
import { InvitationsHandler, type InvitationProtocol } from '../invitations';
|
|
16
|
-
import { DataSpaceManager } from '../spaces';
|
|
16
|
+
import { DataSpaceManager, type DataSpaceManagerRuntimeParams } from '../spaces';
|
|
17
|
+
export type ServiceContextRuntimeParams = IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams;
|
|
17
18
|
/**
|
|
18
19
|
* Shared backend for all client services.
|
|
19
20
|
*/
|
|
@@ -22,6 +23,7 @@ export declare class ServiceContext {
|
|
|
22
23
|
readonly networkManager: NetworkManager;
|
|
23
24
|
readonly signalManager: SignalManager;
|
|
24
25
|
readonly modelFactory: ModelFactory;
|
|
26
|
+
readonly _runtimeParams?: (IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams) | undefined;
|
|
25
27
|
readonly initialized: Trigger<void>;
|
|
26
28
|
readonly dataServiceSubscriptions: DataServiceSubscriptions;
|
|
27
29
|
readonly metadataStore: MetadataStore;
|
|
@@ -40,7 +42,7 @@ export declare class ServiceContext {
|
|
|
40
42
|
private readonly _handlerFactories;
|
|
41
43
|
private _deviceSpaceSync?;
|
|
42
44
|
private readonly _instanceId;
|
|
43
|
-
constructor(storage: Storage, networkManager: NetworkManager, signalManager: SignalManager, modelFactory: ModelFactory);
|
|
45
|
+
constructor(storage: Storage, networkManager: NetworkManager, signalManager: SignalManager, modelFactory: ModelFactory, _runtimeParams?: (IdentityManagerRuntimeParams & DataSpaceManagerRuntimeParams) | undefined);
|
|
44
46
|
open(ctx: Context): Promise<void>;
|
|
45
47
|
close(): Promise<void>;
|
|
46
48
|
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,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,6CAA6C,CAAC;AACpG,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAIjE,OAAO,
|
|
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,EACb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAe,SAAS,EAAE,M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OAAO,CAAC;IACjC,SAAgB,YAAY,EAAE,YAAY,CAAC;IAC3C,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,WAAW,EAAE,kBAAkB,CAAC;IAChD,SAAgB,aAAa,EAAE,aAAa,CAAC;IAGtC,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;gBAGxC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,cAAc,CAAC,4EAA8D;IAsDzF,IAAI,CAAC,GAAG,EAAE,OAAO;IAkBjB,KAAK;IAiBL,cAAc,CAAC,MAAM,GAAE,qBAA0B;IAMvD,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,kBAAkB;IAM9F,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS;YAUnD,eAAe;YAMf,oBAAoB;YAUpB,WAAW;CAgE1B"}
|
|
@@ -5,7 +5,7 @@ import { type SignalManager } from '@dxos/messaging';
|
|
|
5
5
|
import { ModelFactory } from '@dxos/model-factory';
|
|
6
6
|
import { type TransportFactory } from '@dxos/network-manager';
|
|
7
7
|
import { type Storage } from '@dxos/random-access-storage';
|
|
8
|
-
import { ServiceContext } from './service-context';
|
|
8
|
+
import { ServiceContext, type ServiceContextRuntimeParams } from './service-context';
|
|
9
9
|
import { ServiceRegistry } from './service-registry';
|
|
10
10
|
export declare const createDefaultModelFactory: () => ModelFactory;
|
|
11
11
|
export type ClientServicesHostParams = {
|
|
@@ -20,6 +20,7 @@ export type ClientServicesHostParams = {
|
|
|
20
20
|
storage?: Storage;
|
|
21
21
|
lockKey?: string;
|
|
22
22
|
callbacks?: ClientServicesHostCallbacks;
|
|
23
|
+
runtimeParams?: ServiceContextRuntimeParams;
|
|
23
24
|
};
|
|
24
25
|
export type ClientServicesHostCallbacks = {
|
|
25
26
|
onReset?: () => Promise<void>;
|
|
@@ -48,9 +49,10 @@ export declare class ClientServicesHost {
|
|
|
48
49
|
private _callbacks?;
|
|
49
50
|
private _devtoolsProxy?;
|
|
50
51
|
private _serviceContext;
|
|
52
|
+
private readonly _runtimeParams?;
|
|
51
53
|
private _opening;
|
|
52
54
|
private _open;
|
|
53
|
-
constructor({ config, modelFactory, transportFactory, signalManager, storage, lockKey, callbacks, }?: ClientServicesHostParams);
|
|
55
|
+
constructor({ config, modelFactory, transportFactory, signalManager, storage, lockKey, callbacks, runtimeParams, }?: ClientServicesHostParams);
|
|
54
56
|
get isOpen(): boolean;
|
|
55
57
|
get config(): Config | undefined;
|
|
56
58
|
get context(): ServiceContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxC,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAoD,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGhH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAO3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB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31
|
dataTimeframe?: Timeframe;
|
|
32
32
|
};
|
|
33
|
+
export type DataSpaceManagerRuntimeParams = {
|
|
34
|
+
spaceMemberPresenceAnnounceInterval?: number;
|
|
35
|
+
spaceMemberPresenceOfflineTimeout?: number;
|
|
36
|
+
};
|
|
33
37
|
export declare class DataSpaceManager {
|
|
34
38
|
private readonly _spaceManager;
|
|
35
39
|
private readonly _metadataStore;
|
|
@@ -43,7 +47,9 @@ export declare class DataSpaceManager {
|
|
|
43
47
|
private readonly _spaces;
|
|
44
48
|
private _isOpen;
|
|
45
49
|
private readonly _instanceId;
|
|
46
|
-
|
|
50
|
+
private readonly _spaceMemberPresenceAnnounceInterval;
|
|
51
|
+
private readonly _spaceMemberPresenceOfflineTimeout;
|
|
52
|
+
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore, _dataServiceSubscriptions: DataServiceSubscriptions, _keyring: Keyring, _signingContext: SigningContext, _feedStore: FeedStore<FeedMessage>, _automergeHost: AutomergeHost, params?: DataSpaceManagerRuntimeParams);
|
|
47
53
|
get spaces(): ComplexMap<PublicKey, DataSpace>;
|
|
48
54
|
open(): Promise<void>;
|
|
49
55
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA4B,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,mBAAmB,CAAC;AAClF,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAElB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,C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,CAAC,IAAI,CAAiB;IAEtC,SAAgB,OAAO,cAAe;IAEtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwD;IAEhF,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8B;IAC1D,OAAO,CAAC,QAAQ,CAAC,oCAAoC,CAAS;IAC9D,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAAS;gBAGzC,aAAa,EAAE,YAAY,EAC3B,cAAc,EAAE,aAAa,EAC7B,yBAAyB,EAAE,wBAAwB,EACnD,QAAQ,EAAE,OAAO,EACjB,eAAe,EAAE,cAAc,EAC/B,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,EAClC,cAAc,EAAE,aAAa,EAC9C,MAAM,CAAC,EAAE,6BAA6B;IAWxC,IAAI,MAAM,qCAET;IAGK,IAAI;IA2BJ,KAAK;IASX;;OAEG;IAEG,WAAW;IAqCX,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;IAoB/D;;;;OAIG;IACG,mBAAmB,CAAC,QAAQ,EAAE,SAAS;YAU/B,eAAe;CA2F9B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.4.7-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.4.7-main.dca306f";
|
|
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.4.7-main.
|
|
3
|
+
"version": "0.4.7-main.dca306f",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -22,44 +22,44 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"platform": "^1.3.6",
|
|
25
|
-
"@dxos/
|
|
26
|
-
"@dxos/async": "0.4.7-main.
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/credentials": "0.4.7-main.
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/echo-db": "0.4.7-main.
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/echo-
|
|
37
|
-
"@dxos/feed-store": "0.4.7-main.
|
|
38
|
-
"@dxos/invariant": "0.4.7-main.
|
|
39
|
-
"@dxos/keyring": "0.4.7-main.
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/lock-file": "0.4.7-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/messaging": "0.4.7-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/node-std": "0.4.7-main.
|
|
47
|
-
"@dxos/protocols": "0.4.7-main.
|
|
48
|
-
"@dxos/random-access-storage": "0.4.7-main.
|
|
49
|
-
"@dxos/teleport": "0.4.7-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
25
|
+
"@dxos/codec-protobuf": "0.4.7-main.dca306f",
|
|
26
|
+
"@dxos/async": "0.4.7-main.dca306f",
|
|
27
|
+
"@dxos/client-protocol": "0.4.7-main.dca306f",
|
|
28
|
+
"@dxos/config": "0.4.7-main.dca306f",
|
|
29
|
+
"@dxos/context": "0.4.7-main.dca306f",
|
|
30
|
+
"@dxos/credentials": "0.4.7-main.dca306f",
|
|
31
|
+
"@dxos/crypto": "0.4.7-main.dca306f",
|
|
32
|
+
"@dxos/debug": "0.4.7-main.dca306f",
|
|
33
|
+
"@dxos/document-model": "0.4.7-main.dca306f",
|
|
34
|
+
"@dxos/echo-db": "0.4.7-main.dca306f",
|
|
35
|
+
"@dxos/echo-pipeline": "0.4.7-main.dca306f",
|
|
36
|
+
"@dxos/echo-schema": "0.4.7-main.dca306f",
|
|
37
|
+
"@dxos/feed-store": "0.4.7-main.dca306f",
|
|
38
|
+
"@dxos/invariant": "0.4.7-main.dca306f",
|
|
39
|
+
"@dxos/keyring": "0.4.7-main.dca306f",
|
|
40
|
+
"@dxos/keys": "0.4.7-main.dca306f",
|
|
41
|
+
"@dxos/lock-file": "0.4.7-main.dca306f",
|
|
42
|
+
"@dxos/log": "0.4.7-main.dca306f",
|
|
43
|
+
"@dxos/messaging": "0.4.7-main.dca306f",
|
|
44
|
+
"@dxos/model-factory": "0.4.7-main.dca306f",
|
|
45
|
+
"@dxos/network-manager": "0.4.7-main.dca306f",
|
|
46
|
+
"@dxos/node-std": "0.4.7-main.dca306f",
|
|
47
|
+
"@dxos/protocols": "0.4.7-main.dca306f",
|
|
48
|
+
"@dxos/random-access-storage": "0.4.7-main.dca306f",
|
|
49
|
+
"@dxos/teleport": "0.4.7-main.dca306f",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.4.7-main.dca306f",
|
|
51
|
+
"@dxos/rpc": "0.4.7-main.dca306f",
|
|
52
|
+
"@dxos/teleport-extension-object-sync": "0.4.7-main.dca306f",
|
|
53
|
+
"@dxos/text-model": "0.4.7-main.dca306f",
|
|
54
|
+
"@dxos/util": "0.4.7-main.dca306f",
|
|
55
|
+
"@dxos/websocket-rpc": "0.4.7-main.dca306f",
|
|
56
|
+
"@dxos/tracing": "0.4.7-main.dca306f",
|
|
57
|
+
"@dxos/timeframe": "0.4.7-main.dca306f"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/platform": "^1.3.4",
|
|
61
61
|
"@types/readable-stream": "^2.3.9",
|
|
62
|
-
"@dxos/signal": "0.4.7-main.
|
|
62
|
+
"@dxos/signal": "0.4.7-main.dca306f"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
@@ -6,6 +6,7 @@ import { expect } from 'chai';
|
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
9
10
|
import { type DevicesService, type Device } from '@dxos/protocols/proto/dxos/client/services';
|
|
10
11
|
import { afterEach, afterTest, beforeEach, describe, test } from '@dxos/test';
|
|
11
12
|
|
|
@@ -44,10 +45,13 @@ describe('DevicesService', () => {
|
|
|
44
45
|
test('returns empty list if no identity is available', async () => {
|
|
45
46
|
const query = devicesService.queryDevices();
|
|
46
47
|
const result = new Trigger<Device[] | undefined>();
|
|
47
|
-
query.subscribe(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
query.subscribe(
|
|
49
|
+
({ devices }) => {
|
|
50
|
+
result.wake(devices);
|
|
51
|
+
},
|
|
52
|
+
(err) => log.catch(err),
|
|
53
|
+
);
|
|
54
|
+
afterTest(() => query.close().catch((err) => log.catch(err)));
|
|
51
55
|
expect(await result.wait()).to.be.length(0);
|
|
52
56
|
});
|
|
53
57
|
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { EventSubscriptions } from '@dxos/async';
|
|
6
6
|
import { Stream } from '@dxos/codec-protobuf';
|
|
7
|
+
import { invariant } from '@dxos/invariant';
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
+
Device,
|
|
9
10
|
DeviceKind,
|
|
10
11
|
type DevicesService,
|
|
11
12
|
type QueryDevicesResponse,
|
|
@@ -28,27 +29,62 @@ export class DevicesServiceImpl implements DevicesService {
|
|
|
28
29
|
if (!deviceKeys) {
|
|
29
30
|
next({ devices: [] });
|
|
30
31
|
} else {
|
|
32
|
+
invariant(this._identityManager.identity?.presence, 'presence not present');
|
|
33
|
+
const peers = this._identityManager.identity.presence.getPeersOnline();
|
|
31
34
|
next({
|
|
32
|
-
devices: Array.from(deviceKeys.entries()).map(([key, profile]) =>
|
|
33
|
-
deviceKey
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
|
|
36
|
+
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
37
|
+
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
deviceKey: key,
|
|
41
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind.CURRENT : DeviceKind.TRUSTED,
|
|
42
|
+
profile,
|
|
43
|
+
presence: isMe
|
|
44
|
+
? Device.PresenceState.ONLINE
|
|
45
|
+
: peerState
|
|
46
|
+
? Device.PresenceState.ONLINE
|
|
47
|
+
: Device.PresenceState.OFFLINE,
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
let identitySubscribed = false;
|
|
55
|
+
let presenceSubscribed = false;
|
|
56
|
+
const subscribeIdentity = () => {
|
|
57
|
+
if (!identitySubscribed) {
|
|
58
|
+
this._identityManager.identity?.stateUpdate.on(() => {
|
|
59
|
+
update();
|
|
37
60
|
});
|
|
61
|
+
identitySubscribed = true;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const subscribePresence = () => {
|
|
66
|
+
if (!presenceSubscribed) {
|
|
67
|
+
this._identityManager.identity?.presence?.updated.on(() => {
|
|
68
|
+
update();
|
|
69
|
+
});
|
|
70
|
+
presenceSubscribed = true;
|
|
38
71
|
}
|
|
39
72
|
};
|
|
40
73
|
|
|
41
74
|
const subscriptions = new EventSubscriptions();
|
|
75
|
+
|
|
76
|
+
if (this._identityManager.identity) {
|
|
77
|
+
subscribeIdentity();
|
|
78
|
+
subscribePresence();
|
|
79
|
+
}
|
|
80
|
+
|
|
42
81
|
subscriptions.add(
|
|
43
82
|
this._identityManager.stateUpdate.on(() => {
|
|
44
83
|
update();
|
|
45
84
|
|
|
46
85
|
if (this._identityManager.identity) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
update();
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
86
|
+
subscribeIdentity();
|
|
87
|
+
subscribePresence();
|
|
52
88
|
}
|
|
53
89
|
}),
|
|
54
90
|
);
|
|
@@ -13,7 +13,7 @@ import { type Keyring } from '@dxos/keyring';
|
|
|
13
13
|
import { PublicKey } from '@dxos/keys';
|
|
14
14
|
import { log } from '@dxos/log';
|
|
15
15
|
import { trace } from '@dxos/protocols';
|
|
16
|
-
import {
|
|
16
|
+
import { Device, DeviceKind } from '@dxos/protocols/proto/dxos/client/services';
|
|
17
17
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
18
18
|
import { type IdentityRecord, type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
19
19
|
import {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
DeviceType,
|
|
23
23
|
type ProfileDocument,
|
|
24
24
|
} from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
25
|
+
import { Gossip, Presence } from '@dxos/teleport-extension-gossip';
|
|
25
26
|
import { Timeframe } from '@dxos/timeframe';
|
|
26
27
|
import { trace as Trace } from '@dxos/tracing';
|
|
27
28
|
import { isNode, deferFunction } from '@dxos/util';
|
|
@@ -29,10 +30,14 @@ import { isNode, deferFunction } from '@dxos/util';
|
|
|
29
30
|
import { createAuthProvider } from './authenticator';
|
|
30
31
|
import { Identity } from './identity';
|
|
31
32
|
|
|
33
|
+
const DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 10_000;
|
|
34
|
+
const DEVICE_PRESENCE_OFFLINE_TIMEOUT = 20_000;
|
|
35
|
+
|
|
32
36
|
interface ConstructSpaceParams {
|
|
33
37
|
spaceRecord: SpaceMetadata;
|
|
34
38
|
swarmIdentity: SwarmIdentity;
|
|
35
39
|
identityKey: PublicKey;
|
|
40
|
+
gossip: Gossip;
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
export type JoinIdentityParams = {
|
|
@@ -58,12 +63,19 @@ export type CreateIdentityOptions = {
|
|
|
58
63
|
deviceProfile?: DeviceProfileDocument;
|
|
59
64
|
};
|
|
60
65
|
|
|
66
|
+
export type IdentityManagerRuntimeParams = {
|
|
67
|
+
devicePresenceAnnounceInterval?: number;
|
|
68
|
+
devicePresenceOfflineTimeout?: number;
|
|
69
|
+
};
|
|
70
|
+
|
|
61
71
|
// TODO(dmaretskyi): Rename: represents the peer's state machine.
|
|
62
72
|
@Trace.resource()
|
|
63
73
|
export class IdentityManager {
|
|
64
74
|
readonly stateUpdate = new Event();
|
|
65
75
|
|
|
66
76
|
private _identity?: Identity;
|
|
77
|
+
private readonly _devicePresenceAnnounceInterval: number;
|
|
78
|
+
private readonly _devicePresenceOfflineTimeout: number;
|
|
67
79
|
|
|
68
80
|
// TODO(burdon): IdentityManagerParams.
|
|
69
81
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
@@ -72,7 +84,15 @@ export class IdentityManager {
|
|
|
72
84
|
private readonly _keyring: Keyring,
|
|
73
85
|
private readonly _feedStore: FeedStore<FeedMessage>,
|
|
74
86
|
private readonly _spaceManager: SpaceManager,
|
|
75
|
-
|
|
87
|
+
params?: IdentityManagerRuntimeParams,
|
|
88
|
+
) {
|
|
89
|
+
const {
|
|
90
|
+
devicePresenceAnnounceInterval = DEVICE_PRESENCE_ANNOUNCE_INTERVAL,
|
|
91
|
+
devicePresenceOfflineTimeout = DEVICE_PRESENCE_OFFLINE_TIMEOUT,
|
|
92
|
+
} = params ?? {};
|
|
93
|
+
this._devicePresenceAnnounceInterval = devicePresenceAnnounceInterval;
|
|
94
|
+
this._devicePresenceOfflineTimeout = devicePresenceOfflineTimeout;
|
|
95
|
+
}
|
|
76
96
|
|
|
77
97
|
get identity() {
|
|
78
98
|
return this._identity;
|
|
@@ -284,13 +304,28 @@ export class IdentityManager {
|
|
|
284
304
|
const receipt = await this._identity.controlPipeline.writer.write({ credential: { credential } });
|
|
285
305
|
await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([[receipt.feedKey, receipt.seq]]));
|
|
286
306
|
this.stateUpdate.emit();
|
|
287
|
-
return {
|
|
307
|
+
return {
|
|
308
|
+
deviceKey: this._identity.deviceKey,
|
|
309
|
+
kind: DeviceKind.CURRENT,
|
|
310
|
+
presence: Device.PresenceState.ONLINE,
|
|
311
|
+
profile,
|
|
312
|
+
};
|
|
288
313
|
}
|
|
289
314
|
|
|
290
315
|
private async _constructIdentity(identityRecord: IdentityRecord) {
|
|
291
316
|
invariant(!this._identity);
|
|
292
317
|
log('constructing identity', { identityRecord });
|
|
293
318
|
|
|
319
|
+
const gossip = new Gossip({
|
|
320
|
+
localPeerId: identityRecord.deviceKey,
|
|
321
|
+
});
|
|
322
|
+
const presence = new Presence({
|
|
323
|
+
announceInterval: this._devicePresenceAnnounceInterval,
|
|
324
|
+
offlineTimeout: this._devicePresenceOfflineTimeout,
|
|
325
|
+
identityKey: identityRecord.deviceKey,
|
|
326
|
+
gossip,
|
|
327
|
+
});
|
|
328
|
+
|
|
294
329
|
// Must be created before the space so the feeds are writable.
|
|
295
330
|
invariant(identityRecord.haloSpace.controlFeedKey);
|
|
296
331
|
const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
|
|
@@ -309,6 +344,7 @@ export class IdentityManager {
|
|
|
309
344
|
credentialProvider: createAuthProvider(createCredentialSignerWithKey(this._keyring, identityRecord.deviceKey)),
|
|
310
345
|
credentialAuthenticator: deferFunction(() => identity.authVerifier.verifier),
|
|
311
346
|
},
|
|
347
|
+
gossip,
|
|
312
348
|
identityKey: identityRecord.identityKey,
|
|
313
349
|
});
|
|
314
350
|
await space.setControlFeed(controlFeed);
|
|
@@ -316,6 +352,7 @@ export class IdentityManager {
|
|
|
316
352
|
|
|
317
353
|
const identity: Identity = new Identity({
|
|
318
354
|
space,
|
|
355
|
+
presence,
|
|
319
356
|
signer: this._keyring,
|
|
320
357
|
identityKey: identityRecord.identityKey,
|
|
321
358
|
deviceKey: identityRecord.deviceKey,
|
|
@@ -331,14 +368,19 @@ export class IdentityManager {
|
|
|
331
368
|
return identity;
|
|
332
369
|
}
|
|
333
370
|
|
|
334
|
-
private async _constructSpace({ spaceRecord, swarmIdentity, identityKey }: ConstructSpaceParams) {
|
|
371
|
+
private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceParams) {
|
|
335
372
|
return this._spaceManager.constructSpace({
|
|
336
373
|
metadata: {
|
|
337
374
|
key: spaceRecord.key,
|
|
338
375
|
genesisFeedKey: spaceRecord.genesisFeedKey,
|
|
339
376
|
},
|
|
340
377
|
swarmIdentity,
|
|
341
|
-
onAuthorizedConnection: () => {
|
|
378
|
+
onAuthorizedConnection: (session) => {
|
|
379
|
+
session.addExtension(
|
|
380
|
+
'dxos.mesh.teleport.gossip',
|
|
381
|
+
gossip.createExtension({ remotePeerId: session.remotePeerId }),
|
|
382
|
+
);
|
|
383
|
+
},
|
|
342
384
|
onAuthFailure: () => {
|
|
343
385
|
log.warn('auth failure');
|
|
344
386
|
},
|