@dxos/echo-db 2.33.9-dev.d70ac9ee → 2.33.9-dev.d7113edd
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/result-set.js +4 -4
- package/dist/src/api/result-set.js.map +1 -1
- package/dist/src/echo.js +2 -2
- package/dist/src/echo.js.map +1 -1
- package/dist/src/echo.test.js +3 -3
- package/dist/src/echo.test.js.map +1 -1
- package/dist/src/halo/halo-factory.js +8 -8
- package/dist/src/halo/halo-factory.js.map +1 -1
- package/dist/src/halo/halo-party.js +3 -3
- package/dist/src/halo/halo-party.js.map +1 -1
- package/dist/src/halo/halo.js +9 -9
- package/dist/src/halo/halo.js.map +1 -1
- package/dist/src/halo/identity-manager.js +6 -6
- package/dist/src/halo/identity-manager.js.map +1 -1
- package/dist/src/halo/identity.js +2 -2
- package/dist/src/halo/identity.js.map +1 -1
- package/dist/src/halo/preferences.js +6 -6
- package/dist/src/halo/preferences.js.map +1 -1
- package/dist/src/invitations/greeting-initiator.js +6 -6
- package/dist/src/invitations/greeting-initiator.js.map +1 -1
- package/dist/src/invitations/greeting-responder.js +5 -5
- package/dist/src/invitations/greeting-responder.js.map +1 -1
- package/dist/src/invitations/halo-recovery-initiator.js +6 -6
- package/dist/src/invitations/halo-recovery-initiator.js.map +1 -1
- package/dist/src/invitations/invitation-descriptor.js +9 -9
- package/dist/src/invitations/invitation-descriptor.js.map +1 -1
- package/dist/src/invitations/invitation-factory.js +3 -3
- package/dist/src/invitations/invitation-factory.js.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.js +7 -7
- package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
- package/dist/src/packlets/database/data-mirror.js +8 -8
- package/dist/src/packlets/database/data-mirror.js.map +1 -1
- package/dist/src/packlets/database/data-service-host.js +3 -3
- package/dist/src/packlets/database/data-service-host.js.map +1 -1
- package/dist/src/packlets/database/data-service-router.js +5 -5
- package/dist/src/packlets/database/data-service-router.js.map +1 -1
- package/dist/src/packlets/database/database-backend.js +3 -3
- package/dist/src/packlets/database/database-backend.js.map +1 -1
- package/dist/src/packlets/database/database.js +2 -2
- package/dist/src/packlets/database/database.js.map +1 -1
- package/dist/src/packlets/database/item-demuxer.js +14 -14
- package/dist/src/packlets/database/item-demuxer.js.map +1 -1
- package/dist/src/packlets/database/item-manager.js +18 -18
- package/dist/src/packlets/database/item-manager.js.map +1 -1
- package/dist/src/packlets/database/link.js +3 -3
- package/dist/src/packlets/database/link.js.map +1 -1
- package/dist/src/packlets/database/selection/result.js +2 -2
- package/dist/src/packlets/database/selection/result.js.map +1 -1
- package/dist/src/parties/data-party.js +11 -11
- package/dist/src/parties/data-party.js.map +1 -1
- package/dist/src/parties/party-factory.js +4 -4
- package/dist/src/parties/party-factory.js.map +1 -1
- package/dist/src/parties/party-manager.js +6 -6
- package/dist/src/parties/party-manager.js.map +1 -1
- package/dist/src/parties/party-manager.test.js +6 -6
- package/dist/src/parties/party-manager.test.js.map +1 -1
- package/dist/src/parties/party-preferences.js +2 -2
- package/dist/src/parties/party-preferences.js.map +1 -1
- package/dist/src/pipeline/feed-muxer.js +3 -3
- package/dist/src/pipeline/feed-muxer.js.map +1 -1
- package/dist/src/pipeline/message-selector.js +2 -2
- package/dist/src/pipeline/message-selector.js.map +1 -1
- package/dist/src/pipeline/metadata-store.d.ts.map +1 -1
- package/dist/src/pipeline/metadata-store.js +35 -32
- package/dist/src/pipeline/metadata-store.js.map +1 -1
- package/dist/src/pipeline/party-feed-provider.js +3 -3
- package/dist/src/pipeline/party-feed-provider.js.map +1 -1
- package/dist/src/pipeline/party-pipeline.js +13 -13
- package/dist/src/pipeline/party-pipeline.js.map +1 -1
- package/dist/src/pipeline/party-processor.js +3 -3
- package/dist/src/pipeline/party-processor.js.map +1 -1
- package/dist/src/protocol/authenticator.test.js +53 -12
- package/dist/src/protocol/authenticator.test.js.map +1 -1
- package/dist/src/snapshots/snapshot-store.js +2 -2
- package/dist/src/snapshots/snapshot-store.js.map +1 -1
- package/dist/src/testing/testing-factories.js +2 -2
- package/dist/src/testing/testing-factories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -17
- package/src/api/result-set.ts +1 -1
- package/src/echo.test.ts +2 -2
- package/src/echo.ts +1 -1
- package/src/halo/halo-factory.ts +1 -1
- package/src/halo/halo-party.ts +1 -1
- package/src/halo/halo.ts +1 -1
- package/src/halo/identity-manager.ts +1 -1
- package/src/halo/identity.ts +1 -1
- package/src/halo/preferences.ts +1 -1
- package/src/invitations/greeting-initiator.ts +1 -1
- package/src/invitations/greeting-responder.ts +1 -1
- package/src/invitations/halo-recovery-initiator.ts +1 -1
- package/src/invitations/invitation-descriptor.ts +1 -1
- package/src/invitations/invitation-factory.ts +1 -1
- package/src/invitations/offline-invitation-claimer.ts +1 -1
- package/src/packlets/database/data-mirror.ts +1 -1
- package/src/packlets/database/data-service-host.ts +1 -1
- package/src/packlets/database/data-service-router.ts +1 -1
- package/src/packlets/database/database-backend.ts +1 -1
- package/src/packlets/database/database.ts +1 -1
- package/src/packlets/database/item-demuxer.ts +1 -1
- package/src/packlets/database/item-manager.ts +1 -1
- package/src/packlets/database/link.ts +1 -1
- package/src/packlets/database/selection/result.ts +1 -1
- package/src/parties/data-party.ts +1 -1
- package/src/parties/party-factory.ts +1 -1
- package/src/parties/party-manager.test.ts +1 -1
- package/src/parties/party-manager.ts +1 -1
- package/src/parties/party-preferences.ts +1 -1
- package/src/pipeline/feed-muxer.ts +1 -1
- package/src/pipeline/message-selector.ts +1 -1
- package/src/pipeline/metadata-store.ts +38 -29
- package/src/pipeline/party-feed-provider.ts +1 -1
- package/src/pipeline/party-pipeline.ts +1 -1
- package/src/pipeline/party-processor.ts +1 -1
- package/src/protocol/authenticator.test.ts +102 -17
- package/src/snapshots/snapshot-store.ts +1 -1
- package/src/testing/testing-factories.ts +1 -1
|
@@ -5,21 +5,18 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import { it as test } from 'mocha';
|
|
7
7
|
|
|
8
|
-
import { createAuthMessage, createKeyAdmitMessage, createPartyGenesisMessage, Keyring, KeyType } from '@dxos/credentials';
|
|
8
|
+
import { createAuthMessage, createEnvelopeMessage, createFeedAdmitMessage, createKeyAdmitMessage, createPartyGenesisMessage, Keyring, KeyType, wrapMessage } from '@dxos/credentials';
|
|
9
9
|
|
|
10
10
|
import { PartyProcessor } from '../pipeline';
|
|
11
11
|
import { createAuthenticator } from './authenticator';
|
|
12
|
-
import {
|
|
12
|
+
import { createTestIdentityCredentials } from './identity-credentials';
|
|
13
13
|
|
|
14
14
|
describe('authenticator', () => {
|
|
15
|
-
|
|
16
|
-
test.skip('authenticates admitted peer', async () => {
|
|
15
|
+
test('authenticates party creator', async () => {
|
|
17
16
|
const keyring = new Keyring();
|
|
17
|
+
const identity = await createTestIdentityCredentials(keyring);
|
|
18
18
|
const partyKey = await keyring.createKeyRecord({ type: KeyType.PARTY });
|
|
19
|
-
const
|
|
20
|
-
const deviceKey = await keyring.createKeyRecord({ type: KeyType.DEVICE });
|
|
21
|
-
const feedKey = await keyring.createKeyRecord({ type: KeyType.FEED });
|
|
22
|
-
const signer = CredentialsSigner.createDirectDeviceSigner(keyring);
|
|
19
|
+
const feedKey = await keyring.createKeyRecord({ type: KeyType.PARTY });
|
|
23
20
|
|
|
24
21
|
const partyProcessor = new PartyProcessor(partyKey.publicKey);
|
|
25
22
|
await partyProcessor.processMessage({
|
|
@@ -27,16 +24,106 @@ describe('authenticator', () => {
|
|
|
27
24
|
keyring,
|
|
28
25
|
partyKey,
|
|
29
26
|
feedKey.publicKey,
|
|
30
|
-
|
|
27
|
+
partyKey
|
|
31
28
|
),
|
|
32
29
|
meta: {} as any
|
|
33
30
|
});
|
|
31
|
+
await partyProcessor.processMessage({
|
|
32
|
+
data: createEnvelopeMessage(
|
|
33
|
+
identity.keyring,
|
|
34
|
+
partyKey.publicKey,
|
|
35
|
+
wrapMessage(identity.identityGenesis),
|
|
36
|
+
[partyKey]
|
|
37
|
+
),
|
|
38
|
+
meta: {} as any
|
|
39
|
+
});
|
|
40
|
+
await partyProcessor.processMessage({
|
|
41
|
+
data: createFeedAdmitMessage(
|
|
42
|
+
keyring,
|
|
43
|
+
partyKey.publicKey,
|
|
44
|
+
feedKey.publicKey,
|
|
45
|
+
[identity.deviceKeyChain]
|
|
46
|
+
),
|
|
47
|
+
meta: {} as any
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const authenticator = createAuthenticator(partyProcessor, identity.createCredentialsSigner(), null as any);
|
|
51
|
+
|
|
52
|
+
//
|
|
53
|
+
// This test follows the same party creation routing as party factory.
|
|
54
|
+
// Oddly, it does not admit the device key to the party.
|
|
55
|
+
// This means that authentication is actually done using the signature created using the feed key.
|
|
56
|
+
//
|
|
57
|
+
|
|
58
|
+
// Does not authenticate without the feed key.
|
|
59
|
+
{
|
|
60
|
+
const credential = createAuthMessage(
|
|
61
|
+
keyring,
|
|
62
|
+
partyKey.publicKey,
|
|
63
|
+
identity.identityKey,
|
|
64
|
+
identity.deviceKey
|
|
65
|
+
);
|
|
66
|
+
expect(await authenticator.authenticate(credential.payload)).toEqual(false);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Does authenticate with the feed key.
|
|
70
|
+
{
|
|
71
|
+
const credential = createAuthMessage(
|
|
72
|
+
keyring,
|
|
73
|
+
partyKey.publicKey,
|
|
74
|
+
identity.identityKey,
|
|
75
|
+
identity.deviceKey,
|
|
76
|
+
feedKey.publicKey
|
|
77
|
+
);
|
|
78
|
+
expect(await authenticator.authenticate(credential.payload)).toEqual(true);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('authenticates another identity', async () => {
|
|
83
|
+
const keyring = new Keyring();
|
|
84
|
+
const identity = await createTestIdentityCredentials(keyring);
|
|
85
|
+
const partyKey = await keyring.createKeyRecord({ type: KeyType.PARTY });
|
|
86
|
+
const feedKey = await keyring.createKeyRecord({ type: KeyType.PARTY });
|
|
87
|
+
|
|
88
|
+
const partyProcessor = new PartyProcessor(partyKey.publicKey);
|
|
89
|
+
await partyProcessor.processMessage({
|
|
90
|
+
data: createPartyGenesisMessage(
|
|
91
|
+
keyring,
|
|
92
|
+
partyKey,
|
|
93
|
+
feedKey.publicKey,
|
|
94
|
+
partyKey
|
|
95
|
+
),
|
|
96
|
+
meta: {} as any
|
|
97
|
+
});
|
|
98
|
+
await partyProcessor.processMessage({
|
|
99
|
+
data: createEnvelopeMessage(
|
|
100
|
+
identity.keyring,
|
|
101
|
+
partyKey.publicKey,
|
|
102
|
+
wrapMessage(identity.identityGenesis),
|
|
103
|
+
[partyKey]
|
|
104
|
+
),
|
|
105
|
+
meta: {} as any
|
|
106
|
+
});
|
|
107
|
+
await partyProcessor.processMessage({
|
|
108
|
+
data: createFeedAdmitMessage(
|
|
109
|
+
keyring,
|
|
110
|
+
partyKey.publicKey,
|
|
111
|
+
feedKey.publicKey,
|
|
112
|
+
[identity.deviceKeyChain]
|
|
113
|
+
),
|
|
114
|
+
meta: {} as any
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const authenticator = createAuthenticator(partyProcessor, identity.createCredentialsSigner(), null as any);
|
|
118
|
+
|
|
119
|
+
const identity2 = await createTestIdentityCredentials(keyring);
|
|
120
|
+
|
|
34
121
|
await partyProcessor.processMessage({
|
|
35
122
|
data: createKeyAdmitMessage(
|
|
36
123
|
keyring,
|
|
37
124
|
partyKey.publicKey,
|
|
38
|
-
identityKey,
|
|
39
|
-
[
|
|
125
|
+
identity2.identityKey,
|
|
126
|
+
[identity.deviceKeyChain]
|
|
40
127
|
),
|
|
41
128
|
meta: {} as any
|
|
42
129
|
});
|
|
@@ -44,20 +131,18 @@ describe('authenticator', () => {
|
|
|
44
131
|
data: createKeyAdmitMessage(
|
|
45
132
|
keyring,
|
|
46
133
|
partyKey.publicKey,
|
|
47
|
-
deviceKey,
|
|
48
|
-
[
|
|
134
|
+
identity2.deviceKey,
|
|
135
|
+
[identity.deviceKeyChain]
|
|
49
136
|
),
|
|
50
137
|
meta: {} as any
|
|
51
138
|
});
|
|
52
139
|
|
|
53
|
-
const authenticator = createAuthenticator(partyProcessor, signer, null as any);
|
|
54
140
|
const credential = createAuthMessage(
|
|
55
141
|
keyring,
|
|
56
142
|
partyKey.publicKey,
|
|
57
|
-
identityKey,
|
|
58
|
-
deviceKey
|
|
143
|
+
identity2.identityKey,
|
|
144
|
+
identity2.deviceKey
|
|
59
145
|
);
|
|
60
|
-
|
|
61
146
|
expect(await authenticator.authenticate(credential.payload)).toEqual(true);
|
|
62
147
|
});
|
|
63
148
|
});
|