@dxos/client-services 0.1.56-main.538bda2 → 0.1.56-main.5db35f4
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-Y4AYNWBO.mjs → chunk-FVGGGXU6.mjs} +83 -36
- package/dist/lib/browser/chunk-FVGGGXU6.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 +82 -35
- 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 +82 -35
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts +5 -0
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +7 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +34 -34
- package/src/packlets/identity/identity-manager.test.ts +11 -0
- package/src/packlets/identity/identity-manager.ts +18 -1
- package/src/packlets/identity/identity-service.test.ts +15 -1
- package/src/packlets/identity/identity-service.ts +23 -14
- package/src/packlets/services/service-host.ts +5 -1
- package/src/packlets/spaces/data-space-manager.test.ts +80 -22
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-Y4AYNWBO.mjs.map +0 -7
|
@@ -5,6 +5,7 @@ import { FeedStore } from '@dxos/feed-store';
|
|
|
5
5
|
import { Keyring } from '@dxos/keyring';
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
7
|
import { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
8
|
+
import { ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
8
9
|
import { Timeframe } from '@dxos/timeframe';
|
|
9
10
|
import { Identity } from './identity';
|
|
10
11
|
export type JoinIdentityParams = {
|
|
@@ -39,6 +40,10 @@ export declare class IdentityManager {
|
|
|
39
40
|
* Accept an existing identity. Expects it's device key to be authorized (now or later).
|
|
40
41
|
*/
|
|
41
42
|
acceptIdentity(params: JoinIdentityParams): Promise<Identity>;
|
|
43
|
+
/**
|
|
44
|
+
* Update the profile document of an existing identity.
|
|
45
|
+
*/
|
|
46
|
+
updateProfile(profile: ProfileDocument): Promise<void>;
|
|
42
47
|
private _constructIdentity;
|
|
43
48
|
private _constructSpace;
|
|
44
49
|
}
|
|
@@ -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;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;
|
|
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;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAA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|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { Stream } from '@dxos/codec-protobuf';
|
|
2
|
+
import { Keyring } from '@dxos/keyring';
|
|
2
3
|
import { Identity, IdentityService, QueryIdentityResponse, RecoverIdentityRequest, SignPresentationRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
3
4
|
import { Presentation, ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
4
|
-
import {
|
|
5
|
+
import { CreateIdentityOptions, IdentityManager } from './identity-manager';
|
|
5
6
|
export declare class IdentityServiceImpl implements IdentityService {
|
|
6
|
-
private readonly
|
|
7
|
-
|
|
7
|
+
private readonly _createIdentity;
|
|
8
|
+
private readonly _identityManager;
|
|
9
|
+
private readonly _keyring;
|
|
10
|
+
constructor(_createIdentity: (params?: CreateIdentityOptions) => Promise<Identity>, _identityManager: IdentityManager, _keyring: Keyring);
|
|
8
11
|
createIdentity(request: ProfileDocument): Promise<Identity>;
|
|
9
12
|
recoverIdentity(request: RecoverIdentityRequest): Promise<Identity>;
|
|
10
13
|
queryIdentity(): Stream<QueryIdentityResponse>;
|
|
11
14
|
private _getIdentity;
|
|
15
|
+
updateProfile(profile: ProfileDocument): Promise<Identity>;
|
|
12
16
|
signPresentation({ presentation, nonce }: SignPresentationRequest): Promise<Presentation>;
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=identity-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EACL,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE5F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"identity-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/identity/identity-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE5E,qBAAa,mBAAoB,YAAW,eAAe;IAEvD,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAFR,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,QAAQ,CAAC,EACtE,gBAAgB,EAAE,eAAe,EACjC,QAAQ,EAAE,OAAO;IAG9B,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAK3D,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIzE,aAAa,IAAI,MAAM,CAAC,qBAAqB,CAAC;IAS9C,OAAO,CAAC,YAAY;IAYd,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAM1D,gBAAgB,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC;CAWhG"}
|
|
@@ -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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AAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAC7C,OAAO,CAAC,cAAc,CAAC,CAAgB;IACvC,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,OAAO,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;IA6EjB,KAAK;IAeL,KAAK;CAWZ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.1.56-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.1.56-main.5db35f4";
|
|
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.5db35f4",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -21,42 +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/tracing": "0.1.56-main.
|
|
55
|
-
"@dxos/util": "0.1.56-main.
|
|
24
|
+
"@dxos/async": "0.1.56-main.5db35f4",
|
|
25
|
+
"@dxos/client-protocol": "0.1.56-main.5db35f4",
|
|
26
|
+
"@dxos/codec-protobuf": "0.1.56-main.5db35f4",
|
|
27
|
+
"@dxos/config": "0.1.56-main.5db35f4",
|
|
28
|
+
"@dxos/context": "0.1.56-main.5db35f4",
|
|
29
|
+
"@dxos/credentials": "0.1.56-main.5db35f4",
|
|
30
|
+
"@dxos/crypto": "0.1.56-main.5db35f4",
|
|
31
|
+
"@dxos/debug": "0.1.56-main.5db35f4",
|
|
32
|
+
"@dxos/document-model": "0.1.56-main.5db35f4",
|
|
33
|
+
"@dxos/echo-db": "0.1.56-main.5db35f4",
|
|
34
|
+
"@dxos/echo-pipeline": "0.1.56-main.5db35f4",
|
|
35
|
+
"@dxos/errors": "0.1.56-main.5db35f4",
|
|
36
|
+
"@dxos/feed-store": "0.1.56-main.5db35f4",
|
|
37
|
+
"@dxos/invariant": "0.1.56-main.5db35f4",
|
|
38
|
+
"@dxos/keyring": "0.1.56-main.5db35f4",
|
|
39
|
+
"@dxos/keys": "0.1.56-main.5db35f4",
|
|
40
|
+
"@dxos/lock-file": "0.1.56-main.5db35f4",
|
|
41
|
+
"@dxos/log": "0.1.56-main.5db35f4",
|
|
42
|
+
"@dxos/messaging": "0.1.56-main.5db35f4",
|
|
43
|
+
"@dxos/model-factory": "0.1.56-main.5db35f4",
|
|
44
|
+
"@dxos/network-manager": "0.1.56-main.5db35f4",
|
|
45
|
+
"@dxos/node-std": "0.1.56-main.5db35f4",
|
|
46
|
+
"@dxos/protocols": "0.1.56-main.5db35f4",
|
|
47
|
+
"@dxos/random-access-storage": "0.1.56-main.5db35f4",
|
|
48
|
+
"@dxos/rpc": "0.1.56-main.5db35f4",
|
|
49
|
+
"@dxos/teleport": "0.1.56-main.5db35f4",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.1.56-main.5db35f4",
|
|
51
|
+
"@dxos/teleport-extension-object-sync": "0.1.56-main.5db35f4",
|
|
52
|
+
"@dxos/text-model": "0.1.56-main.5db35f4",
|
|
53
|
+
"@dxos/timeframe": "0.1.56-main.5db35f4",
|
|
54
|
+
"@dxos/tracing": "0.1.56-main.5db35f4",
|
|
55
|
+
"@dxos/util": "0.1.56-main.5db35f4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/readable-stream": "^2.3.9",
|
|
59
|
-
"@dxos/signal": "0.1.56-main.
|
|
59
|
+
"@dxos/signal": "0.1.56-main.5db35f4"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
@@ -91,6 +91,17 @@ describe('identity/identity-manager', () => {
|
|
|
91
91
|
// TODO(dmaretskyi): Check that identity is "alive" (space is working and can write mutations).
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
+
test('update profile', async () => {
|
|
95
|
+
const { identityManager } = await setupPeer();
|
|
96
|
+
await identityManager.open(new Context());
|
|
97
|
+
afterTest(() => identityManager.close());
|
|
98
|
+
|
|
99
|
+
const identity = await identityManager.createIdentity();
|
|
100
|
+
expect(identity.profileDocument?.displayName).to.be.undefined;
|
|
101
|
+
await identityManager.updateProfile({ displayName: 'Example' });
|
|
102
|
+
expect(identity.profileDocument?.displayName).to.equal('Example');
|
|
103
|
+
});
|
|
104
|
+
|
|
94
105
|
test('admit another device', async () => {
|
|
95
106
|
const signalContext = new MemorySignalManagerContext();
|
|
96
107
|
|
|
@@ -14,7 +14,7 @@ import { log } from '@dxos/log';
|
|
|
14
14
|
import { trace } from '@dxos/protocols';
|
|
15
15
|
import { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
16
16
|
import { IdentityRecord, SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
17
|
-
import { AdmittedFeed } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
17
|
+
import { AdmittedFeed, ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
18
18
|
import { Timeframe } from '@dxos/timeframe';
|
|
19
19
|
import { trace as Trace } from '@dxos/tracing';
|
|
20
20
|
import { deferFunction } from '@dxos/util';
|
|
@@ -193,6 +193,23 @@ export class IdentityManager {
|
|
|
193
193
|
return identity;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Update the profile document of an existing identity.
|
|
198
|
+
*/
|
|
199
|
+
async updateProfile(profile: ProfileDocument) {
|
|
200
|
+
invariant(this._identity, 'Identity not initialized.');
|
|
201
|
+
// TODO(wittjosiah): Use CredentialGenerator.
|
|
202
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
203
|
+
subject: this._identity.identityKey,
|
|
204
|
+
assertion: {
|
|
205
|
+
'@type': 'dxos.halo.credentials.IdentityProfile',
|
|
206
|
+
profile,
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
const receipt = await this._identity.controlPipeline.writer.write({ credential: { credential } });
|
|
210
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([[receipt.feedKey, receipt.seq]]));
|
|
211
|
+
}
|
|
212
|
+
|
|
196
213
|
private async _constructIdentity(identityRecord: IdentityRecord) {
|
|
197
214
|
invariant(!this._identity);
|
|
198
215
|
log('constructing identity', { identityRecord });
|
|
@@ -24,7 +24,11 @@ describe('IdentityService', () => {
|
|
|
24
24
|
beforeEach(async () => {
|
|
25
25
|
serviceContext = createServiceContext();
|
|
26
26
|
await serviceContext.open(new Context());
|
|
27
|
-
identityService = new IdentityServiceImpl(
|
|
27
|
+
identityService = new IdentityServiceImpl(
|
|
28
|
+
(options) => serviceContext.createIdentity(options),
|
|
29
|
+
serviceContext.identityManager,
|
|
30
|
+
serviceContext.keyring,
|
|
31
|
+
);
|
|
28
32
|
});
|
|
29
33
|
|
|
30
34
|
afterEach(async () => {
|
|
@@ -55,6 +59,16 @@ describe('IdentityService', () => {
|
|
|
55
59
|
|
|
56
60
|
describe.skip('recoverIdentity', () => {});
|
|
57
61
|
|
|
62
|
+
describe('updateProfile', () => {
|
|
63
|
+
test('updates profile', async () => {
|
|
64
|
+
const identity = await identityService.createIdentity({});
|
|
65
|
+
expect(identity.profile?.displayName).to.be.undefined;
|
|
66
|
+
|
|
67
|
+
const updatedIdentity = await identityService.updateProfile({ displayName: 'Example' });
|
|
68
|
+
expect(updatedIdentity.profile?.displayName).to.equal('Example');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
58
72
|
describe('queryIdentity', () => {
|
|
59
73
|
test('returns undefined if no identity is available', async () => {
|
|
60
74
|
const query = identityService.queryIdentity();
|
|
@@ -6,6 +6,7 @@ import { Stream } from '@dxos/codec-protobuf';
|
|
|
6
6
|
import { signPresentation } from '@dxos/credentials';
|
|
7
7
|
import { todo } from '@dxos/debug';
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
|
+
import { Keyring } from '@dxos/keyring';
|
|
9
10
|
import {
|
|
10
11
|
Identity,
|
|
11
12
|
IdentityService,
|
|
@@ -15,15 +16,17 @@ import {
|
|
|
15
16
|
} from '@dxos/protocols/proto/dxos/client/services';
|
|
16
17
|
import { Presentation, ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
17
18
|
|
|
18
|
-
import {
|
|
19
|
+
import { CreateIdentityOptions, IdentityManager } from './identity-manager';
|
|
19
20
|
|
|
20
21
|
export class IdentityServiceImpl implements IdentityService {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
constructor(
|
|
23
|
+
private readonly _createIdentity: (params?: CreateIdentityOptions) => Promise<Identity>,
|
|
24
|
+
private readonly _identityManager: IdentityManager,
|
|
25
|
+
private readonly _keyring: Keyring,
|
|
26
|
+
) {}
|
|
23
27
|
|
|
24
28
|
async createIdentity(request: ProfileDocument): Promise<Identity> {
|
|
25
|
-
await this.
|
|
26
|
-
|
|
29
|
+
await this._createIdentity(request);
|
|
27
30
|
return this._getIdentity()!;
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -36,30 +39,36 @@ export class IdentityServiceImpl implements IdentityService {
|
|
|
36
39
|
const emitNext = () => next({ identity: this._getIdentity() });
|
|
37
40
|
|
|
38
41
|
emitNext();
|
|
39
|
-
return this.
|
|
42
|
+
return this._identityManager.stateUpdate.on(emitNext);
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
private _getIdentity(): Identity | undefined {
|
|
44
|
-
if (!this.
|
|
47
|
+
if (!this._identityManager.identity) {
|
|
45
48
|
return undefined;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
return {
|
|
49
|
-
identityKey: this.
|
|
50
|
-
spaceKey: this.
|
|
51
|
-
profile: this.
|
|
52
|
+
identityKey: this._identityManager.identity.identityKey,
|
|
53
|
+
spaceKey: this._identityManager.identity.space.key,
|
|
54
|
+
profile: this._identityManager.identity.profileDocument,
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
57
|
|
|
58
|
+
async updateProfile(profile: ProfileDocument): Promise<Identity> {
|
|
59
|
+
invariant(this._identityManager.identity, 'Identity not initialized.');
|
|
60
|
+
await this._identityManager.updateProfile(profile);
|
|
61
|
+
return this._getIdentity()!;
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
async signPresentation({ presentation, nonce }: SignPresentationRequest): Promise<Presentation> {
|
|
56
|
-
invariant(this.
|
|
65
|
+
invariant(this._identityManager.identity, 'Identity not initialized.');
|
|
57
66
|
|
|
58
67
|
return await signPresentation({
|
|
59
68
|
presentation,
|
|
60
|
-
signer: this.
|
|
61
|
-
signerKey: this.
|
|
62
|
-
chain: this.
|
|
69
|
+
signer: this._keyring,
|
|
70
|
+
signerKey: this._identityManager.identity.deviceKey,
|
|
71
|
+
chain: this._identityManager.identity.deviceCredentialChain,
|
|
63
72
|
nonce,
|
|
64
73
|
});
|
|
65
74
|
}
|
|
@@ -239,7 +239,11 @@ export class ClientServicesHost {
|
|
|
239
239
|
this._serviceRegistry.setServices({
|
|
240
240
|
SystemService: this._systemService,
|
|
241
241
|
|
|
242
|
-
IdentityService: new IdentityServiceImpl(
|
|
242
|
+
IdentityService: new IdentityServiceImpl(
|
|
243
|
+
(params) => this._serviceContext.createIdentity(params),
|
|
244
|
+
this._serviceContext.identityManager,
|
|
245
|
+
this._serviceContext.keyring,
|
|
246
|
+
),
|
|
243
247
|
|
|
244
248
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) =>
|
|
245
249
|
this._serviceContext.getInvitationHandler(invitation),
|
|
@@ -13,9 +13,11 @@ import { writeMessages } from '@dxos/feed-store';
|
|
|
13
13
|
import { PublicKey } from '@dxos/keys';
|
|
14
14
|
import { log } from '@dxos/log';
|
|
15
15
|
import { SpaceState } from '@dxos/protocols/proto/dxos/client/services';
|
|
16
|
+
import { SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
|
|
16
17
|
import { Epoch } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
17
18
|
import { StorageType } from '@dxos/random-access-storage';
|
|
18
19
|
import { afterTest, describe, openAndClose, test } from '@dxos/test';
|
|
20
|
+
import { Timeframe } from '@dxos/timeframe';
|
|
19
21
|
import { range } from '@dxos/util';
|
|
20
22
|
|
|
21
23
|
import { TestBuilder, syncItemsLocal } from '../testing';
|
|
@@ -156,33 +158,34 @@ describe('DataSpaceManager', () => {
|
|
|
156
158
|
});
|
|
157
159
|
|
|
158
160
|
describe('Epochs', () => {
|
|
159
|
-
test
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
test
|
|
162
|
+
.skip('Epoch truncates feeds', async () => {
|
|
163
|
+
const builder = new TestBuilder();
|
|
164
|
+
afterTest(async () => builder.destroy());
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
const peer = builder.createPeer({
|
|
167
|
+
storageType: typeof window === 'undefined' ? StorageType.NODE : StorageType.WEBFS,
|
|
168
|
+
});
|
|
169
|
+
await peer.createIdentity();
|
|
170
|
+
await openAndClose(peer.dataSpaceManager);
|
|
171
|
+
const space = await peer.dataSpaceManager.createSpace();
|
|
172
|
+
await space.inner.controlPipeline.state.waitUntilTimeframe(space.inner.controlPipeline.state.endTimeframe);
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
const feedDataPath = path.join(space.inner.dataPipeline.pipelineState!.feeds[0].key.toHex(), 'data');
|
|
175
|
+
const directory = peer.storage.createDirectory('feeds');
|
|
176
|
+
const file = directory.getOrCreateFile(feedDataPath);
|
|
177
|
+
afterTest(() => file.close());
|
|
175
178
|
|
|
176
|
-
|
|
179
|
+
expect((await file.stat()).size === 0).to.be.true;
|
|
177
180
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
for (const _ in range(10)) {
|
|
182
|
+
await testLocalDatabase(space.dataPipeline);
|
|
183
|
+
}
|
|
181
184
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
expect((await file.stat()).size !== 0).to.be.true;
|
|
186
|
+
await space.createEpoch();
|
|
187
|
+
expect((await file.stat()).size === 0).to.be.true;
|
|
188
|
+
})
|
|
186
189
|
.onlyEnvironments('nodejs', 'chromium', 'firefox')
|
|
187
190
|
.tag('flaky');
|
|
188
191
|
|
|
@@ -228,6 +231,61 @@ describe('DataSpaceManager', () => {
|
|
|
228
231
|
expect(epochs).to.deep.equal([epochsNumber]);
|
|
229
232
|
}
|
|
230
233
|
});
|
|
234
|
+
|
|
235
|
+
test('Items are cleared before epoch applied', async () => {
|
|
236
|
+
const builder = new TestBuilder();
|
|
237
|
+
afterTest(async () => builder.destroy());
|
|
238
|
+
const peer = builder.createPeer();
|
|
239
|
+
await peer.createIdentity();
|
|
240
|
+
await openAndClose(peer.dataSpaceManager);
|
|
241
|
+
|
|
242
|
+
// Create space and fill it with Items.
|
|
243
|
+
const space = await peer.dataSpaceManager.createSpace();
|
|
244
|
+
await space.inner.controlPipeline.state.waitUntilTimeframe(space.inner.controlPipeline.state.endTimeframe);
|
|
245
|
+
const itemsNumber = 2;
|
|
246
|
+
for (const _ of range(itemsNumber)) {
|
|
247
|
+
await testLocalDatabase(space.dataPipeline);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Create empty Epoch and check if it clears items.
|
|
251
|
+
{
|
|
252
|
+
const processedFirstEpoch = space.dataPipeline.onNewEpoch.waitFor(
|
|
253
|
+
(epoch) => epoch.subject.assertion.number === 1,
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
// Empty snapshot.
|
|
257
|
+
const snapshot: SpaceSnapshot = {
|
|
258
|
+
spaceKey: space.key.asUint8Array(),
|
|
259
|
+
timeframe: space.inner.dataPipeline.pipelineState!.timeframe,
|
|
260
|
+
database: {},
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const snapshotCid = await peer.snapshotStore.saveSnapshot(snapshot);
|
|
264
|
+
|
|
265
|
+
const epoch: Epoch = {
|
|
266
|
+
previousId: space.dataPipeline.currentEpoch?.id,
|
|
267
|
+
timeframe: space.inner.dataPipeline.pipelineState!.timeframe,
|
|
268
|
+
number: (space.dataPipeline.currentEpoch?.subject.assertion as Epoch).number + 1,
|
|
269
|
+
snapshotCid,
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const receipt = await space.inner.controlPipeline.writer.write({
|
|
273
|
+
credential: {
|
|
274
|
+
credential: await peer.props.signingContext!.credentialSigner.createCredential({
|
|
275
|
+
subject: space.key,
|
|
276
|
+
assertion: {
|
|
277
|
+
'@type': 'dxos.halo.credentials.Epoch',
|
|
278
|
+
...epoch,
|
|
279
|
+
},
|
|
280
|
+
}),
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
await space.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe([[receipt.feedKey, receipt.seq]]));
|
|
284
|
+
await processedFirstEpoch;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
expect(Array.from(space.dataPipeline.itemManager.entities.keys()).length).to.equal(0);
|
|
288
|
+
});
|
|
231
289
|
});
|
|
232
290
|
|
|
233
291
|
describe('activation', () => {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "0.1.56-main.
|
|
1
|
+
export const DXOS_VERSION = "0.1.56-main.5db35f4";
|