@dxos/echo-db 2.33.1 → 2.33.2-dev.0f8f9225
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/echo.d.ts +8 -8
- package/dist/src/echo.d.ts.map +1 -1
- package/dist/src/echo.js +15 -16
- package/dist/src/echo.js.map +1 -1
- package/dist/src/echo.test.js +7 -13
- package/dist/src/echo.test.js.map +1 -1
- package/dist/src/halo/contact-manager.d.ts +4 -4
- package/dist/src/halo/contact-manager.d.ts.map +1 -1
- package/dist/src/halo/contact-manager.js +10 -4
- package/dist/src/halo/contact-manager.js.map +1 -1
- package/dist/src/halo/halo-factory.d.ts +14 -9
- package/dist/src/halo/halo-factory.d.ts.map +1 -1
- package/dist/src/halo/halo-factory.js +47 -14
- package/dist/src/halo/halo-factory.js.map +1 -1
- package/dist/src/halo/halo-party.d.ts +35 -7
- package/dist/src/halo/halo-party.d.ts.map +1 -1
- package/dist/src/halo/halo-party.js +97 -18
- package/dist/src/halo/halo-party.js.map +1 -1
- package/dist/src/halo/halo.d.ts +14 -12
- package/dist/src/halo/halo.d.ts.map +1 -1
- package/dist/src/halo/halo.js +31 -29
- package/dist/src/halo/halo.js.map +1 -1
- package/dist/src/halo/halo.test.d.ts +2 -0
- package/dist/src/halo/halo.test.d.ts.map +1 -0
- package/dist/src/halo/halo.test.js +162 -0
- package/dist/src/halo/halo.test.js.map +1 -0
- package/dist/src/halo/identity-manager.d.ts +10 -8
- package/dist/src/halo/identity-manager.d.ts.map +1 -1
- package/dist/src/halo/identity-manager.js +24 -20
- package/dist/src/halo/identity-manager.js.map +1 -1
- package/dist/src/halo/identity.d.ts +12 -6
- package/dist/src/halo/identity.d.ts.map +1 -1
- package/dist/src/halo/identity.js +11 -15
- package/dist/src/halo/identity.js.map +1 -1
- package/dist/src/halo/index.d.ts +1 -1
- package/dist/src/halo/index.d.ts.map +1 -1
- package/dist/src/halo/index.js +1 -1
- package/dist/src/halo/index.js.map +1 -1
- package/dist/src/halo/party-opener.js +1 -1
- package/dist/src/halo/party-opener.js.map +1 -1
- package/dist/src/halo/preferences.d.ts +9 -9
- package/dist/src/halo/preferences.d.ts.map +1 -1
- package/dist/src/halo/preferences.js +25 -15
- package/dist/src/halo/preferences.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/invitations/greeting-initiator.d.ts +14 -4
- package/dist/src/invitations/greeting-initiator.d.ts.map +1 -1
- package/dist/src/invitations/greeting-initiator.js +15 -16
- package/dist/src/invitations/greeting-initiator.js.map +1 -1
- package/dist/src/invitations/greeting-responder.d.ts +3 -3
- package/dist/src/invitations/greeting-responder.d.ts.map +1 -1
- package/dist/src/invitations/greeting-responder.js +3 -4
- package/dist/src/invitations/greeting-responder.js.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.d.ts +6 -4
- package/dist/src/invitations/halo-recovery-initiator.d.ts.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js +15 -26
- package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
- package/dist/src/invitations/index.d.ts +1 -1
- package/dist/src/invitations/index.js +1 -1
- package/dist/src/invitations/{invitation-manager.d.ts → invitation-factory.d.ts} +5 -6
- package/dist/src/invitations/invitation-factory.d.ts.map +1 -0
- package/dist/src/invitations/{invitation-manager.js → invitation-factory.js} +9 -15
- package/dist/src/invitations/invitation-factory.js.map +1 -0
- package/dist/src/invitations/offline-invitation-claimer.d.ts +3 -3
- package/dist/src/invitations/offline-invitation-claimer.js +1 -1
- package/dist/src/parties/{party-internal.d.ts → data-party.d.ts} +13 -11
- package/dist/src/parties/data-party.d.ts.map +1 -0
- package/dist/src/parties/{party-internal.js → data-party.js} +27 -37
- package/dist/src/parties/data-party.js.map +1 -0
- package/dist/src/parties/index.d.ts +1 -2
- package/dist/src/parties/index.d.ts.map +1 -1
- package/dist/src/parties/index.js +1 -2
- package/dist/src/parties/index.js.map +1 -1
- package/dist/src/parties/party-factory.d.ts +10 -11
- package/dist/src/parties/party-factory.d.ts.map +1 -1
- package/dist/src/parties/party-factory.js +25 -16
- package/dist/src/parties/party-factory.js.map +1 -1
- package/dist/src/parties/party-manager.d.ts +9 -9
- package/dist/src/parties/party-manager.d.ts.map +1 -1
- package/dist/src/parties/party-manager.js +13 -13
- package/dist/src/parties/party-manager.js.map +1 -1
- package/dist/src/parties/party-manager.test.js +69 -68
- package/dist/src/parties/party-manager.test.js.map +1 -1
- package/dist/src/{halo → parties}/party-preferences.d.ts +3 -3
- package/dist/src/parties/party-preferences.d.ts.map +1 -0
- package/dist/src/{halo → parties}/party-preferences.js +3 -3
- package/dist/src/parties/party-preferences.js.map +1 -0
- package/dist/src/pipeline/index.d.ts +3 -1
- package/dist/src/pipeline/index.d.ts.map +1 -1
- package/dist/src/pipeline/index.js +3 -1
- package/dist/src/pipeline/index.js.map +1 -1
- package/dist/src/{metadata → pipeline}/metadata-store.d.ts +0 -0
- package/dist/src/{metadata → pipeline}/metadata-store.d.ts.map +1 -1
- package/dist/src/{metadata → pipeline}/metadata-store.js +0 -0
- package/dist/src/{metadata → pipeline}/metadata-store.js.map +1 -1
- package/dist/src/{metadata → pipeline}/metadata-store.test.d.ts +0 -0
- package/dist/src/pipeline/metadata-store.test.d.ts.map +1 -0
- package/dist/src/{metadata → pipeline}/metadata-store.test.js +0 -0
- package/dist/src/{metadata → pipeline}/metadata-store.test.js.map +1 -1
- package/dist/src/{parties → pipeline}/party-core.d.ts +0 -0
- package/dist/src/pipeline/party-core.d.ts.map +1 -0
- package/dist/src/{parties → pipeline}/party-core.js +8 -4
- package/dist/src/pipeline/party-core.js.map +1 -0
- package/dist/src/{parties → pipeline}/party-core.test.d.ts +0 -0
- package/dist/src/pipeline/party-core.test.d.ts.map +1 -0
- package/dist/src/{parties → pipeline}/party-core.test.js +3 -4
- package/dist/src/pipeline/party-core.test.js.map +1 -0
- package/dist/src/pipeline/party-feed-provider.d.ts +3 -2
- package/dist/src/pipeline/party-feed-provider.d.ts.map +1 -1
- package/dist/src/pipeline/party-feed-provider.js +40 -19
- package/dist/src/pipeline/party-feed-provider.js.map +1 -1
- package/dist/src/protocol/auth-plugin.d.ts +7 -0
- package/dist/src/protocol/auth-plugin.d.ts.map +1 -0
- package/dist/src/protocol/auth-plugin.js +16 -0
- package/dist/src/protocol/auth-plugin.js.map +1 -0
- package/dist/src/protocol/authenticator.d.ts +14 -0
- package/dist/src/protocol/authenticator.d.ts.map +1 -0
- package/dist/src/protocol/authenticator.js +31 -0
- package/dist/src/protocol/authenticator.js.map +1 -0
- package/dist/src/protocol/authenticator.test.d.ts +2 -0
- package/dist/src/protocol/authenticator.test.d.ts.map +1 -0
- package/dist/src/protocol/authenticator.test.js +45 -0
- package/dist/src/protocol/authenticator.test.js.map +1 -0
- package/dist/src/protocol/credentials-signer.d.ts +31 -0
- package/dist/src/protocol/credentials-signer.d.ts.map +1 -0
- package/dist/src/protocol/credentials-signer.js +53 -0
- package/dist/src/protocol/credentials-signer.js.map +1 -0
- package/dist/src/protocol/halo-recovery-plugin.d.ts +10 -0
- package/dist/src/protocol/halo-recovery-plugin.d.ts.map +1 -0
- package/dist/src/protocol/halo-recovery-plugin.js +18 -0
- package/dist/src/protocol/halo-recovery-plugin.js.map +1 -0
- package/dist/src/protocol/index.d.ts +7 -0
- package/dist/src/protocol/index.d.ts.map +1 -0
- package/dist/src/{metadata → protocol}/index.js +7 -2
- package/dist/src/protocol/index.js.map +1 -0
- package/dist/src/protocol/offline-invitation-plugin.d.ts +9 -0
- package/dist/src/protocol/offline-invitation-plugin.d.ts.map +1 -0
- package/dist/src/protocol/offline-invitation-plugin.js +17 -0
- package/dist/src/protocol/offline-invitation-plugin.js.map +1 -0
- package/dist/src/{pipeline → protocol}/party-protocol-factory.d.ts +7 -17
- package/dist/src/protocol/party-protocol-factory.d.ts.map +1 -0
- package/dist/src/{pipeline → protocol}/party-protocol-factory.js +7 -47
- package/dist/src/protocol/party-protocol-factory.js.map +1 -0
- package/dist/src/snapshots/snapshot-generator.d.ts +1 -1
- package/dist/src/snapshots/snapshot-generator.d.ts.map +1 -1
- package/dist/src/testing/testing-factories.js.map +1 -1
- package/dist/src/testing/testing.d.ts +2 -2
- package/dist/src/testing/testing.d.ts.map +1 -1
- package/dist/src/testing/testing.js +1 -7
- package/dist/src/testing/testing.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/echo.test.ts +8 -14
- package/src/echo.ts +107 -109
- package/src/halo/contact-manager.ts +9 -5
- package/src/halo/halo-factory.ts +82 -19
- package/src/halo/halo-party.ts +137 -21
- package/src/halo/halo.test.ts +198 -0
- package/src/halo/halo.ts +40 -38
- package/src/halo/identity-manager.ts +33 -28
- package/src/halo/identity.ts +19 -23
- package/src/halo/index.ts +1 -1
- package/src/halo/party-opener.ts +1 -1
- package/src/halo/preferences.ts +29 -18
- package/src/index.ts +1 -1
- package/src/invitations/greeting-initiator.ts +37 -32
- package/src/invitations/greeting-responder.ts +4 -5
- package/src/invitations/halo-recovery-initiator.ts +16 -24
- package/src/invitations/index.ts +1 -1
- package/src/invitations/{invitation-manager.ts → invitation-factory.ts} +8 -15
- package/src/invitations/offline-invitation-claimer.ts +3 -3
- package/src/parties/{party-internal.ts → data-party.ts} +30 -55
- package/src/parties/index.ts +1 -2
- package/src/parties/party-factory.ts +31 -21
- package/src/parties/party-manager.test.ts +99 -73
- package/src/parties/party-manager.ts +17 -17
- package/src/{halo → parties}/party-preferences.ts +3 -3
- package/src/pipeline/index.ts +3 -1
- package/src/{metadata → pipeline}/metadata-store.test.ts +0 -0
- package/src/{metadata → pipeline}/metadata-store.ts +0 -0
- package/src/{parties → pipeline}/party-core.test.ts +1 -2
- package/src/{parties → pipeline}/party-core.ts +12 -7
- package/src/pipeline/party-feed-provider.ts +32 -21
- package/src/protocol/auth-plugin.ts +14 -0
- package/src/protocol/authenticator.test.ts +66 -0
- package/src/protocol/authenticator.ts +56 -0
- package/src/protocol/credentials-signer.ts +60 -0
- package/src/protocol/halo-recovery-plugin.ts +20 -0
- package/src/protocol/index.ts +10 -0
- package/src/protocol/offline-invitation-plugin.ts +19 -0
- package/src/{pipeline → protocol}/party-protocol-factory.ts +10 -82
- package/src/snapshots/snapshot-generator.ts +1 -1
- package/src/testing/testing-factories.ts +2 -2
- package/src/testing/testing.ts +3 -9
- package/dist/src/halo/party-preferences.d.ts.map +0 -1
- package/dist/src/halo/party-preferences.js.map +0 -1
- package/dist/src/invitations/invitation-manager.d.ts.map +0 -1
- package/dist/src/invitations/invitation-manager.js.map +0 -1
- package/dist/src/metadata/index.d.ts +0 -2
- package/dist/src/metadata/index.d.ts.map +0 -1
- package/dist/src/metadata/index.js.map +0 -1
- package/dist/src/metadata/metadata-store.test.d.ts.map +0 -1
- package/dist/src/parties/authenticator.d.ts +0 -5
- package/dist/src/parties/authenticator.d.ts.map +0 -1
- package/dist/src/parties/authenticator.js +0 -27
- package/dist/src/parties/authenticator.js.map +0 -1
- package/dist/src/parties/party-core.d.ts.map +0 -1
- package/dist/src/parties/party-core.js.map +0 -1
- package/dist/src/parties/party-core.test.d.ts.map +0 -1
- package/dist/src/parties/party-core.test.js.map +0 -1
- package/dist/src/parties/party-internal.d.ts.map +0 -1
- package/dist/src/parties/party-internal.js.map +0 -1
- package/dist/src/pipeline/party-protocol-factory.d.ts.map +0 -1
- package/dist/src/pipeline/party-protocol-factory.js.map +0 -1
- package/src/metadata/index.ts +0 -5
- package/src/parties/authenticator.ts +0 -31
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitation-factory.d.ts","sourceRoot":"","sources":["../../../src/invitations/invitation-factory.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAkC,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEtG,OAAO,EAAE,oBAAoB,EAA4B,MAAM,yBAAyB,CAAC;AAEzF;;GAEG;AACH,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAGhC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAJf,eAAe,EAAE,cAAc,EAG/B,kBAAkB,EAAE,iBAAiB,EACrC,eAAe,EAAE,cAAc;IAGlD,IAAI,MAAM,YAGT;IAEK,uBAAuB,CAAE,SAAS,EAAE,SAAS;IAoBnD;;OAEG;IACG,gBAAgB,CACpB,qBAAqB,GAAE,uBAAwD,EAAE,OAAO,GAAE,iBAAsB;IAsBlH,oBAAoB,CAAE,YAAY,EAAE,MAAM;CAG3C"}
|
|
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.InvitationFactory = void 0;
|
|
10
10
|
const assert_1 = __importDefault(require("assert"));
|
|
11
11
|
const credentials_1 = require("@dxos/credentials");
|
|
12
12
|
const common_1 = require("./common");
|
|
@@ -15,28 +15,22 @@ const invitation_descriptor_1 = require("./invitation-descriptor");
|
|
|
15
15
|
/**
|
|
16
16
|
* Groups together all invitation-related functionality for a single party.
|
|
17
17
|
*/
|
|
18
|
-
class
|
|
18
|
+
class InvitationFactory {
|
|
19
19
|
constructor(_partyProcessor,
|
|
20
20
|
// This needs to be a provider in case this is a backend for the HALO party.
|
|
21
21
|
// Then the identity would be changed after this is instantiated.
|
|
22
|
-
|
|
22
|
+
_credentialsSigner, _networkManager) {
|
|
23
23
|
this._partyProcessor = _partyProcessor;
|
|
24
|
-
this.
|
|
24
|
+
this._credentialsSigner = _credentialsSigner;
|
|
25
25
|
this._networkManager = _networkManager;
|
|
26
26
|
}
|
|
27
|
-
get _identity() {
|
|
28
|
-
return this._identityProvider();
|
|
29
|
-
}
|
|
30
27
|
get isHalo() {
|
|
31
28
|
// The PartyKey of the HALO is the Identity key.
|
|
32
|
-
|
|
33
|
-
return this._identity.identityKey.publicKey.equals(this._partyProcessor.partyKey);
|
|
29
|
+
return this._credentialsSigner.getIdentityKey().publicKey.equals(this._partyProcessor.partyKey);
|
|
34
30
|
}
|
|
35
31
|
async createOfflineInvitation(publicKey) {
|
|
36
32
|
(0, assert_1.default)(!this.isHalo, 'Offline invitations to HALO are not allowed.');
|
|
37
|
-
(0,
|
|
38
|
-
(0, assert_1.default)(this._identity.deviceKeyChain, 'Device keychain is required.');
|
|
39
|
-
const invitationMessage = (0, credentials_1.createPartyInvitationMessage)(this._identity.signer, this._partyProcessor.partyKey, publicKey, this._identity.identityKey, this._identity.deviceKeyChain);
|
|
33
|
+
const invitationMessage = (0, credentials_1.createPartyInvitationMessage)(this._credentialsSigner.signer, this._partyProcessor.partyKey, publicKey, this._credentialsSigner.getIdentityKey(), this._credentialsSigner.getDeviceSigningKeys());
|
|
40
34
|
await this._partyProcessor.writeHaloMessage(invitationMessage);
|
|
41
35
|
return new invitation_descriptor_1.InvitationDescriptor(invitation_descriptor_1.InvitationDescriptorType.OFFLINE, this._partyProcessor.partyKey.asBuffer(), invitationMessage.payload.signed.payload.id);
|
|
42
36
|
}
|
|
@@ -45,7 +39,7 @@ class InvitationManager {
|
|
|
45
39
|
*/
|
|
46
40
|
async createInvitation(authenticationDetails = common_1.defaultInvitationAuthenticator, options = {}) {
|
|
47
41
|
(0, assert_1.default)(this._networkManager);
|
|
48
|
-
const responder = new greeting_responder_1.GreetingResponder(this._networkManager, this._partyProcessor, this.
|
|
42
|
+
const responder = new greeting_responder_1.GreetingResponder(this._networkManager, this._partyProcessor, this._credentialsSigner);
|
|
49
43
|
const { secretValidator, secretProvider } = authenticationDetails;
|
|
50
44
|
const { onFinish, expiration } = options;
|
|
51
45
|
const swarmKey = await responder.start();
|
|
@@ -56,5 +50,5 @@ class InvitationManager {
|
|
|
56
50
|
return this._partyProcessor.getOfflineInvitation(invitationId);
|
|
57
51
|
}
|
|
58
52
|
}
|
|
59
|
-
exports.
|
|
60
|
-
//# sourceMappingURL=invitation-
|
|
53
|
+
exports.InvitationFactory = InvitationFactory;
|
|
54
|
+
//# sourceMappingURL=invitation-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitation-factory.js","sourceRoot":"","sources":["../../../src/invitations/invitation-factory.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAE5B,mDAAiE;AAMjE,qCAAsG;AACtG,6DAAyD;AACzD,mEAAyF;AAEzF;;GAEG;AACH,MAAa,iBAAiB;IAC5B,YACmB,eAA+B;IAChD,4EAA4E;IAC5E,iEAAiE;IAChD,kBAAqC,EACrC,eAA+B;QAJ/B,oBAAe,GAAf,eAAe,CAAgB;QAG/B,uBAAkB,GAAlB,kBAAkB,CAAmB;QACrC,oBAAe,GAAf,eAAe,CAAgB;IAC/C,CAAC;IAEJ,IAAI,MAAM;QACR,gDAAgD;QAChD,OAAO,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClG,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAE,SAAoB;QACjD,IAAA,gBAAM,EAAC,CAAC,IAAI,CAAC,MAAM,EAAE,8CAA8C,CAAC,CAAC;QAErE,MAAM,iBAAiB,GAAG,IAAA,0CAA4B,EACpD,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAC9B,IAAI,CAAC,eAAe,CAAC,QAAQ,EAC7B,SAAS,EACT,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,EACxC,IAAI,CAAC,kBAA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@dxos/network-manager';
|
|
|
4
4
|
import { Identity } from '../halo';
|
|
5
5
|
import { GreetingState } from './greeting-responder';
|
|
6
6
|
import { InvitationDescriptor } from './invitation-descriptor';
|
|
7
|
-
import {
|
|
7
|
+
import { InvitationFactory } from './invitation-factory';
|
|
8
8
|
/**
|
|
9
9
|
* Class to facilitate making an unauthenticated connection to an existing Party in order to claim an
|
|
10
10
|
* offline invitation. If successful, the regular interactive Greeting flow will follow.
|
|
@@ -33,9 +33,9 @@ export declare class OfflineInvitationClaimer {
|
|
|
33
33
|
/**
|
|
34
34
|
* Create a function for handling PartyInvitation claims on the indicated Party. This is used by members
|
|
35
35
|
* of the Party for responding to attempts to claim an Invitation which has been written to the Party.
|
|
36
|
-
* @param {
|
|
36
|
+
* @param {InvitationFactory} invitationManager
|
|
37
37
|
*/
|
|
38
|
-
static createOfflineInvitationClaimHandler(invitationManager:
|
|
38
|
+
static createOfflineInvitationClaimHandler(invitationManager: InvitationFactory): (message: any, remotePeerId: Buffer, peerId: Buffer) => Promise<import("@dxos/credentials").WithTypeUrl<ClaimResponse>>;
|
|
39
39
|
static createSecretProvider(identity: Identity): SecretProvider;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=offline-invitation-claimer.d.ts.map
|
|
@@ -93,7 +93,7 @@ class OfflineInvitationClaimer {
|
|
|
93
93
|
/**
|
|
94
94
|
* Create a function for handling PartyInvitation claims on the indicated Party. This is used by members
|
|
95
95
|
* of the Party for responding to attempts to claim an Invitation which has been written to the Party.
|
|
96
|
-
* @param {
|
|
96
|
+
* @param {InvitationFactory} invitationManager
|
|
97
97
|
*/
|
|
98
98
|
static createOfflineInvitationClaimHandler(invitationManager) {
|
|
99
99
|
const claimHandler = new credentials_1.PartyInvitationClaimHandler(async (invitationID) => {
|
|
@@ -6,11 +6,11 @@ import { ModelFactory } from '@dxos/model-factory';
|
|
|
6
6
|
import { NetworkManager } from '@dxos/network-manager';
|
|
7
7
|
import { ObjectModel } from '@dxos/object-model';
|
|
8
8
|
import { Database, Item, ResultSet } from '../api';
|
|
9
|
-
import { ActivationOptions, PartyPreferences,
|
|
10
|
-
import {
|
|
11
|
-
import { PartyFeedProvider } from '../pipeline';
|
|
9
|
+
import { ActivationOptions, PartyPreferences, Preferences } from '../halo';
|
|
10
|
+
import { InvitationFactory } from '../invitations';
|
|
11
|
+
import { PartyFeedProvider, PartyOptions } from '../pipeline';
|
|
12
|
+
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
12
13
|
import { SnapshotStore } from '../snapshots';
|
|
13
|
-
import { PartyOptions } from './party-core';
|
|
14
14
|
export declare const PARTY_ITEM_TYPE = "dxos:item/party";
|
|
15
15
|
export declare const PARTY_TITLE_PROPERTY = "title";
|
|
16
16
|
export interface PartyMember {
|
|
@@ -18,11 +18,14 @@ export interface PartyMember {
|
|
|
18
18
|
displayName?: string;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Generic parties that peers create that is capable of storing data in the database.
|
|
22
|
+
*
|
|
23
|
+
* This class handles data-storage, replication, snapshots, access-control, and invitations.
|
|
22
24
|
*/
|
|
23
|
-
export declare class
|
|
25
|
+
export declare class DataParty {
|
|
24
26
|
private readonly _feedProvider;
|
|
25
|
-
private readonly
|
|
27
|
+
private readonly _credentialsSigner;
|
|
28
|
+
private readonly _profilePreferences;
|
|
26
29
|
private readonly _networkManager;
|
|
27
30
|
private readonly _hints;
|
|
28
31
|
readonly update: Event<void>;
|
|
@@ -30,7 +33,7 @@ export declare class PartyInternal {
|
|
|
30
33
|
private readonly _preferences?;
|
|
31
34
|
private _invitationManager?;
|
|
32
35
|
private _protocol?;
|
|
33
|
-
constructor(partyKey: PartyKey, modelFactory: ModelFactory, snapshotStore: SnapshotStore, _feedProvider: PartyFeedProvider,
|
|
36
|
+
constructor(partyKey: PartyKey, modelFactory: ModelFactory, snapshotStore: SnapshotStore, _feedProvider: PartyFeedProvider, _credentialsSigner: CredentialsSigner, _profilePreferences: Preferences | undefined, _networkManager: NetworkManager, _hints?: KeyHint[], _initialTimeframe?: Timeframe, _options?: PartyOptions);
|
|
34
37
|
get partyInfo(): {
|
|
35
38
|
key: string;
|
|
36
39
|
isOpen: boolean;
|
|
@@ -46,7 +49,7 @@ export declare class PartyInternal {
|
|
|
46
49
|
get pipeline(): import("../pipeline").Pipeline;
|
|
47
50
|
get timeframe(): Timeframe;
|
|
48
51
|
get timeframeUpdate(): Event<Timeframe>;
|
|
49
|
-
get invitationManager():
|
|
52
|
+
get invitationManager(): InvitationFactory;
|
|
50
53
|
get feedProvider(): PartyFeedProvider;
|
|
51
54
|
get preferences(): PartyPreferences;
|
|
52
55
|
get title(): any;
|
|
@@ -75,10 +78,9 @@ export declare class PartyInternal {
|
|
|
75
78
|
*/
|
|
76
79
|
createSnapshot(): PartySnapshot;
|
|
77
80
|
restoreFromSnapshot(snapshot: PartySnapshot): Promise<void>;
|
|
78
|
-
private _createCredentialsProvider;
|
|
79
81
|
/**
|
|
80
82
|
* Get all party members.
|
|
81
83
|
*/
|
|
82
84
|
queryMembers(): ResultSet<PartyMember>;
|
|
83
85
|
}
|
|
84
|
-
//# sourceMappingURL=party
|
|
86
|
+
//# sourceMappingURL=data-party.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-party.d.ts","sourceRoot":"","sources":["../../../src/parties/data-party.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAo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AAC,EAAE,SAAS,EAC7B,QAAQ,GAAE,YAAiB;IAkB7B,IAAI,SAAS;;;;;;;MASZ;IAED,IAAI,GAAG,IAAK,QAAQ,CAEnB;IAED,IAAI,MAAM,IAAK,OAAO,CAErB;IAED,IAAI,QAAQ,IAAK,QAAQ,CAExB;IAKD,IAAI,SAAS,yCAEZ;IAGD,IAAI,QAAQ,mCAEX;IAGD,IAAI,SAAS,cAEZ;IAGD,IAAI,eAAe,qBAElB;IAGD,IAAI,iBAAiB,sBAGpB;IAGD,IAAI,YAAY,IAAK,iBAAiB,CAErC;IAED,IAAI,WAAW,IAAK,gBAAgB,CAGnC;IAED,IAAI,KAAK,QAER;IAEK,QAAQ,CAAE,KAAK,EAAE,MAAM;IAM7B;;OAEG;IAGG,IAAI;IAyCV;;OAEG;IAEG,KAAK;IAgBX,IAAI,QAAQ,IAAK,OAAO,CAGvB;IAEK,QAAQ,CAAE,OAAO,EAAE,iBAAiB;IAWpC,UAAU,CAAE,OAAO,EAAE,iBAAiB;IAW5C;;OAEG;IACG,iBAAiB,IAAK,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAStD;;OAEG;IACH,gBAAgB;IAKhB;;OAEG;IACH,cAAc,IAAK,aAAa;IAI1B,mBAAmB,CAAE,QAAQ,EAAE,aAAa;IAIlD;;OAEG;IACH,YAAY,IAAK,SAAS,CAAC,WAAW,CAAC;CAoBxC"}
|
|
@@ -12,39 +12,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.DataParty = exports.PARTY_TITLE_PROPERTY = exports.PARTY_ITEM_TYPE = void 0;
|
|
16
16
|
const assert_1 = __importDefault(require("assert"));
|
|
17
17
|
const async_1 = require("@dxos/async");
|
|
18
|
-
const credentials_1 = require("@dxos/credentials");
|
|
19
18
|
const debug_1 = require("@dxos/debug");
|
|
20
19
|
const api_1 = require("../api");
|
|
21
|
-
const errors_1 = require("../errors");
|
|
22
20
|
const halo_1 = require("../halo");
|
|
23
21
|
const invitations_1 = require("../invitations");
|
|
24
22
|
const pipeline_1 = require("../pipeline");
|
|
25
|
-
const
|
|
26
|
-
const party_core_1 = require("./party-core");
|
|
23
|
+
const protocol_1 = require("../protocol");
|
|
27
24
|
const party_manager_1 = require("./party-manager");
|
|
28
25
|
exports.PARTY_ITEM_TYPE = 'dxos:item/party';
|
|
29
26
|
exports.PARTY_TITLE_PROPERTY = 'title'; // TODO(burdon): Remove (should not be special).
|
|
30
27
|
/**
|
|
31
|
-
*
|
|
28
|
+
* Generic parties that peers create that is capable of storing data in the database.
|
|
29
|
+
*
|
|
30
|
+
* This class handles data-storage, replication, snapshots, access-control, and invitations.
|
|
32
31
|
*/
|
|
33
|
-
class
|
|
34
|
-
constructor(partyKey, modelFactory, snapshotStore, _feedProvider,
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
_identityProvider, _networkManager, _hints = [], _initialTimeframe, _options = {}) {
|
|
38
|
-
var _a, _b;
|
|
32
|
+
class DataParty {
|
|
33
|
+
constructor(partyKey, modelFactory, snapshotStore, _feedProvider, _credentialsSigner,
|
|
34
|
+
// TODO(dmaretskyi): Pull this out to a higher level. Should preferences be part of client API instead?
|
|
35
|
+
_profilePreferences, _networkManager, _hints = [], _initialTimeframe, _options = {}) {
|
|
39
36
|
this._feedProvider = _feedProvider;
|
|
40
|
-
this.
|
|
37
|
+
this._credentialsSigner = _credentialsSigner;
|
|
38
|
+
this._profilePreferences = _profilePreferences;
|
|
41
39
|
this._networkManager = _networkManager;
|
|
42
40
|
this._hints = _hints;
|
|
43
41
|
this.update = new async_1.Event();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
this._preferences = new halo_1.PartyPreferences(
|
|
42
|
+
this._partyCore = new pipeline_1.PartyCore(partyKey, _feedProvider, modelFactory, snapshotStore, this._credentialsSigner.getIdentityKey().publicKey, _initialTimeframe, _options);
|
|
43
|
+
// TODO(dmaretskyi): Pull this out to a higher level. Should preferences be part of client API instead?
|
|
44
|
+
if (this._profilePreferences) {
|
|
45
|
+
this._preferences = new halo_1.PartyPreferences(this._profilePreferences, this);
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
get partyInfo() {
|
|
@@ -113,17 +111,19 @@ class PartyInternal {
|
|
|
113
111
|
if (this.isOpen) {
|
|
114
112
|
return this;
|
|
115
113
|
}
|
|
116
|
-
const identity = this._identityProvider();
|
|
117
|
-
(0, assert_1.default)(identity.deviceKey, 'Missing device key.');
|
|
118
114
|
await this._partyCore.open(this._hints);
|
|
119
|
-
this._invitationManager = new invitations_1.
|
|
115
|
+
this._invitationManager = new invitations_1.InvitationFactory(this._partyCore.processor, this._credentialsSigner, this._networkManager);
|
|
120
116
|
//
|
|
121
117
|
// Network/swarm.
|
|
118
|
+
// Replication, invitations, and authentication functions.
|
|
122
119
|
//
|
|
120
|
+
const deviceKey = this._credentialsSigner.getDeviceKey();
|
|
123
121
|
const writeFeed = await this._partyCore.getWriteFeed();
|
|
124
|
-
this._protocol = new pipeline_1.PartyProtocolFactory(this._partyCore.key, this._networkManager, this._feedProvider,
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
this._protocol = new pipeline_1.PartyProtocolFactory(this._partyCore.key, this._networkManager, this._feedProvider, deviceKey.publicKey, (0, protocol_1.createCredentialsProvider)(this._credentialsSigner, this._partyCore.key, writeFeed.key), this._partyCore.processor.getActiveFeedSet());
|
|
123
|
+
await this._protocol.start([
|
|
124
|
+
(0, protocol_1.createAuthPlugin)((0, protocol_1.createAuthenticator)(this._partyCore.processor, this._credentialsSigner), deviceKey.publicKey),
|
|
125
|
+
(0, protocol_1.createOfflineInvitationPlugin)(this._invitationManager, deviceKey.publicKey)
|
|
126
|
+
]);
|
|
127
127
|
// Issue an 'update' whenever the properties change.
|
|
128
128
|
this.database.select({ type: exports.PARTY_ITEM_TYPE }).exec().update.on(() => this.update.emit());
|
|
129
129
|
this.update.emit();
|
|
@@ -194,16 +194,6 @@ class PartyInternal {
|
|
|
194
194
|
async restoreFromSnapshot(snapshot) {
|
|
195
195
|
await this._partyCore.restoreFromSnapshot(snapshot);
|
|
196
196
|
}
|
|
197
|
-
_createCredentialsProvider(partyKey, feedKey) {
|
|
198
|
-
return {
|
|
199
|
-
get: () => {
|
|
200
|
-
var _a, _b, _c, _d;
|
|
201
|
-
const identity = this._identityProvider();
|
|
202
|
-
const signingKey = (_b = (_a = identity.deviceKeyChain) !== null && _a !== void 0 ? _a : identity.deviceKey) !== null && _b !== void 0 ? _b : (0, debug_1.raise)(new errors_1.IdentityNotInitializedError());
|
|
203
|
-
return Buffer.from(credentials_1.codec.encode((0, credentials_1.createAuthMessage)(identity.signer, partyKey, (_c = identity.identityKey) !== null && _c !== void 0 ? _c : (0, debug_1.raise)(new errors_1.IdentityNotInitializedError()), signingKey, identity.keyring.getKey(feedKey), undefined, (0, credentials_1.createFeedAdmitMessage)(identity.signer, partyKey, feedKey, [(_d = identity.keyring.getKey(feedKey)) !== null && _d !== void 0 ? _d : (0, debug_1.failUndefined)(), signingKey]))));
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
197
|
/**
|
|
208
198
|
* Get all party members.
|
|
209
199
|
*/
|
|
@@ -229,9 +219,9 @@ class PartyInternal {
|
|
|
229
219
|
__decorate([
|
|
230
220
|
async_1.synchronized,
|
|
231
221
|
(0, debug_1.timed)(5000)
|
|
232
|
-
],
|
|
222
|
+
], DataParty.prototype, "open", null);
|
|
233
223
|
__decorate([
|
|
234
224
|
async_1.synchronized
|
|
235
|
-
],
|
|
236
|
-
exports.
|
|
237
|
-
//# sourceMappingURL=party
|
|
225
|
+
], DataParty.prototype, "close", null);
|
|
226
|
+
exports.DataParty = DataParty;
|
|
227
|
+
//# sourceMappingURL=data-party.js.map
|
|
@@ -0,0 +1 @@
|
|
|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AAMD;IADC,oBAAY;sCAeZ;AA5KH,8BA+PC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parties/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parties/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
|
|
@@ -13,8 +13,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
13
13
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
__exportStar(require("./party-core"), exports);
|
|
17
16
|
__exportStar(require("./party-factory"), exports);
|
|
18
|
-
__exportStar(require("./party
|
|
17
|
+
__exportStar(require("./data-party"), exports);
|
|
19
18
|
__exportStar(require("./party-manager"), exports);
|
|
20
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parties/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;AAEF
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parties/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;AAEF,kDAAgC;AAChC,+CAA6B;AAC7B,kDAAgC"}
|
|
@@ -5,10 +5,9 @@ import { ModelFactory } from '@dxos/model-factory';
|
|
|
5
5
|
import { NetworkManager } from '@dxos/network-manager';
|
|
6
6
|
import { IdentityProvider } from '../halo';
|
|
7
7
|
import { InvitationDescriptor } from '../invitations';
|
|
8
|
-
import { PartyFeedProvider } from '../pipeline';
|
|
8
|
+
import { PartyFeedProvider, PartyOptions } from '../pipeline';
|
|
9
9
|
import { SnapshotStore } from '../snapshots';
|
|
10
|
-
import {
|
|
11
|
-
import { PartyInternal } from './party-internal';
|
|
10
|
+
import { DataParty } from './data-party';
|
|
12
11
|
/**
|
|
13
12
|
* Creates and constructs party instances.
|
|
14
13
|
*/
|
|
@@ -17,27 +16,27 @@ export declare class PartyFactory {
|
|
|
17
16
|
private readonly _networkManager;
|
|
18
17
|
private readonly _modelFactory;
|
|
19
18
|
private readonly _snapshotStore;
|
|
20
|
-
private readonly
|
|
19
|
+
private readonly _feedProviderFactory;
|
|
21
20
|
private readonly _options;
|
|
22
|
-
constructor(_identityProvider: IdentityProvider, _networkManager: NetworkManager, _modelFactory: ModelFactory, _snapshotStore: SnapshotStore,
|
|
21
|
+
constructor(_identityProvider: IdentityProvider, _networkManager: NetworkManager, _modelFactory: ModelFactory, _snapshotStore: SnapshotStore, _feedProviderFactory: (partyKey: PublicKey) => PartyFeedProvider, _options?: PartyOptions);
|
|
23
22
|
/**
|
|
24
23
|
* Create a new party with a new feed for it. Writes a party genensis message to this feed.
|
|
25
24
|
*/
|
|
26
|
-
createParty(): Promise<
|
|
25
|
+
createParty(): Promise<DataParty>;
|
|
27
26
|
/**
|
|
28
27
|
* Constructs a party object and creates a local write feed for it.
|
|
29
28
|
* @param partyKey
|
|
30
29
|
* @param hints
|
|
31
30
|
*/
|
|
32
|
-
addParty(partyKey: PartyKey, hints?: KeyHint[]): Promise<
|
|
31
|
+
addParty(partyKey: PartyKey, hints?: KeyHint[]): Promise<DataParty>;
|
|
33
32
|
/**
|
|
34
33
|
* Constructs a party object from an existing set of feeds.
|
|
35
34
|
* @param partyKey
|
|
36
35
|
* @param hints
|
|
37
36
|
*/
|
|
38
|
-
constructParty(partyKey: PartyKey, hints?: KeyHint[], initialTimeframe?: Timeframe): Promise<
|
|
39
|
-
constructPartyFromSnapshot(snapshot: PartySnapshot): Promise<
|
|
40
|
-
joinParty(invitationDescriptor: InvitationDescriptor, secretProvider: SecretProvider): Promise<
|
|
41
|
-
cloneParty(snapshot: PartySnapshot): Promise<
|
|
37
|
+
constructParty(partyKey: PartyKey, hints?: KeyHint[], initialTimeframe?: Timeframe): Promise<DataParty>;
|
|
38
|
+
constructPartyFromSnapshot(snapshot: PartySnapshot): Promise<DataParty>;
|
|
39
|
+
joinParty(invitationDescriptor: InvitationDescriptor, secretProvider: SecretProvider): Promise<DataParty>;
|
|
40
|
+
cloneParty(snapshot: PartySnapshot): Promise<DataParty>;
|
|
42
41
|
}
|
|
43
42
|
//# sourceMappingURL=party-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"party-factory.d.ts","sourceRoot":"","sources":["../../../src/parties/party-factory.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,OAAO,EAEP,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAyB,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAiC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"party-factory.d.ts","sourceRoot":"","sources":["../../../src/parties/party-factory.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,OAAO,EAEP,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAyB,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAiC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAEc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o_protocol_1 = require("@dxos/echo-protocol");
|
|
22
22
|
const object_model_1 = require("@dxos/object-model");
|
|
23
|
+
const errors_1 = require("../errors");
|
|
23
24
|
const invitations_1 = require("../invitations");
|
|
24
|
-
const
|
|
25
|
+
const data_party_1 = require("./data-party");
|
|
25
26
|
const log = (0, debug_1.default)('dxos:echo-db:party-factory');
|
|
26
27
|
/**
|
|
27
28
|
* Creates and constructs party instances.
|
|
28
29
|
*/
|
|
29
30
|
class PartyFactory {
|
|
30
|
-
constructor(_identityProvider, _networkManager, _modelFactory, _snapshotStore,
|
|
31
|
+
constructor(_identityProvider, _networkManager, _modelFactory, _snapshotStore, _feedProviderFactory, _options = {}) {
|
|
31
32
|
this._identityProvider = _identityProvider;
|
|
32
33
|
this._networkManager = _networkManager;
|
|
33
34
|
this._modelFactory = _modelFactory;
|
|
34
35
|
this._snapshotStore = _snapshotStore;
|
|
35
|
-
this.
|
|
36
|
+
this._feedProviderFactory = _feedProviderFactory;
|
|
36
37
|
this._options = _options;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* Create a new party with a new feed for it. Writes a party genensis message to this feed.
|
|
40
41
|
*/
|
|
41
42
|
async createParty() {
|
|
42
|
-
|
|
43
|
+
var _a;
|
|
44
|
+
const identity = (_a = this._identityProvider()) !== null && _a !== void 0 ? _a : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError());
|
|
43
45
|
(0, assert_1.default)(identity.identityGenesis, 'HALO not initialized.');
|
|
44
46
|
(0, assert_1.default)(identity.deviceKeyChain, 'Device KeyChain not initialized.');
|
|
45
47
|
(0, assert_1.default)(!this._options.readOnly, 'PartyFactory is read-only.');
|
|
@@ -59,7 +61,7 @@ class PartyFactory {
|
|
|
59
61
|
await party.processor.writeHaloMessage((0, credentials_1.createEnvelopeMessage)(identity.signer, partyKey.publicKey, (0, credentials_1.wrapMessage)(identity.identityInfo), [identity.deviceKeyChain]));
|
|
60
62
|
}
|
|
61
63
|
// Create special properties item.
|
|
62
|
-
await party.database.createItem({ model: object_model_1.ObjectModel, type:
|
|
64
|
+
await party.database.createItem({ model: object_model_1.ObjectModel, type: data_party_1.PARTY_ITEM_TYPE });
|
|
63
65
|
// The Party key is an inception key; its SecretKey must be destroyed once the Party has been created.
|
|
64
66
|
await identity.keyring.deleteSecretKey(partyKey);
|
|
65
67
|
return party;
|
|
@@ -70,16 +72,17 @@ class PartyFactory {
|
|
|
70
72
|
* @param hints
|
|
71
73
|
*/
|
|
72
74
|
async addParty(partyKey, hints = []) {
|
|
73
|
-
|
|
75
|
+
var _a;
|
|
76
|
+
const identity = (_a = this._identityProvider()) !== null && _a !== void 0 ? _a : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError());
|
|
74
77
|
/*
|
|
75
78
|
* TODO(telackey): We shouldn't have to add our key here, it should be in the hints, but our hint
|
|
76
79
|
* mechanism is broken by not waiting on the messages to be processed before returning.
|
|
77
80
|
*/
|
|
78
|
-
const feedProvider = this.
|
|
81
|
+
const feedProvider = this._feedProviderFactory(partyKey);
|
|
79
82
|
const { feed } = await feedProvider.createOrOpenWritableFeed();
|
|
80
83
|
const feedKeyPair = identity.keyring.getKey(feed.key);
|
|
81
84
|
(0, assert_1.default)(feedKeyPair, 'Keypair for writable feed not found.');
|
|
82
|
-
const party = new
|
|
85
|
+
const party = new data_party_1.DataParty(partyKey, this._modelFactory, this._snapshotStore, feedProvider, identity.createCredentialsSigner(), identity.preferences, this._networkManager, hints, undefined, this._options);
|
|
83
86
|
await party.open();
|
|
84
87
|
(0, assert_1.default)(identity.identityKey, 'No identity key.');
|
|
85
88
|
const isHalo = identity.identityKey.publicKey.equals(partyKey);
|
|
@@ -95,12 +98,14 @@ class PartyFactory {
|
|
|
95
98
|
* @param hints
|
|
96
99
|
*/
|
|
97
100
|
async constructParty(partyKey, hints = [], initialTimeframe) {
|
|
101
|
+
var _a;
|
|
102
|
+
const identity = (_a = this._identityProvider()) !== null && _a !== void 0 ? _a : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError());
|
|
98
103
|
// TODO(marik-d): Support read-only parties if this feed doesn't exist?
|
|
99
|
-
const feedProvider = this.
|
|
104
|
+
const feedProvider = this._feedProviderFactory(partyKey);
|
|
100
105
|
//
|
|
101
106
|
// Create the party.
|
|
102
107
|
//
|
|
103
|
-
const party = new
|
|
108
|
+
const party = new data_party_1.DataParty(partyKey, this._modelFactory, this._snapshotStore, feedProvider, identity.createCredentialsSigner(), identity.preferences, this._networkManager, hints, initialTimeframe, this._options);
|
|
104
109
|
return party;
|
|
105
110
|
}
|
|
106
111
|
async constructPartyFromSnapshot(snapshot) {
|
|
@@ -111,9 +116,10 @@ class PartyFactory {
|
|
|
111
116
|
return party;
|
|
112
117
|
}
|
|
113
118
|
async joinParty(invitationDescriptor, secretProvider) {
|
|
119
|
+
var _a;
|
|
114
120
|
const haloInvitation = !!invitationDescriptor.identityKey;
|
|
115
121
|
const originalInvitation = invitationDescriptor;
|
|
116
|
-
const identity = this._identityProvider();
|
|
122
|
+
const identity = (_a = this._identityProvider()) !== null && _a !== void 0 ? _a : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError());
|
|
117
123
|
// Claim the offline invitation and convert it into an interactive invitation.
|
|
118
124
|
if (invitations_1.InvitationDescriptorType.OFFLINE === invitationDescriptor.type) {
|
|
119
125
|
const invitationClaimer = new invitations_1.OfflineInvitationClaimer(this._networkManager, invitationDescriptor);
|
|
@@ -123,7 +129,10 @@ class PartyFactory {
|
|
|
123
129
|
await invitationClaimer.destroy();
|
|
124
130
|
}
|
|
125
131
|
// TODO(burdon): Factor out.
|
|
126
|
-
const initiator = new invitations_1.GreetingInitiator(this._networkManager,
|
|
132
|
+
const initiator = new invitations_1.GreetingInitiator(this._networkManager, invitationDescriptor, async (partyKey, nonce) => {
|
|
133
|
+
var _a;
|
|
134
|
+
return [(0, invitations_1.createDataPartyAdmissionMessages)(identity.createCredentialsSigner(), partyKey, (_a = identity.identityGenesis) !== null && _a !== void 0 ? _a : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError()), nonce)];
|
|
135
|
+
});
|
|
127
136
|
await initiator.connect();
|
|
128
137
|
const { partyKey, hints } = await initiator.redeemInvitation(secretProvider);
|
|
129
138
|
const party = await this.addParty(partyKey, hints);
|
|
@@ -139,8 +148,8 @@ class PartyFactory {
|
|
|
139
148
|
return party;
|
|
140
149
|
}
|
|
141
150
|
async cloneParty(snapshot) {
|
|
142
|
-
var _a, _b;
|
|
143
|
-
const identity = this._identityProvider();
|
|
151
|
+
var _a, _b, _c;
|
|
152
|
+
const identity = (_a = this._identityProvider()) !== null && _a !== void 0 ? _a : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError());
|
|
144
153
|
(0, assert_1.default)(!this._options.readOnly, 'PartyFactory is read-only');
|
|
145
154
|
(0, assert_1.default)(identity.identityGenesis, 'IdentityGenesis must exist');
|
|
146
155
|
(0, assert_1.default)(identity.deviceKeyChain, 'Device KeyChain must exist');
|
|
@@ -172,10 +181,10 @@ class PartyFactory {
|
|
|
172
181
|
// }
|
|
173
182
|
// Write messages to create ECHO items.
|
|
174
183
|
const feedWriter = (0, echo_protocol_1.createFeedWriter)(writableFeed.feed);
|
|
175
|
-
for (const item of ((
|
|
184
|
+
for (const item of ((_b = snapshot.database) === null || _b === void 0 ? void 0 : _b.items) || []) {
|
|
176
185
|
const message = {
|
|
177
186
|
echo: {
|
|
178
|
-
itemId: (
|
|
187
|
+
itemId: (_c = item.itemId) !== null && _c !== void 0 ? _c : (0, debug_2.failUndefined)(),
|
|
179
188
|
genesis: {
|
|
180
189
|
itemType: item.itemType,
|
|
181
190
|
modelType: item.modelType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"party-factory.js","sourceRoot":"","sources":["../../../src/parties/party-factory.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;AAEF,oDAA4B;AAC5B,kDAA0B;AAE1B,mDAQ2B;AAC3B,yCAAgE;AAChE,
|
|
1
|
+
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AA,gCAAgB,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACvD,KAAK,MAAM,IAAI,IAAI,CAAA,MAAA,QAAQ,CAAC,QAAQ,0CAAE,KAAK,KAAI,EAAE,EAAE;YACjD,MAAM,OAAO,GAAgB;gBAC3B,IAAI,EAAE;oBACJ,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAA,qBAAa,GAAE;oBACtC,OAAO,EAAE;wBACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;wBACvB,SAAS,EAAE,IAAI,CAAC,SAAS;wBACzB,YAAY,EAAE,IAAI,CAAC,YAAY;qBAChC;oBACD,YAAY,EAAE;wBACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;qBACxB;oBACD,QAAQ,EAAE,IAAI,CAAC,KAAK;oBACpB,SAAS,EAAE,IAAI,yBAAS,EAAE;iBAC3B;aACF,CAAC;YACF,MAAM,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACjC;QAED,sGAAsG;QACtG,MAAM,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAEjD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAtRC;IADC,IAAA,aAAK,EAAC,IAAK,CAAC;+CAwDZ;AArEH,oCAoSC"}
|
|
@@ -3,10 +3,10 @@ import { KeyHint, SecretProvider } from '@dxos/credentials';
|
|
|
3
3
|
import { PartyKey, PartySnapshot } from '@dxos/echo-protocol';
|
|
4
4
|
import { IdentityProvider } from '../halo';
|
|
5
5
|
import { InvitationDescriptor } from '../invitations';
|
|
6
|
-
import { MetadataStore } from '../
|
|
6
|
+
import { MetadataStore } from '../pipeline';
|
|
7
7
|
import { SnapshotStore } from '../snapshots';
|
|
8
|
+
import { DataParty } from './data-party';
|
|
8
9
|
import { PartyFactory } from './party-factory';
|
|
9
|
-
import { PartyInternal } from './party-internal';
|
|
10
10
|
export declare const CONTACT_DEBOUNCE_INTERVAL = 500;
|
|
11
11
|
export interface OpenProgress {
|
|
12
12
|
haloOpened: boolean;
|
|
@@ -16,34 +16,34 @@ export interface OpenProgress {
|
|
|
16
16
|
/**
|
|
17
17
|
* Top-level class manages the complete life-cycle of parties.
|
|
18
18
|
*
|
|
19
|
-
* `
|
|
19
|
+
* `ECHO` => `PartyManager` => `DataParty` => `PartyCore`
|
|
20
20
|
*/
|
|
21
21
|
export declare class PartyManager {
|
|
22
22
|
private readonly _metadataStore;
|
|
23
23
|
private readonly _snapshotStore;
|
|
24
24
|
private readonly _identityProvider;
|
|
25
25
|
private readonly _partyFactory;
|
|
26
|
-
readonly update: Event<
|
|
26
|
+
readonly update: Event<DataParty>;
|
|
27
27
|
private readonly _parties;
|
|
28
28
|
private readonly _onCloseHandlers;
|
|
29
29
|
private _open;
|
|
30
30
|
constructor(_metadataStore: MetadataStore, _snapshotStore: SnapshotStore, _identityProvider: IdentityProvider, _partyFactory: PartyFactory);
|
|
31
31
|
get isOpen(): boolean;
|
|
32
|
-
get parties():
|
|
32
|
+
get parties(): DataParty[];
|
|
33
33
|
open(onProgressCallback?: (progress: OpenProgress) => void): Promise<void>;
|
|
34
34
|
close(): Promise<void>;
|
|
35
35
|
/**
|
|
36
36
|
* Creates a new party, writing its genesis block to the stream.
|
|
37
37
|
*/
|
|
38
|
-
createParty(): Promise<
|
|
38
|
+
createParty(): Promise<DataParty>;
|
|
39
39
|
/**
|
|
40
40
|
* Construct a party object and start replicating with the remote peer that created that party.
|
|
41
41
|
* @param partyKey
|
|
42
42
|
* @param hints
|
|
43
43
|
*/
|
|
44
|
-
addParty(partyKey: PartyKey, hints?: KeyHint[]): Promise<
|
|
45
|
-
joinParty(invitationDescriptor: InvitationDescriptor, secretProvider: SecretProvider): Promise<
|
|
46
|
-
cloneParty(snapshot: PartySnapshot): Promise<
|
|
44
|
+
addParty(partyKey: PartyKey, hints?: KeyHint[]): Promise<DataParty | undefined>;
|
|
45
|
+
joinParty(invitationDescriptor: InvitationDescriptor, secretProvider: SecretProvider): Promise<DataParty>;
|
|
46
|
+
cloneParty(snapshot: PartySnapshot): Promise<DataParty>;
|
|
47
47
|
private _setParty;
|
|
48
48
|
private _updatePartyTitle;
|
|
49
49
|
private _updateContactList;
|