@dxos/echo-db 2.33.8-dev.c77ba621 → 2.33.8
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.test.js +14 -14
- package/dist/src/echo.test.js.map +1 -1
- package/dist/src/halo/halo-factory.d.ts.map +1 -1
- package/dist/src/halo/halo-factory.js +2 -3
- package/dist/src/halo/halo-factory.js.map +1 -1
- package/dist/src/halo/halo.d.ts.map +1 -1
- package/dist/src/halo/halo.js +2 -1
- package/dist/src/halo/halo.js.map +1 -1
- package/dist/src/halo/halo.test.js +2 -3
- package/dist/src/halo/halo.test.js.map +1 -1
- package/dist/src/halo/types.d.ts +1 -0
- package/dist/src/halo/types.d.ts.map +1 -1
- package/dist/src/invitations/greeting-initiator.d.ts.map +1 -1
- package/dist/src/invitations/greeting-initiator.js +2 -3
- package/dist/src/invitations/greeting-initiator.js.map +1 -1
- package/dist/src/invitations/greeting-protocol-provider.js +2 -2
- package/dist/src/invitations/greeting-protocol-provider.js.map +1 -1
- package/dist/src/invitations/greeting-responder.js +3 -3
- package/dist/src/invitations/greeting-responder.js.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js +2 -2
- package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
- package/dist/src/invitations/invitation-descriptor.js +3 -3
- package/dist/src/invitations/invitation-descriptor.js.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.js +2 -2
- package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
- package/dist/src/parties/party-factory.d.ts.map +1 -1
- package/dist/src/parties/party-factory.js +3 -3
- 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/feed-muxer.d.ts.map +1 -1
- package/dist/src/pipeline/feed-muxer.js +2 -2
- package/dist/src/pipeline/feed-muxer.js.map +1 -1
- package/dist/src/protocol/identity-credentials.d.ts.map +1 -1
- package/dist/src/protocol/identity-credentials.js +2 -2
- package/dist/src/protocol/identity-credentials.js.map +1 -1
- package/dist/src/protocol/party-protocol-factory.js +1 -1
- package/dist/src/protocol/party-protocol-factory.js.map +1 -1
- package/dist/src/protocol/replicator-plugin.d.ts.map +1 -1
- package/dist/src/protocol/replicator-plugin.js +1 -2
- package/dist/src/protocol/replicator-plugin.js.map +1 -1
- package/dist/src/snapshots/snapshot-generator.js +2 -2
- package/dist/src/snapshots/snapshot-generator.js.map +1 -1
- package/dist/src/snapshots/snapshot-store.d.ts.map +1 -1
- package/dist/src/snapshots/snapshot-store.js +2 -2
- package/dist/src/snapshots/snapshot-store.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/echo.test.ts +4 -2
- package/src/halo/halo-factory.ts +2 -2
- package/src/halo/halo.test.ts +3 -2
- package/src/halo/halo.ts +3 -1
- package/src/halo/types.ts +1 -0
- package/src/invitations/greeting-initiator.ts +2 -3
- package/src/invitations/greeting-protocol-provider.ts +2 -2
- package/src/invitations/greeting-responder.ts +4 -4
- package/src/invitations/halo-recovery-initiator.ts +3 -3
- package/src/invitations/invitation-descriptor.ts +5 -5
- package/src/invitations/offline-invitation-claimer.ts +3 -3
- package/src/parties/party-factory.ts +3 -3
- package/src/parties/party-manager.test.ts +3 -2
- package/src/pipeline/feed-muxer.ts +2 -2
- package/src/protocol/identity-credentials.ts +5 -2
- package/src/protocol/party-protocol-factory.ts +2 -2
- package/src/protocol/replicator-plugin.ts +1 -2
- package/src/snapshots/snapshot-generator.ts +1 -1
- package/src/snapshots/snapshot-store.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-db",
|
|
3
|
-
"version": "2.33.8
|
|
3
|
+
"version": "2.33.8",
|
|
4
4
|
"description": "ECHO database.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dxos/async": "2.33.8
|
|
14
|
-
"@dxos/codec-protobuf": "2.33.8
|
|
15
|
-
"@dxos/credentials": "2.33.8
|
|
16
|
-
"@dxos/crypto": "2.33.8
|
|
17
|
-
"@dxos/debug": "2.33.8
|
|
18
|
-
"@dxos/echo-protocol": "2.33.8
|
|
19
|
-
"@dxos/feed-store": "2.33.8
|
|
20
|
-
"@dxos/mesh-protocol": "2.33.8
|
|
21
|
-
"@dxos/model-factory": "2.33.8
|
|
22
|
-
"@dxos/network-manager": "2.33.8
|
|
23
|
-
"@dxos/object-model": "2.33.8
|
|
24
|
-
"@dxos/protocol-plugin-presence": "2.33.8
|
|
25
|
-
"@dxos/protocol-plugin-replicator": "2.33.8
|
|
26
|
-
"@dxos/protocols": "2.33.8
|
|
27
|
-
"@dxos/random-access-multi-storage": "2.33.8
|
|
28
|
-
"@dxos/util": "2.33.8
|
|
13
|
+
"@dxos/async": "2.33.8",
|
|
14
|
+
"@dxos/codec-protobuf": "2.33.8",
|
|
15
|
+
"@dxos/credentials": "2.33.8",
|
|
16
|
+
"@dxos/crypto": "2.33.8",
|
|
17
|
+
"@dxos/debug": "2.33.8",
|
|
18
|
+
"@dxos/echo-protocol": "2.33.8",
|
|
19
|
+
"@dxos/feed-store": "2.33.8",
|
|
20
|
+
"@dxos/mesh-protocol": "2.33.8",
|
|
21
|
+
"@dxos/model-factory": "2.33.8",
|
|
22
|
+
"@dxos/network-manager": "2.33.8",
|
|
23
|
+
"@dxos/object-model": "2.33.8",
|
|
24
|
+
"@dxos/protocol-plugin-presence": "2.33.8",
|
|
25
|
+
"@dxos/protocol-plugin-replicator": "2.33.8",
|
|
26
|
+
"@dxos/protocols": "2.33.8",
|
|
27
|
+
"@dxos/random-access-multi-storage": "2.33.8",
|
|
28
|
+
"@dxos/util": "2.33.8",
|
|
29
29
|
"base-x": "~3.0.9",
|
|
30
30
|
"buffer-json-encoding": "^1.0.2",
|
|
31
31
|
"debug": "^4.3.3",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"pify": "~5.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@dxos/browser-mocha": "2.33.
|
|
38
|
+
"@dxos/browser-mocha": "2.33.8",
|
|
39
39
|
"@dxos/eslint-plugin": "~1.0.34",
|
|
40
|
-
"@dxos/protocols-toolchain": "2.33.
|
|
41
|
-
"@dxos/testutils": "2.33.
|
|
40
|
+
"@dxos/protocols-toolchain": "2.33.8",
|
|
41
|
+
"@dxos/testutils": "2.33.8",
|
|
42
42
|
"@types/columnify": "^1.5.1",
|
|
43
43
|
"@types/debug": "^4.1.7",
|
|
44
44
|
"@types/faker": "^5.5.1",
|
package/src/echo.test.ts
CHANGED
|
@@ -8,10 +8,12 @@ import expect from 'expect';
|
|
|
8
8
|
import { it as test } from 'mocha';
|
|
9
9
|
|
|
10
10
|
import { latch, promiseTimeout, waitForCondition } from '@dxos/async';
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
defaultSecretProvider, defaultSecretValidator, generateSeedPhrase, keyPairFromSeedPhrase
|
|
13
|
+
} from '@dxos/credentials';
|
|
13
14
|
import { ObjectModel } from '@dxos/object-model';
|
|
14
15
|
import { afterTest } from '@dxos/testutils';
|
|
16
|
+
import { humanize } from '@dxos/util';
|
|
15
17
|
|
|
16
18
|
import { ECHO } from './echo';
|
|
17
19
|
import { Contact } from './halo';
|
package/src/halo/halo-factory.ts
CHANGED
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
createIdentityInfoMessage,
|
|
11
11
|
createKeyAdmitMessage,
|
|
12
12
|
createPartyGenesisMessage,
|
|
13
|
+
keyPairFromSeedPhrase,
|
|
13
14
|
Keyring,
|
|
14
15
|
KeyType,
|
|
15
16
|
Filter,
|
|
16
17
|
SecretProvider
|
|
17
18
|
} from '@dxos/credentials';
|
|
18
|
-
import { keyToString, keyPairFromSeedPhrase } from '@dxos/crypto';
|
|
19
19
|
import { ModelFactory } from '@dxos/model-factory';
|
|
20
20
|
import { NetworkManager } from '@dxos/network-manager';
|
|
21
21
|
import { ObjectModel } from '@dxos/object-model';
|
|
@@ -151,7 +151,7 @@ export class HaloFactory {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
private async _joinHalo (invitationDescriptor: InvitationDescriptor, secretProvider: SecretProvider) {
|
|
154
|
-
log(`Admitting device with invitation: ${
|
|
154
|
+
log(`Admitting device with invitation: ${PublicKey.stringify(invitationDescriptor.invitation)}`);
|
|
155
155
|
assert(invitationDescriptor.identityKey);
|
|
156
156
|
|
|
157
157
|
let identityKey = this._keyring.findKey(Keyring.signingFilter({ type: KeyType.IDENTITY }));
|
package/src/halo/halo.test.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
defaultSecretProvider, generateSeedPhrase, keyPairFromSeedPhrase, Keyring
|
|
10
|
+
} from '@dxos/credentials';
|
|
10
11
|
import { codec } from '@dxos/echo-protocol';
|
|
11
12
|
import { FeedStore } from '@dxos/feed-store';
|
|
12
13
|
import { ModelFactory } from '@dxos/model-factory';
|
package/src/halo/halo.ts
CHANGED
|
@@ -7,11 +7,12 @@ import debug from 'debug';
|
|
|
7
7
|
|
|
8
8
|
import { synchronized } from '@dxos/async';
|
|
9
9
|
import { KeyRecord, Keyring, KeyType, SecretProvider } from '@dxos/credentials';
|
|
10
|
-
import { createKeyPair,
|
|
10
|
+
import { createKeyPair, KeyPair } from '@dxos/crypto';
|
|
11
11
|
import { raise } from '@dxos/debug';
|
|
12
12
|
import { ModelFactory } from '@dxos/model-factory';
|
|
13
13
|
import { NetworkManager } from '@dxos/network-manager';
|
|
14
14
|
import { PublicKey } from '@dxos/protocols';
|
|
15
|
+
import { humanize } from '@dxos/util';
|
|
15
16
|
|
|
16
17
|
import { ResultSet } from '../api';
|
|
17
18
|
import { InvitationAuthenticator, InvitationDescriptor, InvitationOptions } from '../invitations';
|
|
@@ -225,6 +226,7 @@ export class HALO {
|
|
|
225
226
|
*/
|
|
226
227
|
async createInvitation (authenticationDetails: InvitationAuthenticator, options?: InvitationOptions) {
|
|
227
228
|
assert(this.identity?.halo, 'HALO not initialized.');
|
|
229
|
+
|
|
228
230
|
return this.identity.halo.createInvitation(authenticationDetails, options);
|
|
229
231
|
}
|
|
230
232
|
|
package/src/halo/types.ts
CHANGED
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
SignedMessage,
|
|
24
24
|
NotarizeResponse
|
|
25
25
|
} from '@dxos/credentials';
|
|
26
|
-
import { keyToString } from '@dxos/crypto';
|
|
27
26
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
28
27
|
import { PublicKey } from '@dxos/protocols';
|
|
29
28
|
|
|
@@ -88,10 +87,10 @@ export class GreetingInitiator {
|
|
|
88
87
|
// Therefore at present the greeter discovers the invitation id from session metadata, via the invitee's peer id.
|
|
89
88
|
// TODO(dboreham): Invitation is actually invitationID.
|
|
90
89
|
const localPeerId = invitation;
|
|
91
|
-
log('Local PeerId:',
|
|
90
|
+
log('Local PeerId:', PublicKey.stringify(localPeerId));
|
|
92
91
|
this._greeterPlugin = new GreetingCommandPlugin(Buffer.from(localPeerId), new Greeter().createMessageHandler());
|
|
93
92
|
|
|
94
|
-
log(
|
|
93
|
+
log(PublicKey.stringify(localPeerId), 'connecting to', PublicKey.stringify(swarmKey));
|
|
95
94
|
|
|
96
95
|
const peerJoinedWaiter = waitForEvent(this._greeterPlugin, 'peer:joined',
|
|
97
96
|
(remotePeerId: any) => remotePeerId && Buffer.from(responderPeerId).equals(remotePeerId),
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { keyToString } from '@dxos/crypto';
|
|
6
5
|
import { protocolFactory } from '@dxos/network-manager';
|
|
6
|
+
import { PublicKey } from '@dxos/protocols';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a duplex connection with a single peer using a common rendezvous key as topic.
|
|
@@ -16,6 +16,6 @@ import { protocolFactory } from '@dxos/network-manager';
|
|
|
16
16
|
// TODO(dboreham): Write a test to check resources are released (no resource leaks).
|
|
17
17
|
export const greetingProtocolProvider = (rendezvousKey: any, peerId: Buffer | Uint8Array, protocolPlugins: any[]) => protocolFactory({
|
|
18
18
|
getTopics: () => [rendezvousKey],
|
|
19
|
-
session: { peerId:
|
|
19
|
+
session: { peerId: PublicKey.stringify(peerId) },
|
|
20
20
|
plugins: protocolPlugins
|
|
21
21
|
});
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
SecretValidator
|
|
17
17
|
, Message as HaloMessage
|
|
18
18
|
} from '@dxos/credentials';
|
|
19
|
-
import {
|
|
19
|
+
import { randomBytes } from '@dxos/crypto';
|
|
20
20
|
import { FeedWriter, SwarmKey } from '@dxos/echo-protocol';
|
|
21
21
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
22
22
|
import { PublicKey } from '@dxos/protocols';
|
|
@@ -130,11 +130,11 @@ export class GreetingResponder {
|
|
|
130
130
|
// TODO(dboreham): Add tests for idempotence and transactional integrity over the greet flow.
|
|
131
131
|
(this._greeterPlugin as any).once('peer:joined', (joinedPeerId: Buffer) => {
|
|
132
132
|
if (joinedPeerId.equals(invitation.id)) {
|
|
133
|
-
log(`Initiator connected: ${
|
|
133
|
+
log(`Initiator connected: ${PublicKey.stringify(joinedPeerId)}`);
|
|
134
134
|
this._state = GreetingState.CONNECTED;
|
|
135
135
|
this.connected.emit(invitation.id);
|
|
136
136
|
} else {
|
|
137
|
-
log(`Unexpected initiator connected: ${
|
|
137
|
+
log(`Unexpected initiator connected: ${PublicKey.stringify(joinedPeerId)}`);
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
|
|
@@ -158,7 +158,7 @@ export class GreetingResponder {
|
|
|
158
158
|
label: 'Greeting responder'
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
log(`Greeting for: ${this._partyProcessor.partyKey.toHex()} on swarmKey ${
|
|
161
|
+
log(`Greeting for: ${this._partyProcessor.partyKey.toHex()} on swarmKey ${PublicKey.stringify(this._swarmKey)}`);
|
|
162
162
|
|
|
163
163
|
this._state = GreetingState.LISTENING;
|
|
164
164
|
log('Listening');
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
SignedMessage,
|
|
20
20
|
codec
|
|
21
21
|
} from '@dxos/credentials';
|
|
22
|
-
import {
|
|
22
|
+
import { randomBytes, verify } from '@dxos/crypto';
|
|
23
23
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
24
24
|
import { PublicKey } from '@dxos/protocols';
|
|
25
25
|
|
|
@@ -66,7 +66,7 @@ export class HaloRecoveryInitiator {
|
|
|
66
66
|
|
|
67
67
|
// This is a temporary connection, there is no need to any special or permanent ID.
|
|
68
68
|
this._peerId = randomBytes();
|
|
69
|
-
log('Local PeerId:',
|
|
69
|
+
log('Local PeerId:', PublicKey.stringify(this._peerId));
|
|
70
70
|
|
|
71
71
|
const swarmKey = this._credentialsSigner.getIdentityKey().publicKey.asBuffer();
|
|
72
72
|
|
|
@@ -102,7 +102,7 @@ export class HaloRecoveryInitiator {
|
|
|
102
102
|
|
|
103
103
|
// Send to the first peer (any peer will do).
|
|
104
104
|
const peer = this._greeterPlugin.peers[0];
|
|
105
|
-
const responderPeerId =
|
|
105
|
+
const responderPeerId = PublicKey.bufferize(peer.getSession().peerId);
|
|
106
106
|
|
|
107
107
|
// Synthesize an "invitationID" which is the signature of both peerIds signed by our Identity key.
|
|
108
108
|
const signature = this._credentialsSigner.signer.rawSign(
|
|
@@ -6,7 +6,7 @@ import assert from 'assert';
|
|
|
6
6
|
import base from 'base-x';
|
|
7
7
|
import stableStringify from 'json-stable-stringify';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { ripemd160 } from '@dxos/crypto';
|
|
10
10
|
import { SwarmKey } from '@dxos/echo-protocol';
|
|
11
11
|
import * as proto from '@dxos/echo-protocol';
|
|
12
12
|
import { PublicKey } from '@dxos/protocols';
|
|
@@ -46,8 +46,8 @@ export class InvitationDescriptor {
|
|
|
46
46
|
static fromQueryParameters (queryParameters: InvitationQueryParameters): InvitationDescriptor {
|
|
47
47
|
const { hash, swarmKey, invitation, identityKey, type } = queryParameters;
|
|
48
48
|
|
|
49
|
-
const descriptor = new InvitationDescriptor(parseInvitationType(type),
|
|
50
|
-
|
|
49
|
+
const descriptor = new InvitationDescriptor(parseInvitationType(type), PublicKey.bufferize(swarmKey),
|
|
50
|
+
PublicKey.bufferize(invitation), identityKey ? PublicKey.from(identityKey) : undefined);
|
|
51
51
|
|
|
52
52
|
if (hash !== descriptor.hash) {
|
|
53
53
|
throw new InvalidInvitationError();
|
|
@@ -104,8 +104,8 @@ export class InvitationDescriptor {
|
|
|
104
104
|
*/
|
|
105
105
|
toQueryParameters (): InvitationQueryParameters {
|
|
106
106
|
const query: Partial<InvitationQueryParameters> = {
|
|
107
|
-
swarmKey:
|
|
108
|
-
invitation:
|
|
107
|
+
swarmKey: PublicKey.stringify(this.swarmKey),
|
|
108
|
+
invitation: PublicKey.stringify(this.invitation),
|
|
109
109
|
type: stringifyInvitationType(this.type)
|
|
110
110
|
};
|
|
111
111
|
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
SignedMessage,
|
|
21
21
|
codec
|
|
22
22
|
} from '@dxos/credentials';
|
|
23
|
-
import {
|
|
23
|
+
import { randomBytes } from '@dxos/crypto';
|
|
24
24
|
import { FullyConnectedTopology, NetworkManager } from '@dxos/network-manager';
|
|
25
25
|
import { PublicKey } from '@dxos/protocols';
|
|
26
26
|
|
|
@@ -66,7 +66,7 @@ export class OfflineInvitationClaimer {
|
|
|
66
66
|
|
|
67
67
|
// This is a temporary connection, there is no need to any special or permanent ID.
|
|
68
68
|
const localPeerId = randomBytes();
|
|
69
|
-
log('Local PeerId:',
|
|
69
|
+
log('Local PeerId:', PublicKey.stringify(localPeerId));
|
|
70
70
|
|
|
71
71
|
this._greeterPlugin = new GreetingCommandPlugin(localPeerId, async () => false);
|
|
72
72
|
|
|
@@ -100,7 +100,7 @@ export class OfflineInvitationClaimer {
|
|
|
100
100
|
const { invitation: invitationID } = this._invitationDescriptor;
|
|
101
101
|
|
|
102
102
|
// Send to the first peer (any peer will do).
|
|
103
|
-
const responderPeerId =
|
|
103
|
+
const responderPeerId = PublicKey.bufferize(this._greeterPlugin.peers[0].getSession().peerId);
|
|
104
104
|
|
|
105
105
|
// We expect to receive a new swarm/rendezvousKey to use for the full Greeting process.
|
|
106
106
|
const claimResponse = await this._greeterPlugin.send(
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
SecretProvider,
|
|
14
14
|
wrapMessage
|
|
15
15
|
} from '@dxos/credentials';
|
|
16
|
-
import { humanize, keyToString } from '@dxos/crypto';
|
|
17
16
|
import { failUndefined, raise, timed } from '@dxos/debug';
|
|
18
17
|
import { createFeedWriter, FeedMessage, PartyKey, PartySnapshot, Timeframe } from '@dxos/echo-protocol';
|
|
19
18
|
import { ModelFactory } from '@dxos/model-factory';
|
|
20
19
|
import { NetworkManager } from '@dxos/network-manager';
|
|
21
20
|
import { ObjectModel } from '@dxos/object-model';
|
|
22
21
|
import { PublicKey } from '@dxos/protocols';
|
|
22
|
+
import { humanize } from '@dxos/util';
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
25
|
createDataPartyAdmissionMessages,
|
|
@@ -154,8 +154,8 @@ export class PartyFactory {
|
|
|
154
154
|
const invitationClaimer = new OfflineInvitationClaimer(this._networkManager, invitationDescriptor);
|
|
155
155
|
await invitationClaimer.connect();
|
|
156
156
|
invitationDescriptor = await invitationClaimer.claim();
|
|
157
|
-
log(`Party invitation ${
|
|
158
|
-
`at ${
|
|
157
|
+
log(`Party invitation ${PublicKey.stringify(originalInvitation.invitation)} triggered interactive Greeting`,
|
|
158
|
+
`at ${PublicKey.stringify(invitationDescriptor.invitation)}`);
|
|
159
159
|
await invitationClaimer.destroy();
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
} from '@dxos/credentials';
|
|
20
20
|
import {
|
|
21
21
|
createKeyPair,
|
|
22
|
-
humanize,
|
|
23
22
|
randomBytes,
|
|
24
23
|
sign,
|
|
25
|
-
SIGNATURE_LENGTH,
|
|
24
|
+
SIGNATURE_LENGTH,
|
|
25
|
+
verify
|
|
26
26
|
} from '@dxos/crypto';
|
|
27
27
|
import { checkType } from '@dxos/debug';
|
|
28
28
|
import { codec, EchoEnvelope, Timeframe } from '@dxos/echo-protocol';
|
|
@@ -33,6 +33,7 @@ import { ObjectModel } from '@dxos/object-model';
|
|
|
33
33
|
import { PublicKey } from '@dxos/protocols';
|
|
34
34
|
import { createStorage, StorageType } from '@dxos/random-access-multi-storage';
|
|
35
35
|
import { afterTest, testTimeout } from '@dxos/testutils';
|
|
36
|
+
import { humanize } from '@dxos/util';
|
|
36
37
|
|
|
37
38
|
import { defaultInvitationAuthenticator, OfflineInvitationClaimer } from '../invitations';
|
|
38
39
|
import { Item } from '../packlets/database';
|
|
@@ -7,7 +7,6 @@ import debug from 'debug';
|
|
|
7
7
|
|
|
8
8
|
import { Event } from '@dxos/async';
|
|
9
9
|
import { Message as HaloMessage } from '@dxos/credentials';
|
|
10
|
-
import { keyToString } from '@dxos/crypto';
|
|
11
10
|
import { checkType } from '@dxos/debug';
|
|
12
11
|
import {
|
|
13
12
|
createFeedMeta, EchoEnvelope, FeedMessage, FeedStoreIterator, FeedWriter, IEchoStream, mapFeedWriter, Timeframe
|
|
@@ -139,7 +138,8 @@ export class FeedMuxer {
|
|
|
139
138
|
|
|
140
139
|
if (message.echo) {
|
|
141
140
|
const memberKey = this._partyProcessor.getFeedOwningMember(PublicKey.from(block.key));
|
|
142
|
-
|
|
141
|
+
// TODO(wittjosiah): Is actually a Buffer for some reason. See todo in IFeedGenericBlock.
|
|
142
|
+
assert(memberKey, `Ownership of feed ${PublicKey.stringify(block.key as unknown as Buffer)} could not be determined.`);
|
|
143
143
|
|
|
144
144
|
// Validate messge.
|
|
145
145
|
const { itemId } = message.echo;
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
createIdentityInfoMessage, createKeyAdmitMessage, createPartyGenesisMessage,
|
|
7
|
+
KeyChain, KeyRecord, Keyring, KeyType, SignedMessage
|
|
8
|
+
} from '@dxos/credentials';
|
|
9
|
+
import { humanize } from '@dxos/util';
|
|
7
10
|
|
|
8
11
|
import { ContactManager, Preferences } from '../halo';
|
|
9
12
|
import { CredentialsSigner } from './credentials-signer';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
|
|
7
|
-
import { discoveryKey
|
|
7
|
+
import { discoveryKey } from '@dxos/crypto';
|
|
8
8
|
import { PartyKey } from '@dxos/echo-protocol';
|
|
9
9
|
import { Protocol } from '@dxos/mesh-protocol';
|
|
10
10
|
import { MMSTTopology, NetworkManager, Plugin } from '@dxos/network-manager';
|
|
@@ -93,7 +93,7 @@ export class PartyProtocolFactory {
|
|
|
93
93
|
|
|
94
94
|
userSession: {
|
|
95
95
|
// TODO(burdon): See deprecated `protocolFactory` in HALO.
|
|
96
|
-
peerId:
|
|
96
|
+
peerId: this._peerId.toHex(),
|
|
97
97
|
// TODO(telackey): This ought to be the CredentialsProvider itself, so that fresh credentials can be minted.
|
|
98
98
|
credentials: this._credentials.get().toString('base64')
|
|
99
99
|
},
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
|
|
7
|
-
import { keyToString } from '@dxos/crypto';
|
|
8
7
|
import { Replicator } from '@dxos/protocol-plugin-replicator';
|
|
9
8
|
|
|
10
9
|
import { PartyFeedProvider } from '../pipeline';
|
|
@@ -18,7 +17,7 @@ export const createReplicatorPlugin = (feedProvider: PartyFeedProvider) =>
|
|
|
18
17
|
new Replicator({
|
|
19
18
|
load: async () => {
|
|
20
19
|
const feeds = feedProvider.getFeeds();
|
|
21
|
-
log(`Loading feeds: ${feeds.map(feed =>
|
|
20
|
+
log(`Loading feeds: ${feeds.map(feed => feed.key.toHex())}`);
|
|
22
21
|
return feeds.map((feed) => ({ discoveryKey: feed.feed.discoveryKey }));
|
|
23
22
|
},
|
|
24
23
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
|
-
import { keyToString } from '@dxos/crypto';
|
|
9
8
|
import { schema, PartyKey, PartySnapshot } from '@dxos/echo-protocol';
|
|
9
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
10
|
import { Directory } from '@dxos/random-access-multi-storage';
|
|
11
11
|
|
|
12
12
|
const log = debug('dxos:snapshot-store');
|
|
@@ -44,7 +44,7 @@ export class SnapshotStore {
|
|
|
44
44
|
|
|
45
45
|
async save (snapshot: PartySnapshot) {
|
|
46
46
|
assert(snapshot.partyKey);
|
|
47
|
-
const file = this._directory.createOrOpen(
|
|
47
|
+
const file = this._directory.createOrOpen(PublicKey.stringify(snapshot.partyKey), { truncate: true, size: 0 });
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
50
|
const data = schema.getCodecForType('dxos.echo.snapshot.PartySnapshot').encode(snapshot);
|