@dxos/client-services 0.4.5-main.623c49f → 0.4.5-main.8a5190e
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-RBWNAX7H.mjs → chunk-LX6NNNTM.mjs} +62 -26
- package/dist/lib/browser/chunk-LX6NNNTM.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-NZINWJCM.cjs → chunk-PUW3IKBC.cjs} +164 -128
- package/dist/lib/node/chunk-PUW3IKBC.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/identity/identity-manager.d.ts +3 -1
- package/dist/types/src/packlets/identity/identity-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 +12 -1
- package/src/packlets/devices/devices-service.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +19 -0
- package/src/packlets/identity/identity-manager.ts +27 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-RBWNAX7H.mjs.map +0 -7
- package/dist/lib/node/chunk-NZINWJCM.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_PUW3IKBC = require("../../chunk-PUW3IKBC.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_PUW3IKBC.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) => {
|
|
222
222
|
invitation = sanitizeInvitation(invitation);
|
|
223
|
-
if (guest instanceof
|
|
223
|
+
if (guest instanceof import_chunk_PUW3IKBC.ServiceContext) {
|
|
224
224
|
const guestHandler = guest.getInvitationHandler({
|
|
225
225
|
kind: invitation.kind
|
|
226
226
|
});
|
|
@@ -229,7 +229,7 @@ var acceptInvitation = (guest, invitation) => {
|
|
|
229
229
|
return guest.join(invitation);
|
|
230
230
|
};
|
|
231
231
|
var createServiceHost = (config, signalManagerContext) => {
|
|
232
|
-
return new
|
|
232
|
+
return new import_chunk_PUW3IKBC.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_PUW3IKBC.createDefaultModelFactory)();
|
|
247
|
+
return new import_chunk_PUW3IKBC.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_PUW3IKBC.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_PUW3IKBC.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);
|
|
@@ -4,8 +4,9 @@ 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 { type Device } from '@dxos/protocols/proto/dxos/client/services';
|
|
7
8
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
8
|
-
import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
|
+
import { type DeviceProfileDocument, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
10
|
import { Timeframe } from '@dxos/timeframe';
|
|
10
11
|
import { Identity } from './identity';
|
|
11
12
|
export type JoinIdentityParams = {
|
|
@@ -44,6 +45,7 @@ export declare class IdentityManager {
|
|
|
44
45
|
* Update the profile document of an existing identity.
|
|
45
46
|
*/
|
|
46
47
|
updateProfile(profile: ProfileDocument): Promise<ProfileDocument>;
|
|
48
|
+
updateDeviceProfile(profile: DeviceProfileDocument): Promise<Device>;
|
|
47
49
|
private _constructIdentity;
|
|
48
50
|
private _constructSpace;
|
|
49
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-manager.ts"],"names":[],"mappings":"AAMA,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,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,
|
|
1
|
+
{"version":3,"file":"identity-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-manager.ts"],"names":[],"mappings":"AAMA,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,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAEL,KAAK,qB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@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.4.5-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.4.5-main.8a5190e";
|
|
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.5-main.
|
|
3
|
+
"version": "0.4.5-main.8a5190e",
|
|
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/async": "0.4.5-main.
|
|
26
|
-
"@dxos/
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/config": "0.4.5-main.
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/credentials": "0.4.5-main.
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/document-model": "0.4.5-main.
|
|
35
|
-
"@dxos/echo-pipeline": "0.4.5-main.
|
|
36
|
-
"@dxos/echo-schema": "0.4.5-main.
|
|
37
|
-
"@dxos/invariant": "0.4.5-main.
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/lock-file": "0.4.5-main.
|
|
42
|
-
"@dxos/log": "0.4.5-main.
|
|
43
|
-
"@dxos/messaging": "0.4.5-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/teleport": "0.4.5-main.
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
25
|
+
"@dxos/async": "0.4.5-main.8a5190e",
|
|
26
|
+
"@dxos/codec-protobuf": "0.4.5-main.8a5190e",
|
|
27
|
+
"@dxos/client-protocol": "0.4.5-main.8a5190e",
|
|
28
|
+
"@dxos/config": "0.4.5-main.8a5190e",
|
|
29
|
+
"@dxos/context": "0.4.5-main.8a5190e",
|
|
30
|
+
"@dxos/credentials": "0.4.5-main.8a5190e",
|
|
31
|
+
"@dxos/debug": "0.4.5-main.8a5190e",
|
|
32
|
+
"@dxos/echo-db": "0.4.5-main.8a5190e",
|
|
33
|
+
"@dxos/crypto": "0.4.5-main.8a5190e",
|
|
34
|
+
"@dxos/document-model": "0.4.5-main.8a5190e",
|
|
35
|
+
"@dxos/echo-pipeline": "0.4.5-main.8a5190e",
|
|
36
|
+
"@dxos/echo-schema": "0.4.5-main.8a5190e",
|
|
37
|
+
"@dxos/invariant": "0.4.5-main.8a5190e",
|
|
38
|
+
"@dxos/keys": "0.4.5-main.8a5190e",
|
|
39
|
+
"@dxos/keyring": "0.4.5-main.8a5190e",
|
|
40
|
+
"@dxos/feed-store": "0.4.5-main.8a5190e",
|
|
41
|
+
"@dxos/lock-file": "0.4.5-main.8a5190e",
|
|
42
|
+
"@dxos/log": "0.4.5-main.8a5190e",
|
|
43
|
+
"@dxos/messaging": "0.4.5-main.8a5190e",
|
|
44
|
+
"@dxos/network-manager": "0.4.5-main.8a5190e",
|
|
45
|
+
"@dxos/model-factory": "0.4.5-main.8a5190e",
|
|
46
|
+
"@dxos/node-std": "0.4.5-main.8a5190e",
|
|
47
|
+
"@dxos/protocols": "0.4.5-main.8a5190e",
|
|
48
|
+
"@dxos/random-access-storage": "0.4.5-main.8a5190e",
|
|
49
|
+
"@dxos/rpc": "0.4.5-main.8a5190e",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.4.5-main.8a5190e",
|
|
51
|
+
"@dxos/teleport-extension-object-sync": "0.4.5-main.8a5190e",
|
|
52
|
+
"@dxos/teleport": "0.4.5-main.8a5190e",
|
|
53
|
+
"@dxos/text-model": "0.4.5-main.8a5190e",
|
|
54
|
+
"@dxos/timeframe": "0.4.5-main.8a5190e",
|
|
55
|
+
"@dxos/tracing": "0.4.5-main.8a5190e",
|
|
56
|
+
"@dxos/websocket-rpc": "0.4.5-main.8a5190e",
|
|
57
|
+
"@dxos/util": "0.4.5-main.8a5190e"
|
|
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.5-main.
|
|
62
|
+
"@dxos/signal": "0.4.5-main.8a5190e"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
@@ -27,7 +27,18 @@ describe('DevicesService', () => {
|
|
|
27
27
|
await serviceContext.close();
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
describe
|
|
30
|
+
describe('updateDevice', () => {
|
|
31
|
+
test.skip('updates device profile', async () => {
|
|
32
|
+
const query = devicesService.queryDevices();
|
|
33
|
+
const device = await devicesService.updateDevice({ label: 'test-device' });
|
|
34
|
+
const result = new Trigger<Device[] | undefined>();
|
|
35
|
+
query.subscribe(({ devices }) => {
|
|
36
|
+
result.wake(devices);
|
|
37
|
+
});
|
|
38
|
+
afterTest(() => query.close());
|
|
39
|
+
expect(device.profile?.label).to.equal('test-device');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
31
42
|
|
|
32
43
|
describe('queryDevices', () => {
|
|
33
44
|
test('returns empty list if no identity is available', async () => {
|
|
@@ -18,7 +18,7 @@ export class DevicesServiceImpl implements DevicesService {
|
|
|
18
18
|
constructor(private readonly _identityManager: IdentityManager) {}
|
|
19
19
|
|
|
20
20
|
async updateDevice(profile: DeviceProfileDocument): Promise<Device> {
|
|
21
|
-
|
|
21
|
+
return this._identityManager.updateDeviceProfile(profile);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
queryDevices(): Stream<QueryDevicesResponse> {
|
|
@@ -163,4 +163,23 @@ describe('identity/identity-manager', () => {
|
|
|
163
163
|
|
|
164
164
|
expect(!!identity.authorizedDeviceKeys.get(identity.deviceKey)?.platform).is.true;
|
|
165
165
|
});
|
|
166
|
+
|
|
167
|
+
test('updates device profile', async () => {
|
|
168
|
+
const signalContext = new MemorySignalManagerContext();
|
|
169
|
+
|
|
170
|
+
const peer = await setupPeer({ signalContext });
|
|
171
|
+
|
|
172
|
+
const identity = await peer.identityManager.createIdentity();
|
|
173
|
+
|
|
174
|
+
// Note: Waiting for device profile credential to be processed.
|
|
175
|
+
await identity.stateUpdate.waitForCount(1);
|
|
176
|
+
|
|
177
|
+
const deviceProfile = identity.authorizedDeviceKeys.get(identity.deviceKey);
|
|
178
|
+
expect(deviceProfile).to.exist;
|
|
179
|
+
|
|
180
|
+
deviceProfile!.label = 'updated profile';
|
|
181
|
+
await peer.identityManager.updateDeviceProfile(deviceProfile!);
|
|
182
|
+
|
|
183
|
+
expect(identity.authorizedDeviceKeys.get(identity.deviceKey)?.label).to.equal('updated profile');
|
|
184
|
+
});
|
|
166
185
|
});
|
|
@@ -14,9 +14,14 @@ import { type Keyring } from '@dxos/keyring';
|
|
|
14
14
|
import { PublicKey } from '@dxos/keys';
|
|
15
15
|
import { log } from '@dxos/log';
|
|
16
16
|
import { trace } from '@dxos/protocols';
|
|
17
|
+
import { type Device, DeviceKind } from '@dxos/protocols/proto/dxos/client/services';
|
|
17
18
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
18
19
|
import { type IdentityRecord, type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
19
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
AdmittedFeed,
|
|
22
|
+
type DeviceProfileDocument,
|
|
23
|
+
type ProfileDocument,
|
|
24
|
+
} from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
20
25
|
import { Timeframe } from '@dxos/timeframe';
|
|
21
26
|
import { trace as Trace } from '@dxos/tracing';
|
|
22
27
|
import { deferFunction } from '@dxos/util';
|
|
@@ -224,6 +229,27 @@ export class IdentityManager {
|
|
|
224
229
|
return profile;
|
|
225
230
|
}
|
|
226
231
|
|
|
232
|
+
async updateDeviceProfile(profile: DeviceProfileDocument): Promise<Device> {
|
|
233
|
+
invariant(this._identity, 'Identity not initialized.');
|
|
234
|
+
|
|
235
|
+
// TODO(nf): CredentialGenerator doesn't work when not updating own device.
|
|
236
|
+
// const generator = new CredentialGenerator(this._keyring, this._identity.identityKey, this._identity.deviceKey);
|
|
237
|
+
// const credential = await generator.createDeviceProfile(profile);
|
|
238
|
+
|
|
239
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
240
|
+
subject: this._identity.deviceKey,
|
|
241
|
+
assertion: {
|
|
242
|
+
'@type': 'dxos.halo.credentials.DeviceProfile',
|
|
243
|
+
profile,
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
const receipt = await this._identity.controlPipeline.writer.write({ credential: { credential } });
|
|
248
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([[receipt.feedKey, receipt.seq]]));
|
|
249
|
+
this.stateUpdate.emit();
|
|
250
|
+
return { deviceKey: this._identity.deviceKey, kind: DeviceKind.CURRENT, profile };
|
|
251
|
+
}
|
|
252
|
+
|
|
227
253
|
private async _constructIdentity(identityRecord: IdentityRecord) {
|
|
228
254
|
invariant(!this._identity);
|
|
229
255
|
log('constructing identity', { identityRecord });
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "0.4.5-main.
|
|
1
|
+
export const DXOS_VERSION = "0.4.5-main.8a5190e";
|