@dxos/client-services 0.3.2-main.48c28c7 → 0.3.2-main.988f99c
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-AUQLXFE6.mjs → chunk-3GWSYNJC.mjs} +141 -69
- package/dist/lib/browser/chunk-3GWSYNJC.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/index.cjs +200 -128
- 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 +174 -102
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- 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 +4 -0
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- 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/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.ts +16 -3
- package/src/packlets/identity/identity-manager.test.ts +11 -0
- package/src/packlets/identity/identity-manager.ts +20 -0
- package/src/packlets/identity/identity.test.ts +2 -2
- package/src/packlets/identity/identity.ts +5 -3
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-AUQLXFE6.mjs.map +0 -7
|
@@ -5,7 +5,7 @@ import { IdentityManager } from '../identity';
|
|
|
5
5
|
export declare class DevicesServiceImpl implements DevicesService {
|
|
6
6
|
private readonly _identityManager;
|
|
7
7
|
constructor(_identityManager: IdentityManager);
|
|
8
|
-
updateDevice(
|
|
8
|
+
updateDevice(profile: ProfileDocument): Promise<Device>;
|
|
9
9
|
queryDevices(): Stream<QueryDevicesResponse>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=devices-service.d.ts.map
|
|
@@ -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,EAAE,MAAM,EAAc,cAAc,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACtH,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,qBAAa,kBAAmB,YAAW,cAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,eAAe;IAExD,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAe7D,YAAY,IAAI,MAAM,CAAC,oBAAoB,CAAC;CAqC7C"}
|
|
@@ -44,6 +44,10 @@ export declare class IdentityManager {
|
|
|
44
44
|
* Update the profile document of an existing identity.
|
|
45
45
|
*/
|
|
46
46
|
updateProfile(profile: ProfileDocument): Promise<ProfileDocument>;
|
|
47
|
+
updateDevice({ deviceKey, profile }: {
|
|
48
|
+
deviceKey: PublicKey;
|
|
49
|
+
profile: ProfileDocument;
|
|
50
|
+
}): Promise<ProfileDocument>;
|
|
47
51
|
private _constructIdentity;
|
|
48
52
|
private _constructSpace;
|
|
49
53
|
}
|
|
@@ -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,CA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IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAVhC,QAAQ,CAAC,WAAW,cAAe;IAEnC,OAAO,CAAC,SAAS,CAAC,CAAW;gBAKV,cAAc,EAAE,aAAa,EAC7B,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,EAClC,aAAa,EAAE,YAAY;IAG9C,IAAI,QAAQ,yBAEX;IAGK,IAAI,CAAC,GAAG,EAAE,OAAO;IAmBjB,KAAK;IAIL,cAAc,CAAC,EAAE,WAAW,EAAE,GAAE,qBAA0B;IAmEhE;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,kBAAkB;IA+B/C;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,eAAe;IAiBtC,YAAY,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,eAAe,CAAA;KAAE;YAoB/E,kBAAkB;YA2ClB,eAAe;CAc9B"}
|
|
@@ -6,7 +6,7 @@ import { Space } from '@dxos/echo-pipeline';
|
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
7
|
import { ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
8
|
import { DeviceAdmissionRequest } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
9
|
-
import {
|
|
9
|
+
import { ComplexMap } from '@dxos/util';
|
|
10
10
|
import { TrustedKeySetAuthVerifier } from './authenticator';
|
|
11
11
|
export type IdentityParams = {
|
|
12
12
|
identityKey: PublicKey;
|
|
@@ -27,7 +27,7 @@ export declare class Identity {
|
|
|
27
27
|
readonly deviceKey: PublicKey;
|
|
28
28
|
readonly stateUpdate: Event<void>;
|
|
29
29
|
constructor({ space, signer, identityKey, deviceKey }: IdentityParams);
|
|
30
|
-
get authorizedDeviceKeys():
|
|
30
|
+
get authorizedDeviceKeys(): ComplexMap<PublicKey, ProfileDocument>;
|
|
31
31
|
open(ctx: Context): Promise<void>;
|
|
32
32
|
close(ctx: Context): Promise<void>;
|
|
33
33
|
ready(): Promise<void>;
|
|
@@ -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,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,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;AAErF,OAAO,EAAE,UAAU,
|
|
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,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,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;AAErF,OAAO,EAAE,UAAU,EAAc,MAAM,YAAY,CAAC;A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
+
export declare const DXOS_VERSION = "0.3.2-main.988f99c";
|
|
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.3.2-main.
|
|
3
|
+
"version": "0.3.2-main.988f99c",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -21,43 +21,43 @@
|
|
|
21
21
|
"src"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dxos/async": "0.3.2-main.
|
|
25
|
-
"@dxos/client-protocol": "0.3.2-main.
|
|
26
|
-
"@dxos/codec-protobuf": "0.3.2-main.
|
|
27
|
-
"@dxos/config": "0.3.2-main.
|
|
28
|
-
"@dxos/context": "0.3.2-main.
|
|
29
|
-
"@dxos/credentials": "0.3.2-main.
|
|
30
|
-
"@dxos/crypto": "0.3.2-main.
|
|
31
|
-
"@dxos/debug": "0.3.2-main.
|
|
32
|
-
"@dxos/document-model": "0.3.2-main.
|
|
33
|
-
"@dxos/echo-db": "0.3.2-main.
|
|
34
|
-
"@dxos/echo-pipeline": "0.3.2-main.
|
|
35
|
-
"@dxos/echo-schema": "0.3.2-main.
|
|
36
|
-
"@dxos/feed-store": "0.3.2-main.
|
|
37
|
-
"@dxos/invariant": "0.3.2-main.
|
|
38
|
-
"@dxos/keyring": "0.3.2-main.
|
|
39
|
-
"@dxos/keys": "0.3.2-main.
|
|
40
|
-
"@dxos/lock-file": "0.3.2-main.
|
|
41
|
-
"@dxos/log": "0.3.2-main.
|
|
42
|
-
"@dxos/messaging": "0.3.2-main.
|
|
43
|
-
"@dxos/model-factory": "0.3.2-main.
|
|
44
|
-
"@dxos/network-manager": "0.3.2-main.
|
|
45
|
-
"@dxos/node-std": "0.3.2-main.
|
|
46
|
-
"@dxos/protocols": "0.3.2-main.
|
|
47
|
-
"@dxos/random-access-storage": "0.3.2-main.
|
|
48
|
-
"@dxos/rpc": "0.3.2-main.
|
|
49
|
-
"@dxos/teleport": "0.3.2-main.
|
|
50
|
-
"@dxos/teleport-extension-gossip": "0.3.2-main.
|
|
51
|
-
"@dxos/teleport-extension-object-sync": "0.3.2-main.
|
|
52
|
-
"@dxos/text-model": "0.3.2-main.
|
|
53
|
-
"@dxos/timeframe": "0.3.2-main.
|
|
54
|
-
"@dxos/tracing": "0.3.2-main.
|
|
55
|
-
"@dxos/util": "0.3.2-main.
|
|
56
|
-
"@dxos/websocket-rpc": "0.3.2-main.
|
|
24
|
+
"@dxos/async": "0.3.2-main.988f99c",
|
|
25
|
+
"@dxos/client-protocol": "0.3.2-main.988f99c",
|
|
26
|
+
"@dxos/codec-protobuf": "0.3.2-main.988f99c",
|
|
27
|
+
"@dxos/config": "0.3.2-main.988f99c",
|
|
28
|
+
"@dxos/context": "0.3.2-main.988f99c",
|
|
29
|
+
"@dxos/credentials": "0.3.2-main.988f99c",
|
|
30
|
+
"@dxos/crypto": "0.3.2-main.988f99c",
|
|
31
|
+
"@dxos/debug": "0.3.2-main.988f99c",
|
|
32
|
+
"@dxos/document-model": "0.3.2-main.988f99c",
|
|
33
|
+
"@dxos/echo-db": "0.3.2-main.988f99c",
|
|
34
|
+
"@dxos/echo-pipeline": "0.3.2-main.988f99c",
|
|
35
|
+
"@dxos/echo-schema": "0.3.2-main.988f99c",
|
|
36
|
+
"@dxos/feed-store": "0.3.2-main.988f99c",
|
|
37
|
+
"@dxos/invariant": "0.3.2-main.988f99c",
|
|
38
|
+
"@dxos/keyring": "0.3.2-main.988f99c",
|
|
39
|
+
"@dxos/keys": "0.3.2-main.988f99c",
|
|
40
|
+
"@dxos/lock-file": "0.3.2-main.988f99c",
|
|
41
|
+
"@dxos/log": "0.3.2-main.988f99c",
|
|
42
|
+
"@dxos/messaging": "0.3.2-main.988f99c",
|
|
43
|
+
"@dxos/model-factory": "0.3.2-main.988f99c",
|
|
44
|
+
"@dxos/network-manager": "0.3.2-main.988f99c",
|
|
45
|
+
"@dxos/node-std": "0.3.2-main.988f99c",
|
|
46
|
+
"@dxos/protocols": "0.3.2-main.988f99c",
|
|
47
|
+
"@dxos/random-access-storage": "0.3.2-main.988f99c",
|
|
48
|
+
"@dxos/rpc": "0.3.2-main.988f99c",
|
|
49
|
+
"@dxos/teleport": "0.3.2-main.988f99c",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.3.2-main.988f99c",
|
|
51
|
+
"@dxos/teleport-extension-object-sync": "0.3.2-main.988f99c",
|
|
52
|
+
"@dxos/text-model": "0.3.2-main.988f99c",
|
|
53
|
+
"@dxos/timeframe": "0.3.2-main.988f99c",
|
|
54
|
+
"@dxos/tracing": "0.3.2-main.988f99c",
|
|
55
|
+
"@dxos/util": "0.3.2-main.988f99c",
|
|
56
|
+
"@dxos/websocket-rpc": "0.3.2-main.988f99c"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/readable-stream": "^2.3.9",
|
|
60
|
-
"@dxos/signal": "0.3.2-main.
|
|
60
|
+
"@dxos/signal": "0.3.2-main.988f99c"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
@@ -4,6 +4,7 @@
|
|
|
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 { Device, DeviceKind, DevicesService, QueryDevicesResponse } from '@dxos/protocols/proto/dxos/client/services';
|
|
8
9
|
import { ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
10
|
|
|
@@ -12,8 +13,19 @@ import { IdentityManager } from '../identity';
|
|
|
12
13
|
export class DevicesServiceImpl implements DevicesService {
|
|
13
14
|
constructor(private readonly _identityManager: IdentityManager) {}
|
|
14
15
|
|
|
15
|
-
updateDevice(
|
|
16
|
-
|
|
16
|
+
async updateDevice(profile: ProfileDocument): Promise<Device> {
|
|
17
|
+
invariant(this._identityManager.identity, 'Identity not initialized');
|
|
18
|
+
const deviceKey = this._identityManager.identity.deviceKey;
|
|
19
|
+
await this._identityManager.updateDevice({
|
|
20
|
+
deviceKey,
|
|
21
|
+
profile,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
deviceKey,
|
|
26
|
+
kind: DeviceKind.CURRENT,
|
|
27
|
+
profile,
|
|
28
|
+
};
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
queryDevices(): Stream<QueryDevicesResponse> {
|
|
@@ -24,9 +36,10 @@ export class DevicesServiceImpl implements DevicesService {
|
|
|
24
36
|
next({ devices: [] });
|
|
25
37
|
} else {
|
|
26
38
|
next({
|
|
27
|
-
devices: Array.from(deviceKeys.
|
|
39
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
|
|
28
40
|
deviceKey: key,
|
|
29
41
|
kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind.CURRENT : DeviceKind.TRUSTED,
|
|
42
|
+
profile,
|
|
30
43
|
})),
|
|
31
44
|
});
|
|
32
45
|
}
|
|
@@ -151,4 +151,15 @@ describe('identity/identity-manager', () => {
|
|
|
151
151
|
expect(identity2.space.protocol.sessions.get(identity1.deviceKey)).to.exist;
|
|
152
152
|
expect(identity2.space.protocol.sessions.get(identity1.deviceKey)?.authStatus).to.equal(AuthStatus.SUCCESS);
|
|
153
153
|
});
|
|
154
|
+
|
|
155
|
+
test('set device profile', async () => {
|
|
156
|
+
const signalContext = new MemorySignalManagerContext();
|
|
157
|
+
|
|
158
|
+
const peer1 = await setupPeer({ signalContext });
|
|
159
|
+
const identity1 = await peer1.identityManager.createIdentity();
|
|
160
|
+
|
|
161
|
+
await peer1.identityManager.updateDevice({ deviceKey: identity1.deviceKey, profile: { displayName: 'Peer1' } });
|
|
162
|
+
|
|
163
|
+
expect(identity1.authorizedDeviceKeys.get(identity1.deviceKey)?.displayName).to.equal('Peer1');
|
|
164
|
+
});
|
|
154
165
|
});
|
|
@@ -212,6 +212,26 @@ export class IdentityManager {
|
|
|
212
212
|
return profile;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
async updateDevice({ deviceKey, profile }: { deviceKey: PublicKey; profile: ProfileDocument }) {
|
|
216
|
+
invariant(this._identity, 'Identity not initialized.');
|
|
217
|
+
|
|
218
|
+
invariant(this._identity.authorizedDeviceKeys.has(deviceKey), 'Device not authorized.');
|
|
219
|
+
|
|
220
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
221
|
+
subject: this._identity.identityKey,
|
|
222
|
+
assertion: {
|
|
223
|
+
'@type': 'dxos.halo.credentials.DeviceProfile',
|
|
224
|
+
deviceKey,
|
|
225
|
+
profile,
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const receipt = await this._identity.controlPipeline.writer.write({ credential: { credential } });
|
|
230
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([[receipt.feedKey, receipt.seq]]));
|
|
231
|
+
this.stateUpdate.emit();
|
|
232
|
+
return profile;
|
|
233
|
+
}
|
|
234
|
+
|
|
215
235
|
private async _constructIdentity(identityRecord: IdentityRecord) {
|
|
216
236
|
invariant(!this._identity);
|
|
217
237
|
log('constructing identity', { identityRecord });
|
|
@@ -336,7 +336,7 @@ describe('identity/identity', () => {
|
|
|
336
336
|
await identity2.ready();
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
expect(Array.from(identity1.authorizedDeviceKeys.
|
|
340
|
-
expect(Array.from(identity2.authorizedDeviceKeys.
|
|
339
|
+
expect(Array.from(identity1.authorizedDeviceKeys.keys())).toEqual([identity1.deviceKey, identity2.deviceKey]);
|
|
340
|
+
expect(Array.from(identity2.authorizedDeviceKeys.keys())).toEqual([identity1.deviceKey, identity2.deviceKey]);
|
|
341
341
|
});
|
|
342
342
|
});
|
|
@@ -23,7 +23,7 @@ import { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
|
23
23
|
import { AdmittedFeed, ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
24
24
|
import { DeviceAdmissionRequest } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
25
25
|
import { trace } from '@dxos/tracing';
|
|
26
|
-
import { ComplexSet } from '@dxos/util';
|
|
26
|
+
import { ComplexMap, ComplexSet } from '@dxos/util';
|
|
27
27
|
|
|
28
28
|
import { TrustedKeySetAuthVerifier } from './authenticator';
|
|
29
29
|
|
|
@@ -57,6 +57,8 @@ export class Identity {
|
|
|
57
57
|
this.identityKey = identityKey;
|
|
58
58
|
this.deviceKey = deviceKey;
|
|
59
59
|
|
|
60
|
+
log.trace('dxos.halo.device', { deviceKey });
|
|
61
|
+
|
|
60
62
|
this._deviceStateMachine = new DeviceStateMachine({
|
|
61
63
|
identityKey: this.identityKey,
|
|
62
64
|
deviceKey: this.deviceKey,
|
|
@@ -68,14 +70,14 @@ export class Identity {
|
|
|
68
70
|
});
|
|
69
71
|
|
|
70
72
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
71
|
-
trustedKeysProvider: () => this.authorizedDeviceKeys,
|
|
73
|
+
trustedKeysProvider: () => new ComplexSet(PublicKey.hash, this.authorizedDeviceKeys.keys()),
|
|
72
74
|
update: this.stateUpdate,
|
|
73
75
|
authTimeout: AUTH_TIMEOUT,
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
// TODO(burdon): Expose state object?
|
|
78
|
-
get authorizedDeviceKeys():
|
|
80
|
+
get authorizedDeviceKeys(): ComplexMap<PublicKey, ProfileDocument> {
|
|
79
81
|
return this._deviceStateMachine.authorizedDeviceKeys;
|
|
80
82
|
}
|
|
81
83
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "0.3.2-main.
|
|
1
|
+
export const DXOS_VERSION = "0.3.2-main.988f99c";
|