@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
|
@@ -55,7 +55,7 @@ class EchoProxy {
|
|
|
55
55
|
*/
|
|
56
56
|
async _open() {
|
|
57
57
|
const gotParties = this._partiesChanged.waitForCount(1);
|
|
58
|
-
const partiesStream = this._serviceProvider.services.PartyService.
|
|
58
|
+
const partiesStream = this._serviceProvider.services.PartyService.subscribeParties();
|
|
59
59
|
partiesStream.subscribe(async (data) => {
|
|
60
60
|
var _a;
|
|
61
61
|
for (const party of (_a = data.parties) !== null && _a !== void 0 ? _a : []) {
|
|
@@ -69,7 +69,7 @@ class EchoProxy {
|
|
|
69
69
|
this._partiesChanged.emit(); // Trigger for `queryParties()` when a party is updated.
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
const partyStream = this._serviceProvider.services.PartyService.
|
|
72
|
+
const partyStream = this._serviceProvider.services.PartyService.subscribeToParty({ partyKey: party.publicKey });
|
|
73
73
|
partyStream.subscribe(async ({ party }) => {
|
|
74
74
|
if (!party) {
|
|
75
75
|
return;
|
|
@@ -102,7 +102,7 @@ class EchoProxy {
|
|
|
102
102
|
*/
|
|
103
103
|
async createParty() {
|
|
104
104
|
const [partyReceivedPromise, partyReceived] = (0, async_1.latch)();
|
|
105
|
-
const party = await this._serviceProvider.services.PartyService.
|
|
105
|
+
const party = await this._serviceProvider.services.PartyService.createParty();
|
|
106
106
|
const handler = () => {
|
|
107
107
|
if (this._parties.has(party.publicKey)) {
|
|
108
108
|
partyReceived();
|
|
@@ -119,7 +119,7 @@ class EchoProxy {
|
|
|
119
119
|
*/
|
|
120
120
|
async cloneParty(snapshot) {
|
|
121
121
|
const [partyReceivedPromise, partyReceived] = (0, async_1.latch)();
|
|
122
|
-
const party = await this._serviceProvider.services.PartyService.
|
|
122
|
+
const party = await this._serviceProvider.services.PartyService.cloneParty(snapshot);
|
|
123
123
|
const handler = () => {
|
|
124
124
|
if (this._parties.has(party.publicKey)) {
|
|
125
125
|
partyReceived();
|
|
@@ -146,12 +146,12 @@ class EchoProxy {
|
|
|
146
146
|
* To be used with `party.createInvitation` on the inviter side.
|
|
147
147
|
*/
|
|
148
148
|
acceptInvitation(invitationDescriptor) {
|
|
149
|
-
const invitationProcessStream = this._serviceProvider.services.PartyService.
|
|
149
|
+
const invitationProcessStream = this._serviceProvider.services.PartyService.acceptInvitation(invitationDescriptor.toProto());
|
|
150
150
|
const { authenticate, waitForFinish } = invitations_1.InvitationProxy.handleInvitationRedemption({
|
|
151
151
|
stream: invitationProcessStream,
|
|
152
152
|
invitationDescriptor,
|
|
153
153
|
onAuthenticate: async (request) => {
|
|
154
|
-
await this._serviceProvider.services.PartyService.
|
|
154
|
+
await this._serviceProvider.services.PartyService.authenticateInvitation(request);
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
const waitForParty = async () => {
|
|
@@ -31,7 +31,7 @@ class HaloProxy extends invitations_1.InvitationProxy {
|
|
|
31
31
|
* Reset the identity and delete all key records.
|
|
32
32
|
*/
|
|
33
33
|
async reset() {
|
|
34
|
-
await this._serviceProvider.services.SystemService.
|
|
34
|
+
await this._serviceProvider.services.SystemService.reset();
|
|
35
35
|
this._profileChanged.emit();
|
|
36
36
|
}
|
|
37
37
|
// TODO(burdon): Should be part of profile object. Or use standard Result object.
|
|
@@ -44,7 +44,7 @@ class HaloProxy extends invitations_1.InvitationProxy {
|
|
|
44
44
|
* @returns User profile info.
|
|
45
45
|
*/
|
|
46
46
|
async createProfile({ publicKey, secretKey, username } = {}) {
|
|
47
|
-
this._profile = await this._serviceProvider.services.ProfileService.
|
|
47
|
+
this._profile = await this._serviceProvider.services.ProfileService.createProfile({ publicKey, secretKey, username });
|
|
48
48
|
return this._profile;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -57,7 +57,7 @@ class HaloProxy extends invitations_1.InvitationProxy {
|
|
|
57
57
|
* Joins an existing identity HALO from a recovery seed phrase.
|
|
58
58
|
*/
|
|
59
59
|
async recoverProfile(seedPhrase) {
|
|
60
|
-
this._profile = await this._serviceProvider.services.ProfileService.
|
|
60
|
+
this._profile = await this._serviceProvider.services.ProfileService.recoverProfile({ seedPhrase });
|
|
61
61
|
return this._profile;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -69,7 +69,7 @@ class HaloProxy extends invitations_1.InvitationProxy {
|
|
|
69
69
|
* To be used with `client.halo.joinHaloInvitation` on the invitee side.
|
|
70
70
|
*/
|
|
71
71
|
async createInvitation() {
|
|
72
|
-
const stream = await this._serviceProvider.services.ProfileService.
|
|
72
|
+
const stream = await this._serviceProvider.services.ProfileService.createInvitation();
|
|
73
73
|
return this.createInvitationRequest({ stream });
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -81,12 +81,12 @@ class HaloProxy extends invitations_1.InvitationProxy {
|
|
|
81
81
|
* To be used with `client.halo.createHaloInvitation` on the inviter side.
|
|
82
82
|
*/
|
|
83
83
|
acceptInvitation(invitationDescriptor) {
|
|
84
|
-
const invitationProcessStream = this._serviceProvider.services.ProfileService.
|
|
84
|
+
const invitationProcessStream = this._serviceProvider.services.ProfileService.acceptInvitation(invitationDescriptor.toProto());
|
|
85
85
|
const { authenticate, waitForFinish } = invitations_1.InvitationProxy.handleInvitationRedemption({
|
|
86
86
|
stream: invitationProcessStream,
|
|
87
87
|
invitationDescriptor,
|
|
88
88
|
onAuthenticate: async (request) => {
|
|
89
|
-
await this._serviceProvider.services.ProfileService.
|
|
89
|
+
await this._serviceProvider.services.ProfileService.authenticateInvitation(request);
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
const waitForHalo = async () => {
|
|
@@ -96,10 +96,10 @@ class HaloProxy extends invitations_1.InvitationProxy {
|
|
|
96
96
|
return new invitations_1.Invitation(invitationDescriptor, waitForHalo(), authenticate);
|
|
97
97
|
}
|
|
98
98
|
async addKeyRecord(keyRecord) {
|
|
99
|
-
await this._serviceProvider.services.HaloService.
|
|
99
|
+
await this._serviceProvider.services.HaloService.addKeyRecord({ keyRecord });
|
|
100
100
|
}
|
|
101
101
|
async sign(request) {
|
|
102
|
-
return await this._serviceProvider.services.HaloService.
|
|
102
|
+
return await this._serviceProvider.services.HaloService.sign(request);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Allocate resources and set-up internal subscriptions.
|
|
@@ -109,13 +109,13 @@ class HaloProxy extends invitations_1.InvitationProxy {
|
|
|
109
109
|
async _open() {
|
|
110
110
|
const gotProfile = this._profileChanged.waitForCount(1);
|
|
111
111
|
const gotContacts = this._contactsChanged.waitForCount(1);
|
|
112
|
-
const profileStream = this._serviceProvider.services.ProfileService.
|
|
112
|
+
const profileStream = this._serviceProvider.services.ProfileService.subscribeProfile();
|
|
113
113
|
profileStream.subscribe(data => {
|
|
114
114
|
this._profile = data.profile;
|
|
115
115
|
this._profileChanged.emit();
|
|
116
116
|
}, () => { });
|
|
117
117
|
this._subscriptions.push(() => profileStream.close());
|
|
118
|
-
const contactsStream = this._serviceProvider.services.HaloService.
|
|
118
|
+
const contactsStream = this._serviceProvider.services.HaloService.subscribeContacts();
|
|
119
119
|
contactsStream.subscribe(data => {
|
|
120
120
|
this._contacts = data.contacts;
|
|
121
121
|
this._contactsChanged.emit();
|
|
@@ -79,7 +79,7 @@ class Party extends invitations_1.InvitationProxy {
|
|
|
79
79
|
return this.setOpen(true);
|
|
80
80
|
}
|
|
81
81
|
async setOpen(open) {
|
|
82
|
-
await this._serviceProvider.services.PartyService.
|
|
82
|
+
await this._serviceProvider.services.PartyService.setPartyState({
|
|
83
83
|
partyKey: this.key,
|
|
84
84
|
open
|
|
85
85
|
});
|
|
@@ -87,7 +87,7 @@ class Party extends invitations_1.InvitationProxy {
|
|
|
87
87
|
async setActive(active, options) {
|
|
88
88
|
const activeGlobal = options.global ? active : undefined;
|
|
89
89
|
const activeDevice = options.device ? active : undefined;
|
|
90
|
-
await this._serviceProvider.services.PartyService.
|
|
90
|
+
await this._serviceProvider.services.PartyService.setPartyState({
|
|
91
91
|
partyKey: this.key,
|
|
92
92
|
activeGlobal,
|
|
93
93
|
activeDevice
|
|
@@ -110,11 +110,11 @@ class Party extends invitations_1.InvitationProxy {
|
|
|
110
110
|
* @param inviteeKey Public key of the invitee. In this case no secret exchange is required, but only the specified recipient can accept the invitation.
|
|
111
111
|
*/
|
|
112
112
|
async createInvitation({ inviteeKey } = {}) {
|
|
113
|
-
const stream = this._serviceProvider.services.PartyService.
|
|
113
|
+
const stream = this._serviceProvider.services.PartyService.createInvitation({ partyKey: this.key, inviteeKey });
|
|
114
114
|
return this.createInvitationRequest({ stream });
|
|
115
115
|
}
|
|
116
116
|
queryMembers() {
|
|
117
|
-
return (0, util_1.streamToResultSet)(this._serviceProvider.services.PartyService.
|
|
117
|
+
return (0, util_1.streamToResultSet)(this._serviceProvider.services.PartyService.subscribeMembers({ partyKey: this.key }), (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.members) !== null && _a !== void 0 ? _a : []; });
|
|
118
118
|
}
|
|
119
119
|
setTitle(title) {
|
|
120
120
|
return this.setProperty(echo_db_1.PARTY_TITLE_PROPERTY, title);
|
|
@@ -134,7 +134,7 @@ class Party extends invitations_1.InvitationProxy {
|
|
|
134
134
|
return items[0];
|
|
135
135
|
}
|
|
136
136
|
createSnapshot() {
|
|
137
|
-
return this._serviceProvider.services.PartyService.
|
|
137
|
+
return this._serviceProvider.services.PartyService.createSnapshot({ partyKey: this.key });
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
exports.Party = Party;
|
|
@@ -28,20 +28,20 @@ describe('Client Services', () => {
|
|
|
28
28
|
(0, testutils_1.afterTest)(() => inviter.client.destroy());
|
|
29
29
|
const invitee = await setup();
|
|
30
30
|
(0, testutils_1.afterTest)(() => invitee.client.destroy());
|
|
31
|
-
await inviter.services.ProfileService.
|
|
31
|
+
await inviter.services.ProfileService.createProfile({ username: 'test-user' });
|
|
32
32
|
const invitation = await new Promise((resolve, reject) => {
|
|
33
|
-
inviter.services.ProfileService.
|
|
33
|
+
inviter.services.ProfileService.createInvitation().subscribe(resolve, reject);
|
|
34
34
|
});
|
|
35
35
|
(0, assert_1.default)(invitation.descriptor);
|
|
36
36
|
const redeemedInvitation = await new Promise((resolve, reject) => {
|
|
37
|
-
invitee.services.ProfileService.
|
|
37
|
+
invitee.services.ProfileService.acceptInvitation(invitation.descriptor).subscribe(resolve, reject);
|
|
38
38
|
});
|
|
39
|
-
await invitee.services.ProfileService.
|
|
39
|
+
await invitee.services.ProfileService.authenticateInvitation({
|
|
40
40
|
processId: redeemedInvitation.id,
|
|
41
41
|
secret: invitation.descriptor.secret
|
|
42
42
|
});
|
|
43
43
|
const [inviteeProfileLatch, inviteeProfileTrigger] = (0, async_1.latch)();
|
|
44
|
-
invitee.services.ProfileService.
|
|
44
|
+
invitee.services.ProfileService.subscribeProfile().subscribe(inviteeProfile => {
|
|
45
45
|
var _a;
|
|
46
46
|
if (((_a = inviteeProfile.profile) === null || _a === void 0 ? void 0 : _a.username) === 'test-user') {
|
|
47
47
|
inviteeProfileTrigger();
|
|
@@ -194,7 +194,7 @@ class Client {
|
|
|
194
194
|
// TODO(burdon): Should not require reloading the page (make re-entrant).
|
|
195
195
|
// Recreate echo instance? Big impact on hooks. Test.
|
|
196
196
|
async reset() {
|
|
197
|
-
await this.services.SystemService.
|
|
197
|
+
await this.services.SystemService.reset();
|
|
198
198
|
this._initialized = false;
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
@@ -5,10 +5,10 @@ import { CreateServicesOpts } from './interfaces';
|
|
|
5
5
|
export declare class HaloService implements IHaloService {
|
|
6
6
|
private echo;
|
|
7
7
|
constructor(echo: ECHO);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
subscribeContacts(): Stream<Contacts>;
|
|
9
|
+
addKeyRecord(request: AddKeyRecordRequest): Promise<void>;
|
|
10
10
|
private polkadotSign;
|
|
11
|
-
|
|
11
|
+
sign(request: SignRequest): Promise<SignResponse>;
|
|
12
12
|
}
|
|
13
13
|
export declare const createHaloService: ({ echo }: CreateServicesOpts) => HaloService;
|
|
14
14
|
//# sourceMappingURL=halo.d.ts.map
|
|
@@ -19,7 +19,7 @@ class HaloService {
|
|
|
19
19
|
constructor(echo) {
|
|
20
20
|
this.echo = echo;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
subscribeContacts() {
|
|
23
23
|
if (this.echo.halo.isInitialized) {
|
|
24
24
|
return (0, util_3.resultSetToStream)(this.echo.halo.queryContacts(), (contacts) => ({ contacts }));
|
|
25
25
|
}
|
|
@@ -40,7 +40,7 @@ class HaloService {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
async
|
|
43
|
+
async addKeyRecord(request) {
|
|
44
44
|
(0, assert_1.default)(request.keyRecord && request.keyRecord.publicKey, 'Missing key record.');
|
|
45
45
|
await this.echo.halo.keyring.addKeyRecord(request.keyRecord);
|
|
46
46
|
(0, assert_1.default)(await this.echo.halo.keyring.getKey(request.keyRecord.publicKey), 'Key not inserted correctly.');
|
|
@@ -55,7 +55,7 @@ class HaloService {
|
|
|
55
55
|
signed: signature
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
async
|
|
58
|
+
async sign(request) {
|
|
59
59
|
(0, assert_1.default)(request.publicKey, 'Provide a publicKey of the key that should be used for signing.');
|
|
60
60
|
const key = await this.echo.halo.keyring.getFullKey(request.publicKey);
|
|
61
61
|
(0, assert_1.default)(key, 'Key not found.');
|
|
@@ -8,24 +8,24 @@ declare class PartyService implements IPartyService {
|
|
|
8
8
|
private echo;
|
|
9
9
|
private inviteeInvitations;
|
|
10
10
|
constructor(echo: ECHO);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
subscribeToParty(request: SubscribePartyRequest): Stream<SubscribePartyResponse>;
|
|
12
|
+
subscribeParties(): Stream<SubscribePartiesResponse>;
|
|
13
|
+
createParty(): Promise<{
|
|
14
14
|
publicKey: import("@dxos/crypto").PublicKey;
|
|
15
15
|
isOpen: boolean;
|
|
16
16
|
isActive: boolean;
|
|
17
17
|
}>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
cloneParty(snapshot: PartySnapshot): Promise<Party>;
|
|
19
|
+
setPartyState(request: SetPartyStateRequest): Promise<{
|
|
20
20
|
publicKey: import("@dxos/crypto").PublicKey;
|
|
21
21
|
isOpen: boolean;
|
|
22
22
|
isActive: boolean;
|
|
23
23
|
}>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
createInvitation(request: CreateInvitationRequest): Stream<InvitationRequest>;
|
|
25
|
+
acceptInvitation(request: InvitationDescriptorProto): Stream<RedeemedInvitation>;
|
|
26
|
+
authenticateInvitation(request: AuthenticateInvitationRequest): Promise<void>;
|
|
27
|
+
subscribeMembers(request: SubscribeMembersRequest): Stream<SubscribeMembersResponse>;
|
|
28
|
+
createSnapshot(request: CreateSnaspotRequest): Promise<PartySnapshot>;
|
|
29
29
|
}
|
|
30
30
|
export declare const createPartyService: ({ echo }: CreateServicesOpts) => PartyService;
|
|
31
31
|
export {};
|
|
@@ -21,7 +21,7 @@ class PartyService {
|
|
|
21
21
|
this.echo = echo;
|
|
22
22
|
this.inviteeInvitations = new Map();
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
subscribeToParty(request) {
|
|
25
25
|
const update = (next) => {
|
|
26
26
|
try {
|
|
27
27
|
const party = this.echo.getParty(request.partyKey);
|
|
@@ -66,7 +66,7 @@ class PartyService {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
subscribeParties() {
|
|
70
70
|
return (0, util_1.resultSetToStream)(this.echo.queryParties(), (parties) => {
|
|
71
71
|
return ({
|
|
72
72
|
parties: parties.map(party => ({
|
|
@@ -78,7 +78,7 @@ class PartyService {
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
async
|
|
81
|
+
async createParty() {
|
|
82
82
|
const party = await this.echo.createParty();
|
|
83
83
|
return {
|
|
84
84
|
publicKey: party.key,
|
|
@@ -86,7 +86,7 @@ class PartyService {
|
|
|
86
86
|
isActive: party.isActive
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
async
|
|
89
|
+
async cloneParty(snapshot) {
|
|
90
90
|
const party = await this.echo.cloneParty(snapshot);
|
|
91
91
|
return {
|
|
92
92
|
publicKey: party.key,
|
|
@@ -94,7 +94,7 @@ class PartyService {
|
|
|
94
94
|
isActive: party.isActive
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
async
|
|
97
|
+
async setPartyState(request) {
|
|
98
98
|
const party = this.echo.getParty(request.partyKey);
|
|
99
99
|
if (!party) {
|
|
100
100
|
throw new Error('Party not found');
|
|
@@ -123,7 +123,7 @@ class PartyService {
|
|
|
123
123
|
isActive: party.isActive
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
createInvitation(request) {
|
|
127
127
|
return new codec_protobuf_1.Stream(({ next, close }) => {
|
|
128
128
|
var _a;
|
|
129
129
|
const party = (_a = this.echo.getParty(request.partyKey)) !== null && _a !== void 0 ? _a : (0, debug_1.raise)(new echo_db_1.PartyNotFoundError(request.partyKey));
|
|
@@ -163,7 +163,7 @@ class PartyService {
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
acceptInvitation(request) {
|
|
167
167
|
return new codec_protobuf_1.Stream(({ next, close }) => {
|
|
168
168
|
const id = (0, uuid_1.v4)();
|
|
169
169
|
const [secretLatch, secretTrigger] = (0, async_1.latch)();
|
|
@@ -192,7 +192,7 @@ class PartyService {
|
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
async
|
|
195
|
+
async authenticateInvitation(request) {
|
|
196
196
|
var _a;
|
|
197
197
|
(0, assert_1.default)(request.processId, 'Process ID is missing.');
|
|
198
198
|
const invitation = this.inviteeInvitations.get(request.processId);
|
|
@@ -202,7 +202,7 @@ class PartyService {
|
|
|
202
202
|
invitation.secret = request.secret;
|
|
203
203
|
(_a = invitation.secretTrigger) === null || _a === void 0 ? void 0 : _a.call(invitation);
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
subscribeMembers(request) {
|
|
206
206
|
const party = this.echo.getParty(request.partyKey);
|
|
207
207
|
if (party) {
|
|
208
208
|
return (0, util_1.resultSetToStream)(party.queryMembers(), (members) => ({ members }));
|
|
@@ -225,7 +225,7 @@ class PartyService {
|
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
async
|
|
228
|
+
async createSnapshot(request) {
|
|
229
229
|
var _a;
|
|
230
230
|
(0, assert_1.default)(request.partyKey);
|
|
231
231
|
const party = (_a = this.echo.getParty(request.partyKey)) !== null && _a !== void 0 ? _a : (0, debug_1.raise)(new echo_db_1.PartyNotFoundError(request.partyKey));
|
|
@@ -7,12 +7,12 @@ export declare class ProfileService implements IProfileService {
|
|
|
7
7
|
private echo;
|
|
8
8
|
private inviteeInvitations;
|
|
9
9
|
constructor(echo: ECHO);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
subscribeProfile(): Stream<SubscribeProfileResponse>;
|
|
11
|
+
createProfile(request: CreateProfileRequest): Promise<import("@dxos/echo-db").ProfileInfo>;
|
|
12
|
+
recoverProfile(request: RecoverProfileRequest): Promise<Profile>;
|
|
13
|
+
createInvitation(): Stream<InvitationRequest>;
|
|
14
|
+
acceptInvitation(request: InvitationDescriptorProto): Stream<RedeemedInvitation>;
|
|
15
|
+
authenticateInvitation(request: AuthenticateInvitationRequest): Promise<void>;
|
|
16
16
|
}
|
|
17
17
|
export declare const createProfileService: ({ echo }: CreateServicesOpts) => ProfileService;
|
|
18
18
|
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -19,7 +19,7 @@ class ProfileService {
|
|
|
19
19
|
this.echo = echo;
|
|
20
20
|
this.inviteeInvitations = new Map();
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
subscribeProfile() {
|
|
23
23
|
return new codec_protobuf_1.Stream(({ next }) => {
|
|
24
24
|
const emitNext = () => next({
|
|
25
25
|
profile: this.echo.halo.isInitialized ? this.echo.halo.getProfile() : undefined
|
|
@@ -28,10 +28,10 @@ class ProfileService {
|
|
|
28
28
|
return this.echo.halo.subscribeToProfile(emitNext);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
async
|
|
31
|
+
async createProfile(request) {
|
|
32
32
|
return this.echo.halo.createProfile(request);
|
|
33
33
|
}
|
|
34
|
-
async
|
|
34
|
+
async recoverProfile(request) {
|
|
35
35
|
if (!request.seedPhrase) {
|
|
36
36
|
throw new Error('Recovery SeedPhrase not provided.');
|
|
37
37
|
}
|
|
@@ -41,7 +41,7 @@ class ProfileService {
|
|
|
41
41
|
(0, assert_1.default)(profile, 'Recovering profile failed.');
|
|
42
42
|
return profile;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
createInvitation() {
|
|
45
45
|
return new codec_protobuf_1.Stream(({ next, close }) => {
|
|
46
46
|
setImmediate(async () => {
|
|
47
47
|
const secret = Buffer.from((0, credentials_1.generatePasscode)());
|
|
@@ -64,7 +64,7 @@ class ProfileService {
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
acceptInvitation(request) {
|
|
68
68
|
return new codec_protobuf_1.Stream(({ next, close }) => {
|
|
69
69
|
const id = (0, uuid_1.v4)();
|
|
70
70
|
const [secretLatch, secretTrigger] = (0, async_1.latch)();
|
|
@@ -90,7 +90,7 @@ class ProfileService {
|
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
async
|
|
93
|
+
async authenticateInvitation(request) {
|
|
94
94
|
var _a;
|
|
95
95
|
(0, assert_1.default)(request.processId, 'Process ID is missing.');
|
|
96
96
|
const invitation = this.inviteeInvitations.get(request.processId);
|
|
@@ -16,10 +16,10 @@ const createServices = (opts) => {
|
|
|
16
16
|
PartyService: (0, party_1.createPartyService)(opts),
|
|
17
17
|
DataService: opts.echo.dataService,
|
|
18
18
|
TracingService: {
|
|
19
|
-
|
|
19
|
+
setTracingOptions: () => {
|
|
20
20
|
throw new Error('Tracing not available');
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
subscribeToRpcTrace: () => {
|
|
23
23
|
throw new Error('Tracing not available');
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createSystemService = void 0;
|
|
7
7
|
const createSystemService = ({ config, echo }) => {
|
|
8
8
|
return {
|
|
9
|
-
|
|
9
|
+
getConfig: async () => {
|
|
10
10
|
return {
|
|
11
11
|
...config.values,
|
|
12
12
|
build: {
|
|
@@ -15,7 +15,7 @@ const createSystemService = ({ config, echo }) => {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
reset: async () => {
|
|
19
19
|
await echo.reset();
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -15,68 +15,68 @@ const parties_1 = require("./parties");
|
|
|
15
15
|
const storage_1 = require("./storage");
|
|
16
16
|
const createDevtoolsHost = (context, events) => {
|
|
17
17
|
return {
|
|
18
|
-
|
|
18
|
+
events: () => {
|
|
19
19
|
return new codec_protobuf_1.Stream(({ next }) => {
|
|
20
20
|
events.ready.on(() => {
|
|
21
21
|
next({ ready: {} });
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
getConfig: async () => {
|
|
26
26
|
const config = (0, config_1.getConfig)(context);
|
|
27
27
|
return config;
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
resetStorage: async () => {
|
|
30
30
|
await (0, storage_1.resetStorage)(context);
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
enableDebugLogging: async (request) => {
|
|
33
33
|
(0, debug_logging_1.enableDebugLogging)(context, request);
|
|
34
34
|
return {};
|
|
35
35
|
},
|
|
36
|
-
|
|
36
|
+
disableDebugLogging: async () => {
|
|
37
37
|
(0, debug_logging_1.disableDebugLogging)(context);
|
|
38
38
|
return {};
|
|
39
39
|
},
|
|
40
|
-
|
|
40
|
+
subscribeToKeyringKeys: () => {
|
|
41
41
|
return (0, keys_1.subscribeToKeyringKeys)(context);
|
|
42
42
|
},
|
|
43
|
-
|
|
43
|
+
subscribeToCredentialMessages: (request) => {
|
|
44
44
|
return (0, keys_1.subscribeToCredentialMessages)(context, request);
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
subscribeToParties: () => {
|
|
47
47
|
return (0, parties_1.subscribeToParties)(context);
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
subscribeToItems: () => {
|
|
50
50
|
return (0, items_1.subscribeToItems)(context);
|
|
51
51
|
},
|
|
52
|
-
|
|
52
|
+
subscribeToFeeds: () => {
|
|
53
53
|
return (0, feeds_1.subscribeToFeeds)(context);
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
subscribeToFeed: (request) => {
|
|
56
56
|
return (0, feeds_1.subscribeToFeed)(context, request);
|
|
57
57
|
},
|
|
58
|
-
|
|
58
|
+
getPartySnapshot: async (request) => {
|
|
59
59
|
return (0, parties_1.getPartySnapshot)(context, request);
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
savePartySnapshot: async (request) => {
|
|
62
62
|
return (0, parties_1.savePartySnapshot)(context, request);
|
|
63
63
|
},
|
|
64
|
-
|
|
64
|
+
clearSnapshots: async () => {
|
|
65
65
|
await context.echo.snapshotStore.clear();
|
|
66
66
|
},
|
|
67
|
-
|
|
67
|
+
getNetworkPeers: async (request) => {
|
|
68
68
|
return (0, network_1.getNetworkPeers)(context, request);
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
subscribeToNetworkTopics: () => {
|
|
71
71
|
return (0, network_1.subscribeToNetworkTopics)(context);
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
subscribeToSignalStatus: () => {
|
|
74
74
|
return (0, network_1.subscribeToNetworkStatus)(context);
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
subscribeToSignalTrace: () => {
|
|
77
77
|
return (0, network_1.subscribeToSignalTrace)(context);
|
|
78
78
|
},
|
|
79
|
-
|
|
79
|
+
subscribeToSwarmInfo: () => {
|
|
80
80
|
return (0, network_1.subscribeToSwarmInfo)(context);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
@@ -5,8 +5,8 @@ import * as dxos_echo_invitation from "./echo/invitation";
|
|
|
5
5
|
import * as dxos_echo_snapshot from "./echo/snapshot";
|
|
6
6
|
import * as dxos_halo_keys from "./halo/keys";
|
|
7
7
|
export interface SystemService {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
getConfig: (request: void) => Promise<dxos_config.Config>;
|
|
9
|
+
reset: (request: void) => Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
export declare enum InvitationState {
|
|
12
12
|
WAITING_FOR_CONNECTION = 1,
|
|
@@ -70,12 +70,12 @@ export interface Contacts {
|
|
|
70
70
|
contacts?: Contact[];
|
|
71
71
|
}
|
|
72
72
|
export interface ProfileService {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
subscribeProfile: (request: void) => Stream<SubscribeProfileResponse>;
|
|
74
|
+
createProfile: (request: CreateProfileRequest) => Promise<Profile>;
|
|
75
|
+
recoverProfile: (request: RecoverProfileRequest) => Promise<Profile>;
|
|
76
|
+
createInvitation: (request: void) => Stream<InvitationRequest>;
|
|
77
|
+
acceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
|
|
78
|
+
authenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
|
|
79
79
|
}
|
|
80
80
|
export interface AddKeyRecordRequest {
|
|
81
81
|
keyRecord?: dxos_halo_keys.KeyRecord;
|
|
@@ -91,9 +91,9 @@ export interface SignResponse {
|
|
|
91
91
|
signed?: ReturnType<typeof substitutions["google.protobuf.Any"]["decode"]>;
|
|
92
92
|
}
|
|
93
93
|
export interface HaloService {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
subscribeContacts: (request: void) => Stream<Contacts>;
|
|
95
|
+
addKeyRecord: (request: AddKeyRecordRequest) => Promise<void>;
|
|
96
|
+
sign: (request: SignRequest) => Promise<SignResponse>;
|
|
97
97
|
}
|
|
98
98
|
export interface Party {
|
|
99
99
|
publicKey: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
|
|
@@ -149,18 +149,18 @@ export interface CreateSnaspotRequest {
|
|
|
149
149
|
partyKey?: ReturnType<typeof substitutions["dxos.halo.keys.PubKey"]["decode"]>;
|
|
150
150
|
}
|
|
151
151
|
export interface PartyService {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
subscribeToParty: (request: SubscribePartyRequest) => Stream<SubscribePartyResponse>;
|
|
153
|
+
subscribeParties: (request: void) => Stream<SubscribePartiesResponse>;
|
|
154
|
+
createParty: (request: void) => Promise<Party>;
|
|
155
|
+
cloneParty: (request: dxos_echo_snapshot.PartySnapshot) => Promise<Party>;
|
|
156
156
|
/**
|
|
157
157
|
* Open and close or activate and deactivate a party.
|
|
158
158
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
setPartyState: (request: SetPartyStateRequest) => Promise<Party>;
|
|
160
|
+
createInvitation: (request: CreateInvitationRequest) => Stream<InvitationRequest>;
|
|
161
|
+
acceptInvitation: (request: dxos_echo_invitation.InvitationDescriptor) => Stream<RedeemedInvitation>;
|
|
162
|
+
authenticateInvitation: (request: AuthenticateInvitationRequest) => Promise<void>;
|
|
163
|
+
subscribeMembers: (request: SubscribeMembersRequest) => Stream<SubscribeMembersResponse>;
|
|
164
|
+
createSnapshot: (request: CreateSnaspotRequest) => Promise<dxos_echo_snapshot.PartySnapshot>;
|
|
165
165
|
}
|
|
166
166
|
//# sourceMappingURL=client.d.ts.map
|