@dxos/echo-db 2.33.5-dev.97a81dd0 → 2.33.5-dev.9e11cb97
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/index.d.ts +0 -5
- package/dist/src/api/index.d.ts.map +1 -1
- package/dist/src/api/index.js +0 -5
- package/dist/src/api/index.js.map +1 -1
- package/dist/src/api/schema.test.js +1 -1
- package/dist/src/api/schema.test.js.map +1 -1
- package/dist/src/echo.d.ts +1 -0
- package/dist/src/echo.d.ts.map +1 -1
- package/dist/src/echo.js +9 -20
- package/dist/src/echo.js.map +1 -1
- package/dist/src/echo.test.js.map +1 -1
- package/dist/src/halo/contact-manager.d.ts +2 -1
- package/dist/src/halo/contact-manager.d.ts.map +1 -1
- package/dist/src/halo/contact-manager.js +1 -1
- package/dist/src/halo/contact-manager.js.map +1 -1
- package/dist/src/halo/halo-factory.js +4 -4
- package/dist/src/halo/halo-factory.js.map +1 -1
- package/dist/src/halo/halo-party.d.ts +3 -3
- package/dist/src/halo/halo-party.d.ts.map +1 -1
- package/dist/src/halo/halo-party.js +5 -5
- package/dist/src/halo/halo-party.js.map +1 -1
- package/dist/src/halo/halo.test.js +4 -3
- package/dist/src/halo/halo.test.js.map +1 -1
- package/dist/src/halo/preferences.d.ts +1 -1
- package/dist/src/halo/preferences.d.ts.map +1 -1
- package/dist/src/halo/preferences.js +1 -1
- package/dist/src/halo/preferences.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/invitations/greeting-responder.d.ts +6 -4
- package/dist/src/invitations/greeting-responder.d.ts.map +1 -1
- package/dist/src/invitations/greeting-responder.js +3 -2
- package/dist/src/invitations/greeting-responder.js.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
- package/dist/src/invitations/invitation-descriptor.js +1 -1
- package/dist/src/invitations/invitation-descriptor.js.map +1 -1
- package/dist/src/invitations/invitation-factory.d.ts +5 -2
- package/dist/src/invitations/invitation-factory.d.ts.map +1 -1
- package/dist/src/invitations/invitation-factory.js +4 -3
- package/dist/src/invitations/invitation-factory.js.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.js +1 -1
- package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
- package/dist/src/{database → packlets/database}/data-mirror.d.ts +0 -0
- package/dist/src/packlets/database/data-mirror.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-mirror.js +0 -0
- package/dist/src/packlets/database/data-mirror.js.map +1 -0
- package/dist/src/{database → packlets/database}/data-mirror.test.d.ts +0 -0
- package/dist/src/packlets/database/data-mirror.test.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-mirror.test.js +0 -0
- package/dist/src/packlets/database/data-mirror.test.js.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-host.d.ts +0 -0
- package/dist/src/packlets/database/data-service-host.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-host.js +4 -3
- package/dist/src/packlets/database/data-service-host.js.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-router.d.ts +0 -0
- package/dist/src/packlets/database/data-service-router.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/data-service-router.js +0 -0
- package/dist/src/packlets/database/data-service-router.js.map +1 -0
- package/dist/src/{database → packlets/database}/database-backend.d.ts +0 -0
- package/dist/src/packlets/database/database-backend.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/database-backend.js +0 -0
- package/dist/src/packlets/database/database-backend.js.map +1 -0
- package/dist/src/{api → packlets/database}/database.d.ts +2 -1
- package/dist/src/packlets/database/database.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/database.js +2 -2
- package/dist/src/packlets/database/database.js.map +1 -0
- package/dist/src/{api → packlets/database}/database.test.d.ts +0 -0
- package/dist/src/packlets/database/database.test.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/database.test.js +3 -3
- package/dist/src/packlets/database/database.test.js.map +1 -0
- package/dist/src/{api → packlets/database}/entity.d.ts +1 -1
- package/dist/src/packlets/database/entity.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/entity.js +0 -0
- package/dist/src/packlets/database/entity.js.map +1 -0
- package/dist/src/{database → packlets/database}/index.d.ts +5 -0
- package/dist/src/packlets/database/index.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/index.js +5 -0
- package/dist/src/packlets/database/index.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.d.ts +2 -1
- package/dist/src/packlets/database/item-demuxer.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.js +0 -0
- package/dist/src/packlets/database/item-demuxer.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.test.d.ts +0 -0
- package/dist/src/packlets/database/item-demuxer.test.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-demuxer.test.js +2 -2
- package/dist/src/packlets/database/item-demuxer.test.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.d.ts +3 -1
- package/dist/src/packlets/database/item-manager.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.js +11 -10
- package/dist/src/packlets/database/item-manager.js.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.test.d.ts +0 -0
- package/dist/src/packlets/database/item-manager.test.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/item-manager.test.js +0 -0
- package/dist/src/packlets/database/item-manager.test.js.map +1 -0
- package/dist/src/{api → packlets/database}/item.d.ts +1 -1
- package/dist/src/packlets/database/item.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/item.js +0 -0
- package/dist/src/packlets/database/item.js.map +1 -0
- package/dist/src/{api → packlets/database}/link.d.ts +1 -1
- package/dist/src/packlets/database/link.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/link.js +0 -0
- package/dist/src/packlets/database/link.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/index.d.ts +0 -0
- package/dist/src/packlets/database/selection/index.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/index.js +0 -0
- package/dist/src/packlets/database/selection/index.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/queries.d.ts +0 -0
- package/dist/src/packlets/database/selection/queries.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/queries.js +0 -0
- package/dist/src/packlets/database/selection/queries.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/result.d.ts +0 -0
- package/dist/src/packlets/database/selection/result.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/result.js +0 -0
- package/dist/src/packlets/database/selection/result.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.d.ts +0 -0
- package/dist/src/packlets/database/selection/selection.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.js +0 -0
- package/dist/src/packlets/database/selection/selection.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.test.d.ts +0 -0
- package/dist/src/packlets/database/selection/selection.test.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/selection.test.js +0 -0
- package/dist/src/packlets/database/selection/selection.test.js.map +1 -0
- package/dist/src/{api → packlets/database}/selection/util.d.ts +0 -0
- package/dist/src/packlets/database/selection/util.d.ts.map +1 -0
- package/dist/src/{api → packlets/database}/selection/util.js +0 -0
- package/dist/src/packlets/database/selection/util.js.map +1 -0
- package/dist/src/{database → packlets/database}/testing.d.ts +1 -1
- package/dist/src/packlets/database/testing.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/testing.js +3 -3
- package/dist/src/packlets/database/testing.js.map +1 -0
- package/dist/src/{database → packlets/database}/timeframe-clock.d.ts +0 -0
- package/dist/src/packlets/database/timeframe-clock.d.ts.map +1 -0
- package/dist/src/{database → packlets/database}/timeframe-clock.js +0 -0
- package/dist/src/packlets/database/timeframe-clock.js.map +1 -0
- package/dist/src/{errors.d.ts → packlets/errors/index.d.ts} +1 -1
- package/dist/src/packlets/errors/index.d.ts.map +1 -0
- package/dist/src/{errors.js → packlets/errors/index.js} +1 -1
- package/dist/src/packlets/errors/index.js.map +1 -0
- package/dist/src/parties/data-party.d.ts +6 -5
- package/dist/src/parties/data-party.d.ts.map +1 -1
- package/dist/src/parties/data-party.js +5 -5
- package/dist/src/parties/data-party.js.map +1 -1
- package/dist/src/parties/data-party.test.js +13 -12
- package/dist/src/parties/data-party.test.js.map +1 -1
- package/dist/src/parties/party-factory.d.ts.map +1 -1
- package/dist/src/parties/party-factory.js +10 -10
- package/dist/src/parties/party-factory.js.map +1 -1
- package/dist/src/parties/party-manager.test.js +7 -6
- package/dist/src/parties/party-manager.test.js.map +1 -1
- package/dist/src/pipeline/message-selector.d.ts +1 -1
- package/dist/src/pipeline/message-selector.d.ts.map +1 -1
- package/dist/src/pipeline/metadata-store.d.ts +3 -3
- package/dist/src/pipeline/metadata-store.d.ts.map +1 -1
- package/dist/src/pipeline/metadata-store.js +5 -5
- package/dist/src/pipeline/metadata-store.js.map +1 -1
- package/dist/src/pipeline/metadata-store.test.js +8 -4
- package/dist/src/pipeline/metadata-store.test.js.map +1 -1
- package/dist/src/pipeline/party-core.d.ts +3 -3
- package/dist/src/pipeline/party-core.d.ts.map +1 -1
- package/dist/src/pipeline/party-core.js +7 -12
- package/dist/src/pipeline/party-core.js.map +1 -1
- package/dist/src/pipeline/party-core.test.js +15 -15
- package/dist/src/pipeline/party-core.test.js.map +1 -1
- package/dist/src/pipeline/party-processor.d.ts +3 -9
- package/dist/src/pipeline/party-processor.d.ts.map +1 -1
- package/dist/src/pipeline/party-processor.js +0 -8
- package/dist/src/pipeline/party-processor.js.map +1 -1
- package/dist/src/pipeline/pipeline.d.ts +1 -1
- package/dist/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/src/pipeline/pipeline.test.js +3 -3
- package/dist/src/pipeline/pipeline.test.js.map +1 -1
- package/dist/src/protocol/authenticator.d.ts +3 -3
- package/dist/src/protocol/authenticator.d.ts.map +1 -1
- package/dist/src/protocol/authenticator.js +2 -2
- package/dist/src/protocol/authenticator.js.map +1 -1
- package/dist/src/protocol/authenticator.test.js +1 -4
- package/dist/src/protocol/authenticator.test.js.map +1 -1
- package/dist/src/snapshots/snapshot-generator.d.ts +1 -1
- package/dist/src/snapshots/snapshot-generator.d.ts.map +1 -1
- package/dist/src/snapshots/snapshot-store.d.ts +3 -3
- package/dist/src/snapshots/snapshot-store.d.ts.map +1 -1
- package/dist/src/snapshots/snapshot-store.js +5 -5
- package/dist/src/snapshots/snapshot-store.js.map +1 -1
- package/dist/src/snapshots/snapshot-store.test.js +1 -1
- package/dist/src/snapshots/snapshot-store.test.js.map +1 -1
- package/dist/src/snapshots/snapshot.test.js +1 -1
- package/dist/src/snapshots/snapshot.test.js.map +1 -1
- package/dist/src/testing/testing-factories.d.ts +1 -1
- package/dist/src/testing/testing-factories.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/api/index.ts +0 -5
- package/src/api/schema.test.ts +1 -2
- package/src/echo.test.ts +1 -1
- package/src/echo.ts +10 -20
- package/src/halo/contact-manager.ts +3 -2
- package/src/halo/halo-factory.ts +4 -4
- package/src/halo/halo-party.ts +12 -7
- package/src/halo/halo.test.ts +4 -3
- package/src/halo/preferences.ts +3 -2
- package/src/index.ts +3 -2
- package/src/invitations/greeting-responder.ts +7 -5
- package/src/invitations/halo-recovery-initiator.ts +1 -1
- package/src/invitations/invitation-descriptor.ts +1 -1
- package/src/invitations/invitation-factory.ts +8 -5
- package/src/invitations/offline-invitation-claimer.ts +1 -1
- package/src/{database → packlets/database}/data-mirror.test.ts +1 -1
- package/src/{database → packlets/database}/data-mirror.ts +1 -1
- package/src/{database → packlets/database}/data-service-host.ts +2 -1
- package/src/{database → packlets/database}/data-service-router.ts +0 -0
- package/src/{database → packlets/database}/database-backend.ts +0 -0
- package/src/{api → packlets/database}/database.test.ts +2 -1
- package/src/{api → packlets/database}/database.ts +3 -1
- package/src/{api → packlets/database}/entity.ts +1 -1
- package/src/{database → packlets/database}/index.ts +5 -0
- package/src/{database → packlets/database}/item-demuxer.test.ts +1 -1
- package/src/{database → packlets/database}/item-demuxer.ts +3 -1
- package/src/{database → packlets/database}/item-manager.test.ts +0 -0
- package/src/{database → packlets/database}/item-manager.ts +3 -1
- package/src/{api → packlets/database}/item.ts +2 -2
- package/src/{api → packlets/database}/link.ts +1 -1
- package/src/{api → packlets/database}/selection/index.ts +0 -0
- package/src/{api → packlets/database}/selection/queries.ts +0 -0
- package/src/{api → packlets/database}/selection/result.ts +0 -0
- package/src/{api → packlets/database}/selection/selection.test.ts +0 -0
- package/src/{api → packlets/database}/selection/selection.ts +0 -0
- package/src/{api → packlets/database}/selection/util.ts +0 -0
- package/src/{database → packlets/database}/testing.ts +1 -1
- package/src/{database → packlets/database}/timeframe-clock.ts +0 -0
- package/src/{errors.ts → packlets/errors/index.ts} +0 -0
- package/src/parties/data-party.test.ts +14 -12
- package/src/parties/data-party.ts +10 -8
- package/src/parties/party-factory.ts +10 -10
- package/src/parties/party-manager.test.ts +10 -7
- package/src/pipeline/message-selector.ts +1 -1
- package/src/pipeline/metadata-store.test.ts +8 -4
- package/src/pipeline/metadata-store.ts +5 -5
- package/src/pipeline/party-core.test.ts +15 -15
- package/src/pipeline/party-core.ts +7 -13
- package/src/pipeline/party-processor.ts +2 -18
- package/src/pipeline/pipeline.test.ts +3 -3
- package/src/pipeline/pipeline.ts +1 -1
- package/src/protocol/authenticator.test.ts +1 -4
- package/src/protocol/authenticator.ts +8 -4
- package/src/snapshots/snapshot-generator.ts +1 -1
- package/src/snapshots/snapshot-store.test.ts +1 -1
- package/src/snapshots/snapshot-store.ts +5 -6
- package/src/snapshots/snapshot.test.ts +1 -1
- package/src/testing/testing-factories.ts +1 -1
- package/dist/src/api/database.d.ts.map +0 -1
- package/dist/src/api/database.js.map +0 -1
- package/dist/src/api/database.test.d.ts.map +0 -1
- package/dist/src/api/database.test.js.map +0 -1
- package/dist/src/api/entity.d.ts.map +0 -1
- package/dist/src/api/entity.js.map +0 -1
- package/dist/src/api/item.d.ts.map +0 -1
- package/dist/src/api/item.js.map +0 -1
- package/dist/src/api/link.d.ts.map +0 -1
- package/dist/src/api/link.js.map +0 -1
- package/dist/src/api/selection/index.d.ts.map +0 -1
- package/dist/src/api/selection/index.js.map +0 -1
- package/dist/src/api/selection/queries.d.ts.map +0 -1
- package/dist/src/api/selection/queries.js.map +0 -1
- package/dist/src/api/selection/result.d.ts.map +0 -1
- package/dist/src/api/selection/result.js.map +0 -1
- package/dist/src/api/selection/selection.d.ts.map +0 -1
- package/dist/src/api/selection/selection.js.map +0 -1
- package/dist/src/api/selection/selection.test.d.ts.map +0 -1
- package/dist/src/api/selection/selection.test.js.map +0 -1
- package/dist/src/api/selection/util.d.ts.map +0 -1
- package/dist/src/api/selection/util.js.map +0 -1
- package/dist/src/database/data-mirror.d.ts.map +0 -1
- package/dist/src/database/data-mirror.js.map +0 -1
- package/dist/src/database/data-mirror.test.d.ts.map +0 -1
- package/dist/src/database/data-mirror.test.js.map +0 -1
- package/dist/src/database/data-service-host.d.ts.map +0 -1
- package/dist/src/database/data-service-host.js.map +0 -1
- package/dist/src/database/data-service-router.d.ts.map +0 -1
- package/dist/src/database/data-service-router.js.map +0 -1
- package/dist/src/database/database-backend.d.ts.map +0 -1
- package/dist/src/database/database-backend.js.map +0 -1
- package/dist/src/database/index.d.ts.map +0 -1
- package/dist/src/database/index.js.map +0 -1
- package/dist/src/database/item-demuxer.d.ts.map +0 -1
- package/dist/src/database/item-demuxer.js.map +0 -1
- package/dist/src/database/item-demuxer.test.d.ts.map +0 -1
- package/dist/src/database/item-demuxer.test.js.map +0 -1
- package/dist/src/database/item-manager.d.ts.map +0 -1
- package/dist/src/database/item-manager.js.map +0 -1
- package/dist/src/database/item-manager.test.d.ts.map +0 -1
- package/dist/src/database/item-manager.test.js.map +0 -1
- package/dist/src/database/testing.d.ts.map +0 -1
- package/dist/src/database/testing.js.map +0 -1
- package/dist/src/database/timeframe-clock.d.ts.map +0 -1
- package/dist/src/database/timeframe-clock.js.map +0 -1
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js.map +0 -1
package/src/echo.ts
CHANGED
|
@@ -19,11 +19,11 @@ import { Storage, createStorage, StorageType } from '@dxos/random-access-multi-s
|
|
|
19
19
|
import { SubscriptionGroup } from '@dxos/util';
|
|
20
20
|
|
|
21
21
|
import { ResultSet } from './api';
|
|
22
|
-
import { DataServiceRouter } from './database';
|
|
23
|
-
import { IdentityNotInitializedError, InvalidStorageVersionError } from './errors';
|
|
24
22
|
import { HALO } from './halo';
|
|
25
23
|
import { autoPartyOpener } from './halo/party-opener';
|
|
26
24
|
import { InvitationDescriptor, OfflineInvitationClaimer } from './invitations';
|
|
25
|
+
import { DataServiceRouter } from './packlets/database';
|
|
26
|
+
import { IdentityNotInitializedError, InvalidStorageVersionError } from './packlets/errors';
|
|
27
27
|
import { OpenProgress, PartyFactory, DataParty, PartyManager } from './parties';
|
|
28
28
|
import { MetadataStore, STORAGE_VERSION, PartyFeedProvider } from './pipeline';
|
|
29
29
|
import { SnapshotStore } from './snapshots';
|
|
@@ -87,6 +87,7 @@ export class ECHO {
|
|
|
87
87
|
private readonly _halo: HALO;
|
|
88
88
|
private readonly _keyring: Keyring;
|
|
89
89
|
|
|
90
|
+
private readonly _storage: Storage;
|
|
90
91
|
private readonly _feedStore: FeedStore;
|
|
91
92
|
private readonly _modelFactory: ModelFactory;
|
|
92
93
|
private readonly _networkManager: NetworkManager;
|
|
@@ -114,11 +115,12 @@ export class ECHO {
|
|
|
114
115
|
this._modelFactory = new ModelFactory()
|
|
115
116
|
.registerModel(ObjectModel);
|
|
116
117
|
|
|
118
|
+
this._storage = storage;
|
|
117
119
|
this._networkManager = new NetworkManager(networkManagerOptions);
|
|
118
|
-
this._snapshotStore = new SnapshotStore(storage.
|
|
119
|
-
this._metadataStore = new MetadataStore(storage.
|
|
120
|
+
this._snapshotStore = new SnapshotStore(storage.directory('snapshots'));
|
|
121
|
+
this._metadataStore = new MetadataStore(storage.directory('metadata'));
|
|
120
122
|
this._keyring = new Keyring(new KeyStore(keyStorage));
|
|
121
|
-
this._feedStore = new FeedStore(storage.
|
|
123
|
+
this._feedStore = new FeedStore(storage.directory('feeds'), { valueEncoding: codec });
|
|
122
124
|
|
|
123
125
|
const feedProviderFactory = (partyKey: PublicKey) => new PartyFeedProvider(
|
|
124
126
|
this._metadataStore,
|
|
@@ -275,26 +277,14 @@ export class ECHO {
|
|
|
275
277
|
await this.close();
|
|
276
278
|
|
|
277
279
|
try {
|
|
278
|
-
if (this.
|
|
279
|
-
await this.
|
|
280
|
+
if (this._storage.destroy) {
|
|
281
|
+
await this._storage.destroy();
|
|
280
282
|
}
|
|
281
283
|
} catch (err: any) {
|
|
282
|
-
error('Error clearing
|
|
284
|
+
error('Error clearing storage:', err);
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
await this.halo.reset();
|
|
286
|
-
|
|
287
|
-
try {
|
|
288
|
-
await this._snapshotStore.clear();
|
|
289
|
-
} catch (err: any) {
|
|
290
|
-
error('Error clearing snapshot storage:', err);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
try {
|
|
294
|
-
await this._metadataStore.clear();
|
|
295
|
-
} catch (err: any) {
|
|
296
|
-
error('Error clearing metadata storage:', err);
|
|
297
|
-
}
|
|
298
288
|
}
|
|
299
289
|
|
|
300
290
|
//
|
|
@@ -7,8 +7,9 @@ import { PublicKey } from '@dxos/crypto';
|
|
|
7
7
|
import { raise } from '@dxos/debug';
|
|
8
8
|
import { ObjectModel } from '@dxos/object-model';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { ResultSet } from '../api';
|
|
11
|
+
import { Database, Item } from '../packlets/database';
|
|
12
|
+
import { IdentityNotInitializedError } from '../packlets/errors';
|
|
12
13
|
import { PartyMember } from '../parties';
|
|
13
14
|
import { HALO_PARTY_CONTACT_LIST_TYPE } from './halo-party';
|
|
14
15
|
|
package/src/halo/halo-factory.ts
CHANGED
|
@@ -93,21 +93,21 @@ export class HaloFactory {
|
|
|
93
93
|
* B. Device key (the first "member" of the Identity's HALO).
|
|
94
94
|
* C. Feed key (the feed owned by the Device).
|
|
95
95
|
*/
|
|
96
|
-
await halo.
|
|
96
|
+
await halo.credentialsWriter.write(createPartyGenesisMessage(this._keyring, identityKey, feedKeyPair.publicKey, deviceKey));
|
|
97
97
|
|
|
98
98
|
/* 3. Make a special self-signed KeyAdmit message which will serve as an "IdentityGenesis" message. This
|
|
99
99
|
* message will be copied into other Parties which we create or join.
|
|
100
100
|
*/
|
|
101
|
-
await halo.
|
|
101
|
+
await halo.credentialsWriter.write(createKeyAdmitMessage(this._keyring, identityKey.publicKey, identityKey));
|
|
102
102
|
|
|
103
103
|
if (options.identityDisplayName) {
|
|
104
104
|
// 4. Write the IdentityInfo message with descriptive details (eg, display name).
|
|
105
|
-
await halo.
|
|
105
|
+
await halo.credentialsWriter.write(createIdentityInfoMessage(this._keyring, options.identityDisplayName, identityKey));
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if (options.deviceDisplayName) {
|
|
109
109
|
// 5. Write the DeviceInfo message with descriptive details (eg, display name).
|
|
110
|
-
await halo.
|
|
110
|
+
await halo.credentialsWriter.write(createDeviceInfoMessage(this._keyring, options.deviceDisplayName, deviceKey));
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// Create special properties item.
|
package/src/halo/halo-party.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
|
|
7
7
|
import { Event, synchronized } from '@dxos/async';
|
|
8
|
-
import { KeyHint
|
|
8
|
+
import { KeyHint } from '@dxos/credentials';
|
|
9
9
|
import { PublicKey } from '@dxos/crypto';
|
|
10
10
|
import { timed } from '@dxos/debug';
|
|
11
|
-
import { Timeframe
|
|
11
|
+
import { Timeframe } from '@dxos/echo-protocol';
|
|
12
12
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
13
|
import { NetworkManager } from '@dxos/network-manager';
|
|
14
14
|
|
|
@@ -122,6 +122,10 @@ export class HaloParty {
|
|
|
122
122
|
return this._partyCore.processor.feedKeys;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
get credentialsWriter () {
|
|
126
|
+
return this._partyCore.credentialsWriter;
|
|
127
|
+
}
|
|
128
|
+
|
|
125
129
|
async getWriteFeedKey () {
|
|
126
130
|
const feed = await this._feedProvider.createOrOpenWritableFeed();
|
|
127
131
|
return feed.key;
|
|
@@ -146,6 +150,7 @@ export class HaloParty {
|
|
|
146
150
|
this._invitationManager = new InvitationFactory(
|
|
147
151
|
this._partyCore.processor,
|
|
148
152
|
this._credentialsSigner,
|
|
153
|
+
this._partyCore.credentialsWriter,
|
|
149
154
|
this._networkManager
|
|
150
155
|
);
|
|
151
156
|
|
|
@@ -165,7 +170,11 @@ export class HaloParty {
|
|
|
165
170
|
// Replication.
|
|
166
171
|
await this._protocol.start([
|
|
167
172
|
createReplicatorPlugin(this._feedProvider),
|
|
168
|
-
createAuthPlugin(createAuthenticator(
|
|
173
|
+
createAuthPlugin(createAuthenticator(
|
|
174
|
+
this._partyCore.processor,
|
|
175
|
+
this._credentialsSigner,
|
|
176
|
+
this._partyCore.credentialsWriter
|
|
177
|
+
), peerId),
|
|
169
178
|
createHaloRecoveryPlugin(this._credentialsSigner.getIdentityKey().publicKey, this._invitationManager, peerId)
|
|
170
179
|
]);
|
|
171
180
|
|
|
@@ -196,10 +205,6 @@ export class HaloParty {
|
|
|
196
205
|
return this;
|
|
197
206
|
}
|
|
198
207
|
|
|
199
|
-
writeCredentialsMessage (message: HaloMessage): Promise<WriteReceipt> {
|
|
200
|
-
return this._partyCore.writeCredentialsMessage(message);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
208
|
async createInvitation (authenticationDetails: InvitationAuthenticator, options?: InvitationOptions): Promise<InvitationDescriptor> {
|
|
204
209
|
assert(this._invitationManager, 'HALO party not open.');
|
|
205
210
|
return this._invitationManager.createInvitation(authenticationDetails, options);
|
package/src/halo/halo.test.ts
CHANGED
|
@@ -26,10 +26,11 @@ describe('HALO', () => {
|
|
|
26
26
|
.registerModel(ObjectModel);
|
|
27
27
|
|
|
28
28
|
const networkManager = new NetworkManager();
|
|
29
|
-
const
|
|
30
|
-
const
|
|
29
|
+
const storage = createStorage('', StorageType.RAM);
|
|
30
|
+
const snapshotStore = new SnapshotStore(storage.directory('snapshots'));
|
|
31
|
+
const metadataStore = new MetadataStore(storage.directory('metadata'));
|
|
31
32
|
const keyring = new Keyring();
|
|
32
|
-
const feedStore = new FeedStore(
|
|
33
|
+
const feedStore = new FeedStore(storage.directory('feed'), { valueEncoding: codec });
|
|
33
34
|
|
|
34
35
|
const feedProviderFactory = (partyKey: PublicKey) => new PartyFeedProvider(
|
|
35
36
|
metadataStore,
|
package/src/halo/preferences.ts
CHANGED
|
@@ -12,8 +12,9 @@ import { PublicKey } from '@dxos/crypto';
|
|
|
12
12
|
import { raise } from '@dxos/debug';
|
|
13
13
|
import { ObjectModel } from '@dxos/object-model';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { ResultSet } from '../api';
|
|
16
|
+
import { Database, Item } from '../packlets/database';
|
|
17
|
+
import { IdentityNotInitializedError } from '../packlets/errors';
|
|
17
18
|
import { DataParty } from '../parties';
|
|
18
19
|
import {
|
|
19
20
|
HALO_PARTY_DESCRIPTOR_TYPE, HALO_PARTY_DEVICE_PREFERENCES_TYPE, HALO_PARTY_PREFERENCES_TYPE, JoinedParty
|
package/src/index.ts
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
export { codec } from '@dxos/echo-protocol';
|
|
6
6
|
|
|
7
|
+
export * from './packlets/database';
|
|
8
|
+
export * from './packlets/errors';
|
|
9
|
+
|
|
7
10
|
export * from './api';
|
|
8
|
-
export * from './database';
|
|
9
11
|
export * from './echo';
|
|
10
|
-
export * from './errors';
|
|
11
12
|
export * from './halo';
|
|
12
13
|
export * from './invitations';
|
|
13
14
|
export * from './protocol';
|
|
@@ -14,12 +14,13 @@ import {
|
|
|
14
14
|
KeyType,
|
|
15
15
|
SecretProvider,
|
|
16
16
|
SecretValidator
|
|
17
|
+
, Message as HaloMessage
|
|
17
18
|
} from '@dxos/credentials';
|
|
18
19
|
import { keyToString, randomBytes, PublicKey } from '@dxos/crypto';
|
|
19
|
-
import { SwarmKey } from '@dxos/echo-protocol';
|
|
20
|
+
import { FeedWriter, SwarmKey } from '@dxos/echo-protocol';
|
|
20
21
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
21
22
|
|
|
22
|
-
import {
|
|
23
|
+
import { PartyStateProvider } from '../pipeline';
|
|
23
24
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
24
25
|
import { InvitationOptions } from './common';
|
|
25
26
|
import { greetingProtocolProvider } from './greeting-protocol-provider';
|
|
@@ -57,8 +58,9 @@ export class GreetingResponder {
|
|
|
57
58
|
|
|
58
59
|
constructor (
|
|
59
60
|
private readonly _networkManager: NetworkManager,
|
|
60
|
-
private readonly _partyProcessor:
|
|
61
|
-
private readonly _credentialsSigner: CredentialsSigner
|
|
61
|
+
private readonly _partyProcessor: PartyStateProvider,
|
|
62
|
+
private readonly _credentialsSigner: CredentialsSigner,
|
|
63
|
+
private readonly _credentialsWriter: FeedWriter<HaloMessage>
|
|
62
64
|
) {
|
|
63
65
|
this._greeter = new Greeter(
|
|
64
66
|
this._partyProcessor.partyKey,
|
|
@@ -222,7 +224,7 @@ export class GreetingResponder {
|
|
|
222
224
|
[this._credentialsSigner.getDeviceSigningKeys()]
|
|
223
225
|
);
|
|
224
226
|
|
|
225
|
-
await this.
|
|
227
|
+
await this._credentialsWriter.write(envelope);
|
|
226
228
|
|
|
227
229
|
// Wait for keys to be admitted.
|
|
228
230
|
await waitForCondition(() => admittedKeys.every(hasKey));
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { keyToBuffer, keyToString, PublicKey, randomBytes, verify } from '@dxos/crypto';
|
|
23
23
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
24
24
|
|
|
25
|
-
import { InvalidInvitationError } from '../errors';
|
|
25
|
+
import { InvalidInvitationError } from '../packlets/errors';
|
|
26
26
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
27
27
|
import { greetingProtocolProvider } from './greeting-protocol-provider';
|
|
28
28
|
import { GreetingState } from './greeting-responder';
|
|
@@ -10,7 +10,7 @@ import { keyToBuffer, keyToString, ripemd160, PublicKey } from '@dxos/crypto';
|
|
|
10
10
|
import { SwarmKey } from '@dxos/echo-protocol';
|
|
11
11
|
import * as proto from '@dxos/echo-protocol';
|
|
12
12
|
|
|
13
|
-
import { InvalidInvitationError } from '../errors';
|
|
13
|
+
import { InvalidInvitationError } from '../packlets/errors';
|
|
14
14
|
|
|
15
15
|
// Re-exporting type enum from protobuf definitions.
|
|
16
16
|
export import InvitationDescriptorType = proto.InvitationDescriptor.Type;
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
|
|
7
|
-
import { createPartyInvitationMessage } from '@dxos/credentials';
|
|
7
|
+
import { createPartyInvitationMessage, Message as HaloMessage } from '@dxos/credentials';
|
|
8
8
|
import { PublicKey } from '@dxos/crypto';
|
|
9
|
+
import { FeedWriter } from '@dxos/echo-protocol';
|
|
9
10
|
import { NetworkManager } from '@dxos/network-manager';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { PartyStateProvider } from '../pipeline';
|
|
12
13
|
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
13
14
|
import { defaultInvitationAuthenticator, InvitationAuthenticator, InvitationOptions } from './common';
|
|
14
15
|
import { GreetingResponder } from './greeting-responder';
|
|
@@ -19,10 +20,11 @@ import { InvitationDescriptor, InvitationDescriptorType } from './invitation-des
|
|
|
19
20
|
*/
|
|
20
21
|
export class InvitationFactory {
|
|
21
22
|
constructor (
|
|
22
|
-
private readonly _partyProcessor:
|
|
23
|
+
private readonly _partyProcessor: PartyStateProvider,
|
|
23
24
|
// This needs to be a provider in case this is a backend for the HALO party.
|
|
24
25
|
// Then the identity would be changed after this is instantiated.
|
|
25
26
|
private readonly _credentialsSigner: CredentialsSigner,
|
|
27
|
+
private readonly _credentialsWriter: FeedWriter<HaloMessage>,
|
|
26
28
|
private readonly _networkManager: NetworkManager
|
|
27
29
|
) {}
|
|
28
30
|
|
|
@@ -42,7 +44,7 @@ export class InvitationFactory {
|
|
|
42
44
|
this._credentialsSigner.getDeviceSigningKeys()
|
|
43
45
|
);
|
|
44
46
|
|
|
45
|
-
await this.
|
|
47
|
+
await this._credentialsWriter.write(invitationMessage);
|
|
46
48
|
|
|
47
49
|
return new InvitationDescriptor(
|
|
48
50
|
InvitationDescriptorType.OFFLINE,
|
|
@@ -60,7 +62,8 @@ export class InvitationFactory {
|
|
|
60
62
|
const responder = new GreetingResponder(
|
|
61
63
|
this._networkManager,
|
|
62
64
|
this._partyProcessor,
|
|
63
|
-
this._credentialsSigner
|
|
65
|
+
this._credentialsSigner,
|
|
66
|
+
this._credentialsWriter
|
|
64
67
|
);
|
|
65
68
|
|
|
66
69
|
const { secretValidator, secretProvider } = authenticationDetails;
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { keyToBuffer, keyToString, PublicKey, randomBytes } from '@dxos/crypto';
|
|
24
24
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
25
25
|
|
|
26
|
-
import { InvalidInvitationError } from '../errors';
|
|
26
|
+
import { InvalidInvitationError } from '../packlets/errors';
|
|
27
27
|
import { CredentialsSigner } from '../protocol';
|
|
28
28
|
import { greetingProtocolProvider } from './greeting-protocol-provider';
|
|
29
29
|
import { GreetingState } from './greeting-responder';
|
|
@@ -11,10 +11,10 @@ import { EchoEnvelope, MockFeedWriter, Timeframe } from '@dxos/echo-protocol';
|
|
|
11
11
|
import { ModelFactory } from '@dxos/model-factory';
|
|
12
12
|
import { ObjectModel } from '@dxos/object-model';
|
|
13
13
|
|
|
14
|
-
import { Item } from '../api';
|
|
15
14
|
import { DataMirror } from './data-mirror';
|
|
16
15
|
import { DataServiceHost } from './data-service-host';
|
|
17
16
|
import { DataServiceRouter } from './data-service-router';
|
|
17
|
+
import { Item } from './item';
|
|
18
18
|
import { ItemDemuxer } from './item-demuxer';
|
|
19
19
|
import { ItemManager } from './item-manager';
|
|
20
20
|
|
|
@@ -10,7 +10,7 @@ import { failUndefined } from '@dxos/debug';
|
|
|
10
10
|
import { DataService } from '@dxos/echo-protocol';
|
|
11
11
|
import { Model } from '@dxos/model-factory';
|
|
12
12
|
|
|
13
|
-
import { Entity } from '
|
|
13
|
+
import { Entity } from './entity';
|
|
14
14
|
import { ItemManager } from './item-manager';
|
|
15
15
|
|
|
16
16
|
const log = debug('dxos:echo-db:data-mirror');
|
|
@@ -18,10 +18,11 @@ import {
|
|
|
18
18
|
SubscribeEntityStreamResponse
|
|
19
19
|
} from '@dxos/echo-protocol';
|
|
20
20
|
|
|
21
|
-
import { Item, Link } from '../api';
|
|
22
21
|
import { EntityNotFoundError } from '../errors';
|
|
22
|
+
import { Item } from './item';
|
|
23
23
|
import { ItemDemuxer } from './item-demuxer';
|
|
24
24
|
import { ItemManager } from './item-manager';
|
|
25
|
+
import { Link } from './link';
|
|
25
26
|
|
|
26
27
|
const log = debug('dxos:echo-db:data-service-host');
|
|
27
28
|
|
|
File without changes
|
|
File without changes
|
|
@@ -10,9 +10,10 @@ import { ModelFactory, TestListModel } from '@dxos/model-factory';
|
|
|
10
10
|
import { ObjectModel } from '@dxos/object-model';
|
|
11
11
|
import { afterTest } from '@dxos/testutils';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { DataServiceHost } from './data-service-host';
|
|
14
14
|
import { Item } from './item';
|
|
15
15
|
import { ItemFilterDeleted } from './selection';
|
|
16
|
+
import { createInMemoryDatabase, createRemoteDatabaseFromDataServiceHost } from './testing';
|
|
16
17
|
|
|
17
18
|
const OBJECT_ORG = 'example:object/org';
|
|
18
19
|
const OBJECT_PERSON = 'example:object/person';
|
|
@@ -10,9 +10,11 @@ import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
|
10
10
|
import { Model, ModelConstructor, ModelFactory, validateModelClass } from '@dxos/model-factory';
|
|
11
11
|
import { ObjectModel } from '@dxos/object-model';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { DataServiceHost } from './data-service-host';
|
|
14
|
+
import { DatabaseBackend } from './database-backend';
|
|
14
15
|
import { Entity } from './entity';
|
|
15
16
|
import { Item } from './item';
|
|
17
|
+
import { ItemManager } from './item-manager';
|
|
16
18
|
import { Link } from './link';
|
|
17
19
|
import { RootFilter, Selection, createSelection } from './selection';
|
|
18
20
|
|
|
@@ -7,7 +7,7 @@ import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
|
7
7
|
import { Model, ModelMeta, StateManager } from '@dxos/model-factory';
|
|
8
8
|
import { SubscriptionGroup } from '@dxos/util';
|
|
9
9
|
|
|
10
|
-
import { ItemManager } from '
|
|
10
|
+
import { ItemManager } from './item-manager';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Base class for all ECHO entitities.
|
|
@@ -10,3 +10,8 @@ export * from './item-demuxer';
|
|
|
10
10
|
export * from './item-manager';
|
|
11
11
|
export * from './testing';
|
|
12
12
|
export * from './timeframe-clock';
|
|
13
|
+
export * from './item';
|
|
14
|
+
export * from './link';
|
|
15
|
+
export * from './entity';
|
|
16
|
+
export * from './selection';
|
|
17
|
+
export * from './database';
|
|
@@ -14,7 +14,7 @@ import { createTransform } from '@dxos/feed-store';
|
|
|
14
14
|
import { ModelFactory, TestModel } from '@dxos/model-factory';
|
|
15
15
|
import { ObjectModel } from '@dxos/object-model';
|
|
16
16
|
|
|
17
|
-
import { Item } from '
|
|
17
|
+
import { Item } from './item';
|
|
18
18
|
import { ItemDemuxer } from './item-demuxer';
|
|
19
19
|
import { ItemManager } from './item-manager';
|
|
20
20
|
|
|
@@ -11,8 +11,10 @@ import { DatabaseSnapshot, IEchoStream, ItemID, ItemSnapshot, LinkSnapshot } fro
|
|
|
11
11
|
import { createWritable } from '@dxos/feed-store';
|
|
12
12
|
import { Model, ModelFactory, ModelMessage } from '@dxos/model-factory';
|
|
13
13
|
|
|
14
|
-
import { Entity
|
|
14
|
+
import { Entity } from './entity';
|
|
15
|
+
import { Item } from './item';
|
|
15
16
|
import { ItemManager, ModelConstructionOptions } from './item-manager';
|
|
17
|
+
import { Link } from './link';
|
|
16
18
|
|
|
17
19
|
const log = debug('dxos:echo-db:item-demuxer');
|
|
18
20
|
|
|
File without changes
|
|
@@ -11,8 +11,10 @@ import { timed } from '@dxos/debug';
|
|
|
11
11
|
import { EchoEnvelope, FeedWriter, ItemID, ItemType, mapFeedWriter, ModelSnapshot } from '@dxos/echo-protocol';
|
|
12
12
|
import { Model, ModelFactory, ModelMessage, ModelType, StateManager } from '@dxos/model-factory';
|
|
13
13
|
|
|
14
|
-
import { Entity, Item, Link } from '../api';
|
|
15
14
|
import { UnknownModelError } from '../errors';
|
|
15
|
+
import { Entity } from './entity';
|
|
16
|
+
import { Item } from './item';
|
|
17
|
+
import { Link } from './link';
|
|
16
18
|
|
|
17
19
|
const log = debug('dxos:echo-db:item-manager');
|
|
18
20
|
|
|
@@ -7,10 +7,10 @@ import debug from 'debug';
|
|
|
7
7
|
import { EchoEnvelope, ItemID, ItemMutation, ItemType, FeedWriter } from '@dxos/echo-protocol';
|
|
8
8
|
import { Model, StateManager } from '@dxos/model-factory';
|
|
9
9
|
|
|
10
|
-
import { ItemManager } from '../database';
|
|
11
10
|
import { Entity } from './entity';
|
|
11
|
+
import { ItemManager } from './item-manager';
|
|
12
12
|
import type { Link } from './link';
|
|
13
|
-
import {
|
|
13
|
+
import { createItemSelection, Selection } from './selection';
|
|
14
14
|
|
|
15
15
|
const log = debug('dxos:echo-db:item');
|
|
16
16
|
|
|
@@ -7,9 +7,9 @@ import assert from 'assert';
|
|
|
7
7
|
import { ItemID, ItemType } from '@dxos/echo-protocol';
|
|
8
8
|
import { Model, StateManager } from '@dxos/model-factory';
|
|
9
9
|
|
|
10
|
-
import { ItemManager } from '../database';
|
|
11
10
|
import { Entity } from './entity';
|
|
12
11
|
import { Item } from './item';
|
|
12
|
+
import { ItemManager } from './item-manager';
|
|
13
13
|
|
|
14
14
|
export interface LinkData {
|
|
15
15
|
sourceId: ItemID
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -8,9 +8,9 @@ import { PublicKey } from '@dxos/crypto';
|
|
|
8
8
|
import { EchoEnvelope, MockFeedWriter, Timeframe } from '@dxos/echo-protocol';
|
|
9
9
|
import { ModelFactory } from '@dxos/model-factory';
|
|
10
10
|
|
|
11
|
-
import { Database } from '../api';
|
|
12
11
|
import { DataServiceHost } from './data-service-host';
|
|
13
12
|
import { DataServiceRouter } from './data-service-router';
|
|
13
|
+
import { Database } from './database';
|
|
14
14
|
import { FeedDatabaseBackend, RemoteDatabaseBackend } from './database-backend';
|
|
15
15
|
|
|
16
16
|
export const createInMemoryDatabase = async (modelFactory: ModelFactory) => {
|
|
File without changes
|
|
File without changes
|
|
@@ -23,9 +23,11 @@ import { DataParty } from './data-party';
|
|
|
23
23
|
|
|
24
24
|
describe('DataParty', () => {
|
|
25
25
|
const createParty = async (identity: IdentityCredentials, partyKey: PublicKey, hints: KeyHint[]) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const snapshotStore = new SnapshotStore(
|
|
26
|
+
|
|
27
|
+
const storage = createStorage('', StorageType.RAM);
|
|
28
|
+
const snapshotStore = new SnapshotStore(storage.directory('snapshots'));
|
|
29
|
+
const metadataStore = new MetadataStore(storage.directory('metadata'));
|
|
30
|
+
const feedStore = new FeedStore(storage.directory('feed'), { valueEncoding: codec });
|
|
29
31
|
const modelFactory = new ModelFactory().registerModel(ObjectModel);
|
|
30
32
|
const networkManager = new NetworkManager();
|
|
31
33
|
const partyFeedProvider = new PartyFeedProvider(metadataStore, identity.keyring, feedStore, partyKey);
|
|
@@ -60,7 +62,7 @@ describe('DataParty', () => {
|
|
|
60
62
|
await party.open();
|
|
61
63
|
|
|
62
64
|
const feed = await party.getWriteFeed();
|
|
63
|
-
await party.
|
|
65
|
+
await party.credentialsWriter.write(createPartyGenesisMessage(
|
|
64
66
|
keyring,
|
|
65
67
|
partyKey,
|
|
66
68
|
feed.key,
|
|
@@ -80,14 +82,14 @@ describe('DataParty', () => {
|
|
|
80
82
|
const party = await createParty(identity, partyKey.publicKey, []);
|
|
81
83
|
await party.open();
|
|
82
84
|
const feed = await party.getWriteFeed();
|
|
83
|
-
await party.
|
|
85
|
+
await party.credentialsWriter.write(createPartyGenesisMessage(
|
|
84
86
|
keyring,
|
|
85
87
|
partyKey,
|
|
86
88
|
feed.key,
|
|
87
89
|
partyKey
|
|
88
90
|
));
|
|
89
91
|
|
|
90
|
-
const authenticator = createAuthenticator(party.processor, identity.createCredentialsSigner());
|
|
92
|
+
const authenticator = createAuthenticator(party.processor, identity.createCredentialsSigner(), party.credentialsWriter);
|
|
91
93
|
const credentialsProvider = createCredentialsProvider(identity.createCredentialsSigner(), party.key, feed.key);
|
|
92
94
|
|
|
93
95
|
const wrappedCredentials = haloCodec.decode(credentialsProvider.get());
|
|
@@ -104,13 +106,13 @@ describe('DataParty', () => {
|
|
|
104
106
|
const party = await createParty(identityA, partyKey.publicKey, []);
|
|
105
107
|
await party.open();
|
|
106
108
|
const feed = await party.getWriteFeed();
|
|
107
|
-
await party.
|
|
109
|
+
await party.credentialsWriter.write(createPartyGenesisMessage(
|
|
108
110
|
keyring,
|
|
109
111
|
partyKey,
|
|
110
112
|
feed.key,
|
|
111
113
|
partyKey
|
|
112
114
|
));
|
|
113
|
-
const authenticator = createAuthenticator(party.processor, identityA.createCredentialsSigner());
|
|
115
|
+
const authenticator = createAuthenticator(party.processor, identityA.createCredentialsSigner(), party.credentialsWriter);
|
|
114
116
|
|
|
115
117
|
const identityB = await deriveTestDeviceCredentials(identityA);
|
|
116
118
|
const credentialsProvider = createCredentialsProvider(identityB.createCredentialsSigner(), party.key, feed.key);
|
|
@@ -129,13 +131,13 @@ describe('DataParty', () => {
|
|
|
129
131
|
const partyA = await createParty(identityA, partyKey.publicKey, []);
|
|
130
132
|
await partyA.open();
|
|
131
133
|
const feedA = await partyA.getWriteFeed();
|
|
132
|
-
await partyA.
|
|
134
|
+
await partyA.credentialsWriter.write(createPartyGenesisMessage(
|
|
133
135
|
keyring,
|
|
134
136
|
partyKey,
|
|
135
137
|
feedA.key,
|
|
136
138
|
partyKey
|
|
137
139
|
));
|
|
138
|
-
await partyA.
|
|
140
|
+
await partyA.credentialsWriter.write(createKeyAdmitMessage(
|
|
139
141
|
keyring,
|
|
140
142
|
partyKey.publicKey,
|
|
141
143
|
identityA.identityKey,
|
|
@@ -165,13 +167,13 @@ describe('DataParty', () => {
|
|
|
165
167
|
const partyA = await createParty(identityA, partyKeyA.publicKey, []);
|
|
166
168
|
await partyA.open();
|
|
167
169
|
const feedA = await partyA.getWriteFeed();
|
|
168
|
-
await partyA.
|
|
170
|
+
await partyA.credentialsWriter.write(createPartyGenesisMessage(
|
|
169
171
|
identityA.keyring,
|
|
170
172
|
partyKeyA,
|
|
171
173
|
feedA.key,
|
|
172
174
|
partyKeyA
|
|
173
175
|
));
|
|
174
|
-
await partyA.
|
|
176
|
+
await partyA.credentialsWriter.write(createKeyAdmitMessage(
|
|
175
177
|
identityA.keyring,
|
|
176
178
|
partyKeyA.publicKey,
|
|
177
179
|
identityA.identityKey,
|