@dxos/client 2.25.1-dev.0ff9b5c9 → 2.25.1-dev.16862208
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/src/api/echo-proxy.js +6 -6
- package/dist/src/api/halo-proxy.js +10 -10
- package/dist/src/api/party-proxy.js +5 -5
- package/dist/src/client/client-services.test.js +5 -5
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/service-host/services/halo.d.ts +3 -3
- package/dist/src/client/service-host/services/halo.js +3 -3
- package/dist/src/client/service-host/services/party.d.ts +10 -10
- package/dist/src/client/service-host/services/party.js +10 -10
- package/dist/src/client/service-host/services/profile.d.ts +6 -6
- package/dist/src/client/service-host/services/profile.js +6 -6
- package/dist/src/client/service-host/services/services.js +2 -2
- package/dist/src/client/service-host/services/system.js +2 -2
- package/dist/src/devtools/devtools-host.js +19 -19
- package/dist/src/proto/gen/dxos/client.d.ts +21 -21
- package/dist/src/proto/gen/dxos/devtools.d.ts +21 -21
- package/dist/src/proto/gen/dxos/echo/service.d.ts +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/api/echo-proxy.ts +6 -6
- package/src/api/halo-proxy.ts +10 -10
- package/src/api/party-proxy.ts +5 -5
- package/src/client/client-services.test.ts +5 -5
- package/src/client/client.ts +1 -1
- package/src/client/service-host/services/halo.ts +3 -3
- package/src/client/service-host/services/party.ts +10 -10
- package/src/client/service-host/services/profile.ts +6 -6
- package/src/client/service-host/services/services.ts +2 -2
- package/src/client/service-host/services/system.ts +2 -2
- package/src/devtools/devtools-host.ts +19 -19
- package/src/proto/gen/dxos/client.ts +21 -21
- package/src/proto/gen/dxos/devtools.ts +21 -21
- package/src/proto/gen/dxos/echo/service.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client",
|
|
3
|
-
"version": "2.25.1-dev.
|
|
3
|
+
"version": "2.25.1-dev.16862208",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"author": "DXOS.org",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dxos/async": "2.25.1-dev.
|
|
14
|
-
"@dxos/codec-protobuf": "2.25.1-dev.
|
|
15
|
-
"@dxos/config": "2.25.1-dev.
|
|
16
|
-
"@dxos/credentials": "2.25.1-dev.
|
|
17
|
-
"@dxos/crypto": "2.25.1-dev.
|
|
18
|
-
"@dxos/debug": "2.25.1-dev.
|
|
19
|
-
"@dxos/echo-db": "2.25.1-dev.
|
|
20
|
-
"@dxos/echo-protocol": "2.25.1-dev.
|
|
21
|
-
"@dxos/feed-store": "2.25.1-dev.
|
|
22
|
-
"@dxos/model-factory": "2.25.1-dev.
|
|
23
|
-
"@dxos/network-manager": "2.25.1-dev.
|
|
24
|
-
"@dxos/object-model": "2.25.1-dev.
|
|
25
|
-
"@dxos/proto": "2.25.1-dev.
|
|
26
|
-
"@dxos/rpc": "2.25.1-dev.
|
|
27
|
-
"@dxos/util": "2.25.1-dev.
|
|
13
|
+
"@dxos/async": "2.25.1-dev.16862208",
|
|
14
|
+
"@dxos/codec-protobuf": "2.25.1-dev.16862208",
|
|
15
|
+
"@dxos/config": "2.25.1-dev.16862208",
|
|
16
|
+
"@dxos/credentials": "2.25.1-dev.16862208",
|
|
17
|
+
"@dxos/crypto": "2.25.1-dev.16862208",
|
|
18
|
+
"@dxos/debug": "2.25.1-dev.16862208",
|
|
19
|
+
"@dxos/echo-db": "2.25.1-dev.16862208",
|
|
20
|
+
"@dxos/echo-protocol": "2.25.1-dev.16862208",
|
|
21
|
+
"@dxos/feed-store": "2.25.1-dev.16862208",
|
|
22
|
+
"@dxos/model-factory": "2.25.1-dev.16862208",
|
|
23
|
+
"@dxos/network-manager": "2.25.1-dev.16862208",
|
|
24
|
+
"@dxos/object-model": "2.25.1-dev.16862208",
|
|
25
|
+
"@dxos/proto": "2.25.1-dev.16862208",
|
|
26
|
+
"@dxos/rpc": "2.25.1-dev.16862208",
|
|
27
|
+
"@dxos/util": "2.25.1-dev.16862208",
|
|
28
28
|
"@polkadot/keyring": "6.11.1",
|
|
29
29
|
"@polkadot/util": "6.11.1",
|
|
30
30
|
"@polkadot/util-crypto": "6.11.1",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"uuid": "^8.3.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@dxos/random-access-multi-storage": "2.25.1-dev.
|
|
44
|
+
"@dxos/random-access-multi-storage": "2.25.1-dev.16862208",
|
|
45
45
|
"@dxos/testutils": "2.25.0",
|
|
46
46
|
"@dxos/toolchain-node-library": "2.25.0",
|
|
47
47
|
"@types/debug": "^4.1.7",
|
package/src/api/echo-proxy.ts
CHANGED
|
@@ -66,7 +66,7 @@ export class EchoProxy {
|
|
|
66
66
|
async _open () {
|
|
67
67
|
const gotParties = this._partiesChanged.waitForCount(1);
|
|
68
68
|
|
|
69
|
-
const partiesStream = this._serviceProvider.services.PartyService.
|
|
69
|
+
const partiesStream = this._serviceProvider.services.PartyService.subscribeParties();
|
|
70
70
|
partiesStream.subscribe(async data => {
|
|
71
71
|
for (const party of data.parties ?? []) {
|
|
72
72
|
if (!this._parties.has(party.publicKey)) {
|
|
@@ -81,7 +81,7 @@ export class EchoProxy {
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
const partyStream = this._serviceProvider.services.PartyService.
|
|
84
|
+
const partyStream = this._serviceProvider.services.PartyService.subscribeToParty({ partyKey: party.publicKey });
|
|
85
85
|
partyStream.subscribe(async ({ party }) => {
|
|
86
86
|
if (!party) {
|
|
87
87
|
return;
|
|
@@ -121,7 +121,7 @@ export class EchoProxy {
|
|
|
121
121
|
async createParty (): Promise<Party> {
|
|
122
122
|
const [partyReceivedPromise, partyReceived] = latch();
|
|
123
123
|
|
|
124
|
-
const party = await this._serviceProvider.services.PartyService.
|
|
124
|
+
const party = await this._serviceProvider.services.PartyService.createParty();
|
|
125
125
|
|
|
126
126
|
const handler = () => {
|
|
127
127
|
if (this._parties.has(party.publicKey)) {
|
|
@@ -142,7 +142,7 @@ export class EchoProxy {
|
|
|
142
142
|
async cloneParty (snapshot: PartySnapshot): Promise<Party> {
|
|
143
143
|
const [partyReceivedPromise, partyReceived] = latch();
|
|
144
144
|
|
|
145
|
-
const party = await this._serviceProvider.services.PartyService.
|
|
145
|
+
const party = await this._serviceProvider.services.PartyService.cloneParty(snapshot);
|
|
146
146
|
|
|
147
147
|
const handler = () => {
|
|
148
148
|
if (this._parties.has(party.publicKey)) {
|
|
@@ -174,12 +174,12 @@ export class EchoProxy {
|
|
|
174
174
|
* To be used with `party.createInvitation` on the inviter side.
|
|
175
175
|
*/
|
|
176
176
|
acceptInvitation (invitationDescriptor: InvitationDescriptor): PartyInvitation {
|
|
177
|
-
const invitationProcessStream = this._serviceProvider.services.PartyService.
|
|
177
|
+
const invitationProcessStream = this._serviceProvider.services.PartyService.acceptInvitation(invitationDescriptor.toProto());
|
|
178
178
|
const { authenticate, waitForFinish } = InvitationProxy.handleInvitationRedemption({
|
|
179
179
|
stream: invitationProcessStream,
|
|
180
180
|
invitationDescriptor,
|
|
181
181
|
onAuthenticate: async (request) => {
|
|
182
|
-
await this._serviceProvider.services.PartyService.
|
|
182
|
+
await this._serviceProvider.services.PartyService.authenticateInvitation(request);
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
|
package/src/api/halo-proxy.ts
CHANGED
|
@@ -43,7 +43,7 @@ export class HaloProxy extends InvitationProxy {
|
|
|
43
43
|
* Reset the identity and delete all key records.
|
|
44
44
|
*/
|
|
45
45
|
async reset () {
|
|
46
|
-
await this._serviceProvider.services.SystemService.
|
|
46
|
+
await this._serviceProvider.services.SystemService.reset();
|
|
47
47
|
this._profileChanged.emit();
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -58,7 +58,7 @@ export class HaloProxy extends InvitationProxy {
|
|
|
58
58
|
* @returns User profile info.
|
|
59
59
|
*/
|
|
60
60
|
async createProfile ({ publicKey, secretKey, username }: CreateProfileOptions = {}): Promise<Profile> {
|
|
61
|
-
this._profile = await this._serviceProvider.services.ProfileService.
|
|
61
|
+
this._profile = await this._serviceProvider.services.ProfileService.createProfile({ publicKey, secretKey, username });
|
|
62
62
|
return this._profile;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -73,7 +73,7 @@ export class HaloProxy extends InvitationProxy {
|
|
|
73
73
|
* Joins an existing identity HALO from a recovery seed phrase.
|
|
74
74
|
*/
|
|
75
75
|
async recoverProfile (seedPhrase: string) {
|
|
76
|
-
this._profile = await this._serviceProvider.services.ProfileService.
|
|
76
|
+
this._profile = await this._serviceProvider.services.ProfileService.recoverProfile({ seedPhrase });
|
|
77
77
|
return this._profile;
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -86,7 +86,7 @@ export class HaloProxy extends InvitationProxy {
|
|
|
86
86
|
* To be used with `client.halo.joinHaloInvitation` on the invitee side.
|
|
87
87
|
*/
|
|
88
88
|
async createInvitation (): Promise<InvitationRequest> {
|
|
89
|
-
const stream = await this._serviceProvider.services.ProfileService.
|
|
89
|
+
const stream = await this._serviceProvider.services.ProfileService.createInvitation();
|
|
90
90
|
return this.createInvitationRequest({ stream });
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -99,12 +99,12 @@ export class HaloProxy extends InvitationProxy {
|
|
|
99
99
|
* To be used with `client.halo.createHaloInvitation` on the inviter side.
|
|
100
100
|
*/
|
|
101
101
|
acceptInvitation (invitationDescriptor: InvitationDescriptor): Invitation {
|
|
102
|
-
const invitationProcessStream = this._serviceProvider.services.ProfileService.
|
|
102
|
+
const invitationProcessStream = this._serviceProvider.services.ProfileService.acceptInvitation(invitationDescriptor.toProto());
|
|
103
103
|
const { authenticate, waitForFinish } = InvitationProxy.handleInvitationRedemption({
|
|
104
104
|
stream: invitationProcessStream,
|
|
105
105
|
invitationDescriptor,
|
|
106
106
|
onAuthenticate: async (request) => {
|
|
107
|
-
await this._serviceProvider.services.ProfileService.
|
|
107
|
+
await this._serviceProvider.services.ProfileService.authenticateInvitation(request);
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -121,11 +121,11 @@ export class HaloProxy extends InvitationProxy {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
async addKeyRecord (keyRecord: KeyRecord) {
|
|
124
|
-
await this._serviceProvider.services.HaloService.
|
|
124
|
+
await this._serviceProvider.services.HaloService.addKeyRecord({ keyRecord });
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
async sign (request: SignRequest) {
|
|
128
|
-
return await this._serviceProvider.services.HaloService.
|
|
128
|
+
return await this._serviceProvider.services.HaloService.sign(request);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
@@ -137,14 +137,14 @@ export class HaloProxy extends InvitationProxy {
|
|
|
137
137
|
const gotProfile = this._profileChanged.waitForCount(1);
|
|
138
138
|
const gotContacts = this._contactsChanged.waitForCount(1);
|
|
139
139
|
|
|
140
|
-
const profileStream = this._serviceProvider.services.ProfileService.
|
|
140
|
+
const profileStream = this._serviceProvider.services.ProfileService.subscribeProfile();
|
|
141
141
|
profileStream.subscribe(data => {
|
|
142
142
|
this._profile = data.profile;
|
|
143
143
|
this._profileChanged.emit();
|
|
144
144
|
}, () => {});
|
|
145
145
|
this._subscriptions.push(() => profileStream.close());
|
|
146
146
|
|
|
147
|
-
const contactsStream = this._serviceProvider.services.HaloService.
|
|
147
|
+
const contactsStream = this._serviceProvider.services.HaloService.subscribeContacts();
|
|
148
148
|
contactsStream.subscribe(data => {
|
|
149
149
|
this._contacts = data.contacts as PartyMember[];
|
|
150
150
|
this._contactsChanged.emit();
|
package/src/api/party-proxy.ts
CHANGED
|
@@ -109,7 +109,7 @@ export class Party extends InvitationProxy {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
async setOpen (open: boolean) {
|
|
112
|
-
await this._serviceProvider.services.PartyService.
|
|
112
|
+
await this._serviceProvider.services.PartyService.setPartyState({
|
|
113
113
|
partyKey: this.key,
|
|
114
114
|
open
|
|
115
115
|
});
|
|
@@ -118,7 +118,7 @@ export class Party extends InvitationProxy {
|
|
|
118
118
|
async setActive (active: boolean, options: ActivationOptions) {
|
|
119
119
|
const activeGlobal = options.global ? active : undefined;
|
|
120
120
|
const activeDevice = options.device ? active : undefined;
|
|
121
|
-
await this._serviceProvider.services.PartyService.
|
|
121
|
+
await this._serviceProvider.services.PartyService.setPartyState({
|
|
122
122
|
partyKey: this.key,
|
|
123
123
|
activeGlobal,
|
|
124
124
|
activeDevice
|
|
@@ -143,13 +143,13 @@ export class Party extends InvitationProxy {
|
|
|
143
143
|
* @param inviteeKey Public key of the invitee. In this case no secret exchange is required, but only the specified recipient can accept the invitation.
|
|
144
144
|
*/
|
|
145
145
|
async createInvitation ({ inviteeKey }: CreationInvitationOptions = {}): Promise<InvitationRequest> {
|
|
146
|
-
const stream = this._serviceProvider.services.PartyService.
|
|
146
|
+
const stream = this._serviceProvider.services.PartyService.createInvitation({ partyKey: this.key, inviteeKey });
|
|
147
147
|
return this.createInvitationRequest({ stream });
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
queryMembers () {
|
|
151
151
|
return streamToResultSet(
|
|
152
|
-
this._serviceProvider.services.PartyService.
|
|
152
|
+
this._serviceProvider.services.PartyService.subscribeMembers({ partyKey: this.key }),
|
|
153
153
|
(response) => response?.members ?? []
|
|
154
154
|
);
|
|
155
155
|
}
|
|
@@ -176,6 +176,6 @@ export class Party extends InvitationProxy {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
createSnapshot () {
|
|
179
|
-
return this._serviceProvider.services.PartyService.
|
|
179
|
+
return this._serviceProvider.services.PartyService.createSnapshot({ partyKey: this.key });
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -31,24 +31,24 @@ describe('Client Services', () => {
|
|
|
31
31
|
const invitee = await setup();
|
|
32
32
|
afterTest(() => invitee.client.destroy());
|
|
33
33
|
|
|
34
|
-
await inviter.services.ProfileService.
|
|
34
|
+
await inviter.services.ProfileService.createProfile({ username: 'test-user' });
|
|
35
35
|
|
|
36
36
|
const invitation = await new Promise<InvitationRequest>((resolve, reject) => {
|
|
37
|
-
inviter.services.ProfileService.
|
|
37
|
+
inviter.services.ProfileService.createInvitation().subscribe(resolve, reject);
|
|
38
38
|
});
|
|
39
39
|
assert(invitation.descriptor);
|
|
40
40
|
|
|
41
41
|
const redeemedInvitation = await new Promise<RedeemedInvitation>((resolve, reject) => {
|
|
42
|
-
invitee.services.ProfileService.
|
|
42
|
+
invitee.services.ProfileService.acceptInvitation(invitation.descriptor!).subscribe(resolve, reject);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
await invitee.services.ProfileService.
|
|
45
|
+
await invitee.services.ProfileService.authenticateInvitation({
|
|
46
46
|
processId: redeemedInvitation.id,
|
|
47
47
|
secret: invitation.descriptor.secret
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
const [inviteeProfileLatch, inviteeProfileTrigger] = latch();
|
|
51
|
-
invitee.services.ProfileService.
|
|
51
|
+
invitee.services.ProfileService.subscribeProfile().subscribe(inviteeProfile => {
|
|
52
52
|
if (inviteeProfile.profile?.username === 'test-user') {
|
|
53
53
|
inviteeProfileTrigger();
|
|
54
54
|
}
|
package/src/client/client.ts
CHANGED
|
@@ -233,7 +233,7 @@ export class Client {
|
|
|
233
233
|
// Recreate echo instance? Big impact on hooks. Test.
|
|
234
234
|
@synchronized
|
|
235
235
|
async reset () {
|
|
236
|
-
await this.services.SystemService.
|
|
236
|
+
await this.services.SystemService.reset();
|
|
237
237
|
this._initialized = false;
|
|
238
238
|
}
|
|
239
239
|
|
|
@@ -19,7 +19,7 @@ import { CreateServicesOpts } from './interfaces';
|
|
|
19
19
|
export class HaloService implements IHaloService {
|
|
20
20
|
constructor (private echo: ECHO) {}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
subscribeContacts (): Stream<Contacts> {
|
|
23
23
|
if (this.echo.halo.isInitialized) {
|
|
24
24
|
return resultSetToStream(this.echo.halo.queryContacts(), (contacts): Contacts => ({ contacts }));
|
|
25
25
|
} else {
|
|
@@ -44,7 +44,7 @@ export class HaloService implements IHaloService {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
async
|
|
47
|
+
async addKeyRecord (request: AddKeyRecordRequest): Promise<void> {
|
|
48
48
|
assert(request.keyRecord && request.keyRecord.publicKey, 'Missing key record.');
|
|
49
49
|
await this.echo.halo.keyring.addKeyRecord(request.keyRecord);
|
|
50
50
|
assert(await this.echo.halo.keyring.getKey(request.keyRecord.publicKey), 'Key not inserted correctly.');
|
|
@@ -64,7 +64,7 @@ export class HaloService implements IHaloService {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
async
|
|
67
|
+
async sign (request: SignRequest): Promise<SignResponse> {
|
|
68
68
|
assert(request.publicKey, 'Provide a publicKey of the key that should be used for signing.');
|
|
69
69
|
const key = await this.echo.halo.keyring.getFullKey(request.publicKey);
|
|
70
70
|
assert(key, 'Key not found.');
|
|
@@ -37,7 +37,7 @@ class PartyService implements IPartyService {
|
|
|
37
37
|
|
|
38
38
|
constructor (private echo: ECHO) {}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
subscribeToParty (request: SubscribePartyRequest): Stream<SubscribePartyResponse> {
|
|
41
41
|
const update = (next: (message: SubscribePartyResponse) => void) => {
|
|
42
42
|
try {
|
|
43
43
|
const party = this.echo.getParty(request.partyKey);
|
|
@@ -83,7 +83,7 @@ class PartyService implements IPartyService {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
subscribeParties () {
|
|
87
87
|
return resultSetToStream(this.echo.queryParties(), (parties): SubscribePartiesResponse => {
|
|
88
88
|
return ({
|
|
89
89
|
parties: parties.map(party => ({
|
|
@@ -96,7 +96,7 @@ class PartyService implements IPartyService {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
async
|
|
99
|
+
async createParty () {
|
|
100
100
|
const party = await this.echo.createParty();
|
|
101
101
|
return {
|
|
102
102
|
publicKey: party.key,
|
|
@@ -105,7 +105,7 @@ class PartyService implements IPartyService {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
async
|
|
108
|
+
async cloneParty (snapshot: PartySnapshot): Promise<Party> {
|
|
109
109
|
const party = await this.echo.cloneParty(snapshot);
|
|
110
110
|
return {
|
|
111
111
|
publicKey: party.key,
|
|
@@ -114,7 +114,7 @@ class PartyService implements IPartyService {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
async
|
|
117
|
+
async setPartyState (request: SetPartyStateRequest) {
|
|
118
118
|
const party = this.echo.getParty(request.partyKey);
|
|
119
119
|
if (!party) {
|
|
120
120
|
throw new Error('Party not found');
|
|
@@ -144,7 +144,7 @@ class PartyService implements IPartyService {
|
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
createInvitation (request: CreateInvitationRequest): Stream<InvitationRequest> {
|
|
148
148
|
return new Stream(({ next, close }) => {
|
|
149
149
|
const party = this.echo.getParty(request.partyKey) ?? raise(new PartyNotFoundError(request.partyKey));
|
|
150
150
|
setImmediate(async () => {
|
|
@@ -185,7 +185,7 @@ class PartyService implements IPartyService {
|
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
acceptInvitation (request: InvitationDescriptorProto): Stream<RedeemedInvitation> {
|
|
189
189
|
return new Stream(({ next, close }) => {
|
|
190
190
|
const id = v4();
|
|
191
191
|
const [secretLatch, secretTrigger] = latch();
|
|
@@ -221,7 +221,7 @@ class PartyService implements IPartyService {
|
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
async
|
|
224
|
+
async authenticateInvitation (request: AuthenticateInvitationRequest) {
|
|
225
225
|
assert(request.processId, 'Process ID is missing.');
|
|
226
226
|
const invitation = this.inviteeInvitations.get(request.processId);
|
|
227
227
|
assert(invitation, 'Invitation not found.');
|
|
@@ -232,7 +232,7 @@ class PartyService implements IPartyService {
|
|
|
232
232
|
invitation.secretTrigger?.();
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
subscribeMembers (request: SubscribeMembersRequest): Stream<SubscribeMembersResponse> {
|
|
236
236
|
const party = this.echo.getParty(request.partyKey);
|
|
237
237
|
if (party) {
|
|
238
238
|
return resultSetToStream(party.queryMembers(), (members): SubscribeMembersResponse => ({ members }));
|
|
@@ -256,7 +256,7 @@ class PartyService implements IPartyService {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
async
|
|
259
|
+
async createSnapshot (request: CreateSnaspotRequest): Promise<PartySnapshot> {
|
|
260
260
|
assert(request.partyKey);
|
|
261
261
|
const party = this.echo.getParty(request.partyKey) ?? raise(new PartyNotFoundError(request.partyKey));
|
|
262
262
|
return party.createSnapshot();
|
|
@@ -21,7 +21,7 @@ export class ProfileService implements IProfileService {
|
|
|
21
21
|
|
|
22
22
|
constructor (private echo: ECHO) {}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
subscribeProfile (): Stream<SubscribeProfileResponse> {
|
|
25
25
|
return new Stream(({ next }) => {
|
|
26
26
|
const emitNext = () => next({
|
|
27
27
|
profile: this.echo.halo.isInitialized ? this.echo.halo.getProfile() : undefined
|
|
@@ -32,11 +32,11 @@ export class ProfileService implements IProfileService {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
async
|
|
35
|
+
async createProfile (request: CreateProfileRequest) {
|
|
36
36
|
return this.echo.halo.createProfile(request);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
async
|
|
39
|
+
async recoverProfile (request: RecoverProfileRequest): Promise<Profile> {
|
|
40
40
|
if (!request.seedPhrase) {
|
|
41
41
|
throw new Error('Recovery SeedPhrase not provided.');
|
|
42
42
|
}
|
|
@@ -47,7 +47,7 @@ export class ProfileService implements IProfileService {
|
|
|
47
47
|
return profile;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
createInvitation (): Stream<InvitationRequest> {
|
|
51
51
|
return new Stream(({ next, close }) => {
|
|
52
52
|
setImmediate(async () => {
|
|
53
53
|
const secret = Buffer.from(generatePasscode());
|
|
@@ -71,7 +71,7 @@ export class ProfileService implements IProfileService {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
acceptInvitation (request: InvitationDescriptorProto): Stream<RedeemedInvitation> {
|
|
75
75
|
return new Stream(({ next, close }) => {
|
|
76
76
|
const id = v4();
|
|
77
77
|
const [secretLatch, secretTrigger] = latch();
|
|
@@ -101,7 +101,7 @@ export class ProfileService implements IProfileService {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
async
|
|
104
|
+
async authenticateInvitation (request: AuthenticateInvitationRequest) {
|
|
105
105
|
assert(request.processId, 'Process ID is missing.');
|
|
106
106
|
const invitation = this.inviteeInvitations.get(request.processId);
|
|
107
107
|
assert(invitation, 'Invitation not found.');
|
|
@@ -17,10 +17,10 @@ export const createServices = (opts: CreateServicesOpts): Omit<ClientServices, '
|
|
|
17
17
|
PartyService: createPartyService(opts),
|
|
18
18
|
DataService: opts.echo.dataService,
|
|
19
19
|
TracingService: {
|
|
20
|
-
|
|
20
|
+
setTracingOptions: () => {
|
|
21
21
|
throw new Error('Tracing not available');
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
subscribeToRpcTrace: () => {
|
|
24
24
|
throw new Error('Tracing not available');
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -7,7 +7,7 @@ import { CreateServicesOpts } from './interfaces';
|
|
|
7
7
|
|
|
8
8
|
export const createSystemService = ({ config, echo }: CreateServicesOpts): SystemService => {
|
|
9
9
|
return {
|
|
10
|
-
|
|
10
|
+
getConfig: async () => {
|
|
11
11
|
return {
|
|
12
12
|
...config.values,
|
|
13
13
|
build: {
|
|
@@ -16,7 +16,7 @@ export const createSystemService = ({ config, echo }: CreateServicesOpts): Syste
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
reset: async () => {
|
|
20
20
|
await echo.reset();
|
|
21
21
|
}
|
|
22
22
|
};
|
|
@@ -24,68 +24,68 @@ import { resetStorage } from './storage';
|
|
|
24
24
|
|
|
25
25
|
export const createDevtoolsHost = (context: DevtoolsServiceDependencies, events: DevtoolsHostEvents) : DevtoolsHost => {
|
|
26
26
|
return {
|
|
27
|
-
|
|
27
|
+
events: () => {
|
|
28
28
|
return new Stream<ClientAPIEvent>(({ next }) => {
|
|
29
29
|
events.ready.on(() => {
|
|
30
30
|
next({ ready: {} });
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
getConfig: async () => {
|
|
35
35
|
const config = getConfig(context);
|
|
36
36
|
return config;
|
|
37
37
|
},
|
|
38
|
-
|
|
38
|
+
resetStorage: async () => {
|
|
39
39
|
await resetStorage(context);
|
|
40
40
|
},
|
|
41
|
-
|
|
41
|
+
enableDebugLogging: async (request) => {
|
|
42
42
|
enableDebugLogging(context, request);
|
|
43
43
|
return {};
|
|
44
44
|
},
|
|
45
|
-
|
|
45
|
+
disableDebugLogging: async () => {
|
|
46
46
|
disableDebugLogging(context);
|
|
47
47
|
return {};
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
subscribeToKeyringKeys: () => {
|
|
50
50
|
return subscribeToKeyringKeys(context);
|
|
51
51
|
},
|
|
52
|
-
|
|
52
|
+
subscribeToCredentialMessages: (request) => {
|
|
53
53
|
return subscribeToCredentialMessages(context, request);
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
subscribeToParties: () => {
|
|
56
56
|
return subscribeToParties(context);
|
|
57
57
|
},
|
|
58
|
-
|
|
58
|
+
subscribeToItems: () => {
|
|
59
59
|
return subscribeToItems(context);
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
subscribeToFeeds: () => {
|
|
62
62
|
return subscribeToFeeds(context);
|
|
63
63
|
},
|
|
64
|
-
|
|
64
|
+
subscribeToFeed: (request) => {
|
|
65
65
|
return subscribeToFeed(context, request);
|
|
66
66
|
},
|
|
67
|
-
|
|
67
|
+
getPartySnapshot: async (request) => {
|
|
68
68
|
return getPartySnapshot(context, request);
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
savePartySnapshot: async (request) => {
|
|
71
71
|
return savePartySnapshot(context, request);
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
clearSnapshots: async () => {
|
|
74
74
|
await context.echo.snapshotStore.clear();
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
getNetworkPeers: async (request) => {
|
|
77
77
|
return getNetworkPeers(context, request);
|
|
78
78
|
},
|
|
79
|
-
|
|
79
|
+
subscribeToNetworkTopics: () => {
|
|
80
80
|
return subscribeToNetworkTopics(context);
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
subscribeToSignalStatus: () => {
|
|
83
83
|
return subscribeToNetworkStatus(context);
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
subscribeToSignalTrace: () => {
|
|
86
86
|
return subscribeToSignalTrace(context);
|
|
87
87
|
},
|
|
88
|
-
|
|
88
|
+
subscribeToSwarmInfo: () => {
|
|
89
89
|
return subscribeToSwarmInfo(context);
|
|
90
90
|
}
|
|
91
91
|
};
|
|
@@ -11,8 +11,8 @@ import * as dxos_halo_keys from "./halo/keys";
|
|
|
11
11
|
import * as dxos_rpc from "./rpc";
|
|
12
12
|
import * as google_protobuf from "../google/protobuf";
|
|
13
13
|
export interface SystemService {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
getConfig: (request: void) => Promise<dxos_config.Config>;
|
|
15
|
+
reset: (request: void) => Promise<void>;
|
|
16
16
|
}
|
|
17
17
|
export enum InvitationState {
|
|
18
18
|
WAITING_FOR_CONNECTION = 1,
|
|
@@ -76,12 +76,12 @@ export interface Contacts {
|
|
|
76
76
|
contacts?: Contact[];
|
|
77
77
|
}
|
|
78
78
|
export interface ProfileService {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
subscribeProfile: (request: void) => Stream<SubscribeProfileResponse>;
|
|
80
|
+
createProfile: (request: CreateProfileRequest) => Promise<Profile>;
|
|
81
|
+
recoverProfile: (request: RecoverProfileRequest) => Promise<Profile>;
|
|
82
|
+
createInvitation: (request: void) => Stream<InvitationRequest>;
|
|
83
|
+
acceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
|
|
84
|
+
authenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
|
|
85
85
|
}
|
|
86
86
|
export interface AddKeyRecordRequest {
|
|
87
87
|
keyRecord?: dxos_halo_keys.KeyRecord;
|
|
@@ -97,9 +97,9 @@ export interface SignResponse {
|
|
|
97
97
|
signed?: ReturnType<typeof substitutions["google.protobuf.Any"]["decode"]>;
|
|
98
98
|
}
|
|
99
99
|
export interface HaloService {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
subscribeContacts: (request: void) => Stream<Contacts>;
|
|
101
|
+
addKeyRecord: (request: AddKeyRecordRequest) => Promise<void>;
|
|
102
|
+
sign: (request: SignRequest) => Promise<SignResponse>;
|
|
103
103
|
}
|
|
104
104
|
export interface Party {
|
|
105
105
|
publicKey: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
|
|
@@ -155,17 +155,17 @@ export interface CreateSnaspotRequest {
|
|
|
155
155
|
partyKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
|
|
156
156
|
}
|
|
157
157
|
export interface PartyService {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
subscribeToParty: (request: SubscribePartyRequest) => Stream<SubscribePartyResponse>;
|
|
159
|
+
subscribeParties: (request: void) => Stream<SubscribePartiesResponse>;
|
|
160
|
+
createParty: (request: void) => Promise<Party>;
|
|
161
|
+
cloneParty: (request: dxos_echo_snapshot.PartySnapshot) => Promise<Party>;
|
|
162
162
|
/**
|
|
163
163
|
* Open and close or activate and deactivate a party.
|
|
164
164
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
setPartyState: (request: SetPartyStateRequest) => Promise<Party>;
|
|
166
|
+
createInvitation: (request: CreateInvitationRequest) => Stream<InvitationRequest>;
|
|
167
|
+
acceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
|
|
168
|
+
authenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
|
|
169
|
+
subscribeMembers: (request: SubscribeMembersRequest) => Stream<SubscribeMembersResponse>;
|
|
170
|
+
createSnapshot: (request: CreateSnaspotRequest) => Promise<dxos_echo_snapshot.PartySnapshot>;
|
|
171
171
|
}
|