@dxos/echo-db 2.33.1-dev.eb88db79 → 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 +20 -20
- 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
|
@@ -12,18 +12,18 @@ const json_stable_stringify_1 = __importDefault(require("json-stable-stringify")
|
|
|
12
12
|
const lodash_defaultsdeep_1 = __importDefault(require("lodash.defaultsdeep"));
|
|
13
13
|
const async_1 = require("@dxos/async");
|
|
14
14
|
const crypto_1 = require("@dxos/crypto");
|
|
15
|
+
const debug_1 = require("@dxos/debug");
|
|
15
16
|
const object_model_1 = require("@dxos/object-model");
|
|
16
17
|
const api_1 = require("../api");
|
|
18
|
+
const errors_1 = require("../errors");
|
|
17
19
|
const halo_party_1 = require("./halo-party");
|
|
18
20
|
/**
|
|
19
21
|
* Manage settings.
|
|
20
22
|
*/
|
|
21
23
|
// TODO(burdon): Split into device settings, user preferences, etc. (Expose subset as public API).
|
|
22
24
|
class Preferences {
|
|
23
|
-
constructor(
|
|
24
|
-
|
|
25
|
-
_party, _deviceKey) {
|
|
26
|
-
this._party = _party;
|
|
25
|
+
constructor(_getDatabase, _deviceKey) {
|
|
26
|
+
this._getDatabase = _getDatabase;
|
|
27
27
|
this._deviceKey = _deviceKey;
|
|
28
28
|
}
|
|
29
29
|
get values() {
|
|
@@ -39,8 +39,10 @@ class Preferences {
|
|
|
39
39
|
return partyPrefs.active || undefined === partyPrefs.active;
|
|
40
40
|
}
|
|
41
41
|
subscribeToPreferences(callback) {
|
|
42
|
-
|
|
43
|
-
const
|
|
42
|
+
var _a;
|
|
43
|
+
const database = (_a = this._getDatabase()) !== null && _a !== void 0 ? _a : (0, debug_1.raise)(new errors_1.IdentityNotInitializedError());
|
|
44
|
+
const globalResults = database.select({ type: halo_party_1.HALO_PARTY_PREFERENCES_TYPE }).exec();
|
|
45
|
+
const deviceResults = database.select({ type: halo_party_1.HALO_PARTY_DEVICE_PREFERENCES_TYPE }).exec();
|
|
44
46
|
const event = new async_1.Event();
|
|
45
47
|
let before = (0, json_stable_stringify_1.default)(this.values);
|
|
46
48
|
const unsubscribeGlobal = globalResults.update.on(() => {
|
|
@@ -64,17 +66,19 @@ class Preferences {
|
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
getGlobalPreferences() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
const database = this._getDatabase();
|
|
70
|
+
if (!database) {
|
|
71
|
+
return;
|
|
69
72
|
}
|
|
70
|
-
const [globalItem] =
|
|
73
|
+
const [globalItem] = database.select({ type: halo_party_1.HALO_PARTY_PREFERENCES_TYPE }).exec().entities;
|
|
71
74
|
return globalItem;
|
|
72
75
|
}
|
|
73
76
|
getDevicePreferences() {
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
const database = this._getDatabase();
|
|
78
|
+
if (!database) {
|
|
79
|
+
return;
|
|
76
80
|
}
|
|
77
|
-
const deviceItems =
|
|
81
|
+
const deviceItems = database.select({ type: halo_party_1.HALO_PARTY_DEVICE_PREFERENCES_TYPE }).exec().entities;
|
|
78
82
|
return deviceItems.find(item => this._deviceKey.equals(item.model.get('publicKey')));
|
|
79
83
|
}
|
|
80
84
|
getGlobalPartyPreference(partyKey, key) {
|
|
@@ -112,12 +116,16 @@ class Preferences {
|
|
|
112
116
|
party.update.emit(); // TODO(burdon): Should subscribe to database changes only?
|
|
113
117
|
}
|
|
114
118
|
async recordPartyJoining(joinedParty) {
|
|
115
|
-
const
|
|
119
|
+
const database = this._getDatabase();
|
|
120
|
+
if (!database) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const [partyDesc] = database
|
|
116
124
|
.select({ type: halo_party_1.HALO_PARTY_DESCRIPTOR_TYPE })
|
|
117
125
|
.filter(partyMarker => joinedParty.partyKey.equals(partyMarker.model.get('publicKey')))
|
|
118
126
|
.exec().entities;
|
|
119
127
|
(0, assert_1.default)(!partyDesc, `Descriptor already exists for Party: ${joinedParty.partyKey.toHex()}`);
|
|
120
|
-
await
|
|
128
|
+
await database.createItem({
|
|
121
129
|
model: object_model_1.ObjectModel,
|
|
122
130
|
type: halo_party_1.HALO_PARTY_DESCRIPTOR_TYPE,
|
|
123
131
|
props: {
|
|
@@ -128,6 +136,8 @@ class Preferences {
|
|
|
128
136
|
});
|
|
129
137
|
}
|
|
130
138
|
subscribeToJoinedPartyList(callback) {
|
|
139
|
+
var _a;
|
|
140
|
+
const database = (_a = this._getDatabase()) !== null && _a !== void 0 ? _a : (0, debug_1.raise)(new errors_1.IdentityNotInitializedError());
|
|
131
141
|
const converter = (partyDesc) => {
|
|
132
142
|
// TODO(burdon): Define type.
|
|
133
143
|
return {
|
|
@@ -138,7 +148,7 @@ class Preferences {
|
|
|
138
148
|
}))
|
|
139
149
|
};
|
|
140
150
|
};
|
|
141
|
-
const result =
|
|
151
|
+
const result = database.select({ type: halo_party_1.HALO_PARTY_DESCRIPTOR_TYPE }).exec();
|
|
142
152
|
// Wrap the query event so we can have manual control.
|
|
143
153
|
const event = new async_1.Event();
|
|
144
154
|
result.update.on(() => event.emit());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../../src/halo/preferences.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAC5B,kFAAoD;AACpD,8EAA+C;AAE/C,uCAAoC;AAEpC,yCAAyC;AACzC,qDAAiD;AAEjD,
|
|
1
|
+
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../../src/halo/preferences.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAC5B,kFAAoD;AACpD,8EAA+C;AAE/C,uCAAoC;AAEpC,yCAAyC;AACzC,uCAAoC;AACpC,qDAAiD;AAEjD,gCAAmD;AACnD,sCAAwD;AAExD,6CAEsB;AAEtB;;GAEG;AACH,kGAAkG;AAClG,MAAa,WAAW;IACtB,YACmB,YAAwC,EACxC,UAAqB;QADrB,iBAAY,GAAZ,YAAY,CAA4B;QACxC,eAAU,GAAV,UAAU,CAAW;IACrC,CAAC;IAEJ,IAAI,MAAM;;QACR,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAE/C,OAAO,IAAA,6BAAY,EAAC,EAAE,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,QAAQ,EAAE,mCAAI,EAAE,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,QAAQ,EAAE,mCAAI,EAAE,CAAC,C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O,WAAW,CAAC;IACrB,CAAC;CACF;AAjKD,kCAiKC"}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -22,7 +22,7 @@ __exportStar(require("./echo"), exports);
|
|
|
22
22
|
__exportStar(require("./errors"), exports);
|
|
23
23
|
__exportStar(require("./halo"), exports);
|
|
24
24
|
__exportStar(require("./invitations"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
25
|
+
__exportStar(require("./protocol"), exports);
|
|
26
26
|
__exportStar(require("./parties"), exports);
|
|
27
27
|
__exportStar(require("./pipeline"), exports);
|
|
28
28
|
__exportStar(require("./snapshots"), exports);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SecretProvider } from '@dxos/credentials';
|
|
1
|
+
import { Message, SecretProvider, SignedMessage } from '@dxos/credentials';
|
|
2
|
+
import { PublicKey } from '@dxos/crypto';
|
|
2
3
|
import { NetworkManager } from '@dxos/network-manager';
|
|
3
|
-
import {
|
|
4
|
+
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
4
5
|
import { GreetingState } from './greeting-responder';
|
|
5
6
|
import { InvitationDescriptor } from './invitation-descriptor';
|
|
6
7
|
/**
|
|
@@ -9,8 +10,8 @@ import { InvitationDescriptor } from './invitation-descriptor';
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class GreetingInitiator {
|
|
11
12
|
private readonly _networkManager;
|
|
12
|
-
private readonly _identity;
|
|
13
13
|
private readonly _invitationDescriptor;
|
|
14
|
+
private readonly _getMessagesToNotarize;
|
|
14
15
|
private _greeterPlugin?;
|
|
15
16
|
private _state;
|
|
16
17
|
/**
|
|
@@ -18,8 +19,9 @@ export declare class GreetingInitiator {
|
|
|
18
19
|
* @param _identity
|
|
19
20
|
* @param _invitationDescriptor
|
|
20
21
|
* @param _feedInitializer Callback to open or create a write feed for this party and return it's keypair.
|
|
22
|
+
* @param _getMessagesToNotarize Returns a list of credential messages that the inviter will be asked to write into the control feed.
|
|
21
23
|
*/
|
|
22
|
-
constructor(_networkManager: NetworkManager,
|
|
24
|
+
constructor(_networkManager: NetworkManager, _invitationDescriptor: InvitationDescriptor, _getMessagesToNotarize: (partyKey: PublicKey, nonce: Uint8Array) => Promise<Message[]>);
|
|
23
25
|
get state(): GreetingState;
|
|
24
26
|
/**
|
|
25
27
|
* Initiate a connection to a greeting responder node.
|
|
@@ -36,4 +38,12 @@ export declare class GreetingInitiator {
|
|
|
36
38
|
disconnect(): Promise<void>;
|
|
37
39
|
destroy(): Promise<void>;
|
|
38
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Create credentials messages that should be written to invite new device to the HALO party.
|
|
43
|
+
*/
|
|
44
|
+
export declare const createHaloPartyAdmissionMessage: (credentialsSigner: CredentialsSigner, nonce: Uint8Array) => Message;
|
|
45
|
+
/**
|
|
46
|
+
* Create credentials messages that should be written to invite member to the data party.
|
|
47
|
+
*/
|
|
48
|
+
export declare const createDataPartyAdmissionMessages: (credentialsSigner: CredentialsSigner, partyKey: PublicKey, identityGenesis: SignedMessage, nonce: Uint8Array) => Message;
|
|
39
49
|
//# sourceMappingURL=greeting-initiator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greeting-initiator.d.ts","sourceRoot":"","sources":["../../../src/invitations/greeting-initiator.ts"],"names":[],"mappings":"AAQA,OAAO,
|
|
1
|
+
{"version":3,"file":"greeting-initiator.d.ts","sourceRoot":"","sources":["../../../src/invitations/greeting-initiator.ts"],"names":[],"mappings":"AAQA,OAAO,EAUL,OAAO,EACP,cAAc,EAGd,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAe,SAAS,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAA0B,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAA4B,MAAM,yBAAyB,CAAC;AAMzF;;;GAGG;AACH,qBAAa,iBAAiB;IAc1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAfzC,OAAO,CAAC,cAAc,CAAC,CAAwB;IAG/C,OAAO,CAAC,MAAM,CAA4C;IAE1D;;;;;;OAMG;gBAEgB,eAAe,EAAE,cAAc,EAC/B,qBAAqB,EAAE,oBAAoB,EAC3C,sBAAsB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;IAKzG,IAAI,KAAK,kBAER;IAED;;;OAGG;IACG,OAAO,CAAE,OAAO,SAAkB;IAyCxC;;OAEG;IACG,gBAAgB,CAAE,cAAc,EAAE,cAAc;;;;IAgEhD,UAAU;IAMV,OAAO;CAMd;AAED;;GAEG;AACH,eAAO,MAAM,+BAA+B,sBACvB,iBAAiB,SAC7B,UAAU,KAChB,OAMF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,sBACxB,iBAAiB,YAC1B,SAAS,mBACF,aAAa,SACvB,UAAU,KAChB,OAMF,CAAC"}
|
|
@@ -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.GreetingInitiator = void 0;
|
|
9
|
+
exports.createDataPartyAdmissionMessages = exports.createHaloPartyAdmissionMessage = exports.GreetingInitiator = void 0;
|
|
10
10
|
const assert_1 = __importDefault(require("assert"));
|
|
11
11
|
const debug_1 = __importDefault(require("debug"));
|
|
12
12
|
const async_1 = require("@dxos/async");
|
|
@@ -28,11 +28,12 @@ class GreetingInitiator {
|
|
|
28
28
|
* @param _identity
|
|
29
29
|
* @param _invitationDescriptor
|
|
30
30
|
* @param _feedInitializer Callback to open or create a write feed for this party and return it's keypair.
|
|
31
|
+
* @param _getMessagesToNotarize Returns a list of credential messages that the inviter will be asked to write into the control feed.
|
|
31
32
|
*/
|
|
32
|
-
constructor(_networkManager,
|
|
33
|
+
constructor(_networkManager, _invitationDescriptor, _getMessagesToNotarize) {
|
|
33
34
|
this._networkManager = _networkManager;
|
|
34
|
-
this._identity = _identity;
|
|
35
35
|
this._invitationDescriptor = _invitationDescriptor;
|
|
36
|
+
this._getMessagesToNotarize = _getMessagesToNotarize;
|
|
36
37
|
// TODO(dboreham): Can we use the same states as the responder?
|
|
37
38
|
this._state = greeting_responder_1.GreetingState.INITIALIZED;
|
|
38
39
|
(0, assert_1.default)(invitation_descriptor_1.InvitationDescriptorType.INTERACTIVE === this._invitationDescriptor.type);
|
|
@@ -82,7 +83,6 @@ class GreetingInitiator {
|
|
|
82
83
|
async redeemInvitation(secretProvider) {
|
|
83
84
|
(0, assert_1.default)(this._state === greeting_responder_1.GreetingState.CONNECTED);
|
|
84
85
|
const { swarmKey } = this._invitationDescriptor;
|
|
85
|
-
const haloInvitation = !!this._invitationDescriptor.identityKey;
|
|
86
86
|
const responderPeerId = Buffer.from(swarmKey);
|
|
87
87
|
/* The first step in redeeming the Invitation is the BEGIN command.
|
|
88
88
|
* On the Greeter end, this is when it takes action (eg, generating a passcode)
|
|
@@ -106,18 +106,7 @@ class GreetingInitiator {
|
|
|
106
106
|
// The result will include the partyKey and a nonce used when signing the response.
|
|
107
107
|
const { nonce } = handshakeResponse;
|
|
108
108
|
const partyKey = handshakeResponse.partyKey;
|
|
109
|
-
const credentialMessages =
|
|
110
|
-
if (haloInvitation) {
|
|
111
|
-
(0, assert_1.default)(this._identity.deviceKey, 'Device key required');
|
|
112
|
-
// For the HALO, add the DEVICE directly.
|
|
113
|
-
credentialMessages.push((0, credentials_1.createKeyAdmitMessage)(this._identity.signer, partyKey, this._identity.deviceKey, [], nonce));
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
(0, assert_1.default)(this._identity.deviceKeyChain, 'Device key required');
|
|
117
|
-
(0, assert_1.default)(this._identity.identityGenesis, 'Identity genesis message required');
|
|
118
|
-
// For any other Party, add the IDENTITY, signed by the DEVICE keychain, which links back to that IDENTITY.
|
|
119
|
-
credentialMessages.push((0, credentials_1.createEnvelopeMessage)(this._identity.signer, partyKey, (0, credentials_1.wrapMessage)(this._identity.identityGenesis), [this._identity.deviceKeyChain], nonce));
|
|
120
|
-
}
|
|
109
|
+
const credentialMessages = await this._getMessagesToNotarize(crypto_1.PublicKey.from(partyKey), nonce);
|
|
121
110
|
// Send the signed payload to the greeting responder.
|
|
122
111
|
const notarizeResponse = await this._greeterPlugin.send(responderPeerId, (0, credentials_1.createGreetingNotarizeMessage)(secret, credentialMessages));
|
|
123
112
|
//
|
|
@@ -152,4 +141,14 @@ class GreetingInitiator {
|
|
|
152
141
|
}
|
|
153
142
|
}
|
|
154
143
|
exports.GreetingInitiator = GreetingInitiator;
|
|
144
|
+
/**
|
|
145
|
+
* Create credentials messages that should be written to invite new device to the HALO party.
|
|
146
|
+
*/
|
|
147
|
+
const createHaloPartyAdmissionMessage = (credentialsSigner, nonce) => (0, credentials_1.createKeyAdmitMessage)(credentialsSigner.signer, credentialsSigner.getIdentityKey().publicKey, credentialsSigner.getDeviceKey(), [], Buffer.from(nonce));
|
|
148
|
+
exports.createHaloPartyAdmissionMessage = createHaloPartyAdmissionMessage;
|
|
149
|
+
/**
|
|
150
|
+
* Create credentials messages that should be written to invite member to the data party.
|
|
151
|
+
*/
|
|
152
|
+
const createDataPartyAdmissionMessages = (credentialsSigner, partyKey, identityGenesis, nonce) => (0, credentials_1.createEnvelopeMessage)(credentialsSigner.signer, partyKey, (0, credentials_1.wrapMessage)(identityGenesis), [credentialsSigner.getDeviceSigningKeys()], Buffer.from(nonce));
|
|
153
|
+
exports.createDataPartyAdmissionMessages = createDataPartyAdmissionMessages;
|
|
155
154
|
//# sourceMappingURL=greeting-initiator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greeting-initiator.js","sourceRoot":"","sources":["../../../src/invitations/greeting-initiator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAC5B,kDAA0B;AAE1B,uCAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"greeting-initiator.js","sourceRoot":"","sources":["../../../src/invitations/greeting-initiator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAC5B,kDAA0B;AAE1B,uCAA2C;AAC3C,mDAe2B;AAC3B,yCAAsD;AACtD,2DAA+E;AAG/E,6EAAwE;AACxE,6DAAqD;AACrD,mEAAyF;AAEzF,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,iCAAiC,CAAC,CAAC;AAErD,MAAM,eAAe,GAAG,KAAM,CAAC;AAE/B;;;GAGG;AACH,MAAa,iBAAiB;IAM5B;;;;;;OAMG;IACH,YACmB,eAA+B,EAC/B,qBAA2C,EAC3C,sBAAsF;QAFtF,oBAAe,GAAf,eAAe,CAAgB;QAC/B,0BAAqB,GAArB,qBAAqB,CAAsB;QAC3C,2BAAsB,GAAtB,sBAAsB,CAAgE;QAbzG,+DAA+D;QACvD,WAAM,GAAkB,kCAAa,CAAC,WAAW,CAAC;QAcxD,IAAA,gBAAM,EAAC,gDAAwB,CAAC,WAAW,KAAK,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAE,OAAO,GAAG,eAAe;QACtC,IAAA,gBAAM,EAAC,IAAI,CAAC,MAAM,KAAK,kCAAa,CAAC,WAAW,CAAC,CAAC;QAElD,4DAA4D;QAC5D,uFAAuF;QACvF,MAAM,E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,CACnB,CAAC;AATW,QAAA,+BAA+B,mCAS1C;AAEF;;GAEG;AACI,MAAM,gCAAgC,GAAG,CAC9C,iBAAoC,EACpC,QAAmB,EACnB,eAA8B,EAC9B,KAAiB,EACR,EAAE,CAAC,IAAA,mCAAqB,EACjC,iBAAiB,CAAC,MAAM,EACxB,QAAQ,EACR,IAAA,yBAAW,EAAC,eAAe,CAAC,EAC5B,CAAC,iBAAiB,CAAC,oBAAoB,EAAE,CAAC,EAC1C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CACnB,CAAC;AAXW,QAAA,gCAAgC,oCAW3C"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Event } from '@dxos/async';
|
|
3
3
|
import { KeyHint, SecretProvider, SecretValidator } from '@dxos/credentials';
|
|
4
4
|
import { NetworkManager } from '@dxos/network-manager';
|
|
5
|
-
import { Identity } from '../halo';
|
|
6
5
|
import { PartyProcessor } from '../pipeline';
|
|
6
|
+
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
7
7
|
import { InvitationOptions } from './common';
|
|
8
8
|
/**
|
|
9
9
|
* GreetingResponder transitions through the following states:
|
|
@@ -24,7 +24,7 @@ export declare enum GreetingState {
|
|
|
24
24
|
export declare class GreetingResponder {
|
|
25
25
|
private readonly _networkManager;
|
|
26
26
|
private readonly _partyProcessor;
|
|
27
|
-
private readonly
|
|
27
|
+
private readonly _credentialsSigner;
|
|
28
28
|
private readonly _greeterPlugin;
|
|
29
29
|
private readonly _swarmKey;
|
|
30
30
|
private readonly _greeter;
|
|
@@ -33,7 +33,7 @@ export declare class GreetingResponder {
|
|
|
33
33
|
* Param: Invitation id
|
|
34
34
|
*/
|
|
35
35
|
readonly connected: Event<any>;
|
|
36
|
-
constructor(_networkManager: NetworkManager, _partyProcessor: PartyProcessor,
|
|
36
|
+
constructor(_networkManager: NetworkManager, _partyProcessor: PartyProcessor, _credentialsSigner: CredentialsSigner);
|
|
37
37
|
/**
|
|
38
38
|
* Accessor for UI to display status to the user.
|
|
39
39
|
* Return the current state for this Greeting Responder (waiting, peer connected, successful auth, auth failed, etc.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greeting-responder.d.ts","sourceRoot":"","sources":["../../../src/invitations/greeting-responder.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,KAAK,EAAoB,MAAM,aAAa,CAAC;AACtD,OAAO,EAGkB,OAAO,EAG9B,cAAc,EACd,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAA0B,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"greeting-responder.d.ts","sourceRoot":"","sources":["../../../src/invitations/greeting-responder.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,KAAK,EAAoB,MAAM,aAAa,CAAC;AACtD,OAAO,EAGkB,OAAO,EAG9B,cAAc,EACd,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAA0B,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7C;;GAEG;AACH,oBAAY,aAAa;IACvB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAa1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAdrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwB;IACvD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;IACrD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC,OAAO,CAAC,MAAM,CAA4C;IAE1D;;OAEG;IACH,QAAQ,CAAC,SAAS,aAAoB;gBAGnB,eAAe,EAAE,cAAc,EAC/B,eAAe,EAAE,cAAc,EAC/B,kBAAkB,EAAE,iBAAiB;IAWxD;;;;OAIG;IACH,IAAI,KAAK,kBAER;IAED;;;;;;OAMG;IAEG,MAAM,CACV,eAAe,EAAE,eAAe,EAChC,cAAc,CAAC,EAAE,cAAc,EAC/B,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,EACxC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;IA+ClB;;OAEG;IACG,KAAK;IAqBX;;OAEG;IACG,IAAI;IAUV;;OAEG;IACG,OAAO;IAOb;;;;;OAKG;IACG,wBAAwB,CAAE,QAAQ,EAAE,GAAG,EAAE;IA6C/C;;;OAGG;IACH,YAAY,IAAK,OAAO,EAAE;CAmB3B"}
|
|
@@ -33,10 +33,10 @@ var GreetingState;
|
|
|
33
33
|
* Upon successful greeting, the peer is admitted into the Party specified in the invitation descriptor.
|
|
34
34
|
*/
|
|
35
35
|
class GreetingResponder {
|
|
36
|
-
constructor(_networkManager, _partyProcessor,
|
|
36
|
+
constructor(_networkManager, _partyProcessor, _credentialsSigner) {
|
|
37
37
|
this._networkManager = _networkManager;
|
|
38
38
|
this._partyProcessor = _partyProcessor;
|
|
39
|
-
this.
|
|
39
|
+
this._credentialsSigner = _credentialsSigner;
|
|
40
40
|
this._swarmKey = (0, crypto_1.randomBytes)();
|
|
41
41
|
this._state = GreetingState.INITIALIZED;
|
|
42
42
|
/**
|
|
@@ -145,7 +145,6 @@ class GreetingResponder {
|
|
|
145
145
|
*/
|
|
146
146
|
async _writeCredentialsToParty(messages) {
|
|
147
147
|
(0, assert_1.default)(this._state === GreetingState.CONNECTED);
|
|
148
|
-
(0, assert_1.default)(this._identity.deviceKeyChain);
|
|
149
148
|
/* These messages will be self-signed by keys not yet admitted to the Party,, so we cannot check
|
|
150
149
|
* for a trusted key, only that the signatures are valid.
|
|
151
150
|
*/
|
|
@@ -164,7 +163,7 @@ class GreetingResponder {
|
|
|
164
163
|
const allKeys = [...this._partyProcessor.memberKeys, ...this._partyProcessor.feedKeys];
|
|
165
164
|
return allKeys.find(value => value.equals(key));
|
|
166
165
|
};
|
|
167
|
-
const envelope = (0, credentials_1.createEnvelopeMessage)(this.
|
|
166
|
+
const envelope = (0, credentials_1.createEnvelopeMessage)(this._credentialsSigner.signer, this._partyProcessor.partyKey, message, [this._credentialsSigner.getDeviceSigningKeys()]);
|
|
168
167
|
await this._partyProcessor.writeHaloMessage(envelope);
|
|
169
168
|
// Wait for keys to be admitted.
|
|
170
169
|
await (0, async_1.waitForCondition)(() => admittedKeys.every(hasKey));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greeting-responder.js","sourceRoot":"","sources":["../../../src/invitations/greeting-responder.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAC5B,kDAA0B;AAE1B,uCAAsD;AACtD,mDAQ2B;AAC3B,yCAAmE;AAEnE,2DAA+E;AAK/E,6EAAwE;AAExE,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,iCAAiC,CAAC,CAAC;AAErD;;GAEG;AACH,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,4CAA2B,CAAA;IAC3B,wCAAuB,CAAA;IACvB,wCAAuB,CAAA;IACvB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,8CAA6B,CAAA;AAC/B,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB;AAED;;;GAGG;AACH,MAAa,iBAAiB;IAY5B,YACmB,eAA+B,EAC/B,eAA+B,EAC/B,
|
|
1
|
+
{"version":3,"file":"greeting-responder.js","sourceRoot":"","sources":["../../../src/invitations/greeting-responder.ts"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"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ClaimResponse, GreetingCommandPlugin, SecretProvider } from '@dxos/credentials';
|
|
3
|
+
import { PublicKey } from '@dxos/crypto';
|
|
3
4
|
import { NetworkManager } from '@dxos/network-manager';
|
|
4
|
-
import {
|
|
5
|
+
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
5
6
|
import { GreetingState } from './greeting-responder';
|
|
6
7
|
import { InvitationDescriptor } from './invitation-descriptor';
|
|
8
|
+
import { InvitationFactory } from './invitation-factory';
|
|
7
9
|
/**
|
|
8
10
|
* Class to facilitate making a unsolicited connections to an existing HALO Party to ask for entrance.
|
|
9
11
|
* If successful, regular Greeting will follow authenticated by the Identity key (usually recovered from
|
|
@@ -13,11 +15,11 @@ import { InvitationDescriptor } from './invitation-descriptor';
|
|
|
13
15
|
*/
|
|
14
16
|
export declare class HaloRecoveryInitiator {
|
|
15
17
|
private readonly _networkManager;
|
|
16
|
-
private readonly
|
|
18
|
+
private readonly _credentialsSigner;
|
|
17
19
|
_state: GreetingState;
|
|
18
20
|
_greeterPlugin?: GreetingCommandPlugin;
|
|
19
21
|
_peerId?: Buffer;
|
|
20
|
-
constructor(_networkManager: NetworkManager,
|
|
22
|
+
constructor(_networkManager: NetworkManager, _credentialsSigner: CredentialsSigner);
|
|
21
23
|
get state(): GreetingState;
|
|
22
24
|
/**
|
|
23
25
|
* Initiate a connection to some Party member node.
|
|
@@ -34,6 +36,6 @@ export declare class HaloRecoveryInitiator {
|
|
|
34
36
|
disconnect(): Promise<void>;
|
|
35
37
|
destroy(): Promise<void>;
|
|
36
38
|
createSecretProvider(): SecretProvider;
|
|
37
|
-
static createHaloInvitationClaimHandler(
|
|
39
|
+
static createHaloInvitationClaimHandler(identityKey: PublicKey, invitationManager: InvitationFactory): (message: any, remotePeerId: Buffer, peerId: Buffer) => Promise<import("@dxos/credentials").WithTypeUrl<ClaimResponse>>;
|
|
38
40
|
}
|
|
39
41
|
//# sourceMappingURL=halo-recovery-initiator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"halo-recovery-initiator.d.ts","sourceRoot":"","sources":["../../../src/invitations/halo-recovery-initiator.ts"],"names":[],"mappings":";AAQA,OAAO,EACL,aAAa,EAGb,qBAAqB,EAIrB,cAAc,EAIf,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"halo-recovery-initiator.d.ts","sourceRoot":"","sources":["../../../src/invitations/halo-recovery-initiator.ts"],"names":[],"mappings":";AAQA,OAAO,EACL,aAAa,EAGb,qBAAqB,EAIrB,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA4B,SAAS,EAAuB,MAAM,cAAc,CAAC;AACxF,OAAO,EAA0B,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAA4B,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAMzD;;;;;;GAMG;AACH,qBAAa,qBAAqB;IAM9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IANrC,MAAM,EAAE,aAAa,CAAC;IACtB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;gBAGE,eAAe,EAAE,cAAc,EAC/B,kBAAkB,EAAE,iBAAiB;IAKxD,IAAI,KAAK,kBAER;IAED;;;OAGG;IACG,OAAO,CAAE,OAAO,SAAkB;IA4BxC;;;;;OAKG;IACG,KAAK;IAgCL,UAAU;IAMV,OAAO;IAQb,oBAAoB,IAAK,cAAc;IAevC,MAAM,CAAC,gCAAgC,CAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,iBAAiB;CAiCtG"}
|
|
@@ -12,7 +12,6 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
12
12
|
const async_1 = require("@dxos/async");
|
|
13
13
|
const credentials_1 = require("@dxos/credentials");
|
|
14
14
|
const crypto_1 = require("@dxos/crypto");
|
|
15
|
-
const debug_2 = require("@dxos/debug");
|
|
16
15
|
const network_manager_1 = require("@dxos/network-manager");
|
|
17
16
|
const errors_1 = require("../errors");
|
|
18
17
|
const greeting_protocol_provider_1 = require("./greeting-protocol-provider");
|
|
@@ -28,9 +27,9 @@ const DEFAULT_TIMEOUT = 30000;
|
|
|
28
27
|
* TODO(telackey): DoS mitigation
|
|
29
28
|
*/
|
|
30
29
|
class HaloRecoveryInitiator {
|
|
31
|
-
constructor(_networkManager,
|
|
30
|
+
constructor(_networkManager, _credentialsSigner) {
|
|
32
31
|
this._networkManager = _networkManager;
|
|
33
|
-
this.
|
|
32
|
+
this._credentialsSigner = _credentialsSigner;
|
|
34
33
|
this._state = greeting_responder_1.GreetingState.INITIALIZED;
|
|
35
34
|
}
|
|
36
35
|
get state() {
|
|
@@ -45,8 +44,7 @@ class HaloRecoveryInitiator {
|
|
|
45
44
|
// This is a temporary connection, there is no need to any special or permanent ID.
|
|
46
45
|
this._peerId = (0, crypto_1.randomBytes)();
|
|
47
46
|
log('Local PeerId:', (0, crypto_1.keyToString)(this._peerId));
|
|
48
|
-
|
|
49
|
-
const swarmKey = this._identity.identityKey.publicKey.asBuffer();
|
|
47
|
+
const swarmKey = this._credentialsSigner.getIdentityKey().publicKey.asBuffer();
|
|
50
48
|
this._greeterPlugin = new credentials_1.GreetingCommandPlugin(this._peerId, async () => false);
|
|
51
49
|
log('Connecting');
|
|
52
50
|
const peerJoinedWaiter = (0, async_1.waitForEvent)(this._greeterPlugin, 'peer:joined', () => { var _a; return (_a = this._greeterPlugin) === null || _a === void 0 ? void 0 : _a.peers.length; }, timeout);
|
|
@@ -71,23 +69,21 @@ class HaloRecoveryInitiator {
|
|
|
71
69
|
(0, assert_1.default)(this._state === greeting_responder_1.GreetingState.CONNECTED);
|
|
72
70
|
(0, assert_1.default)(this._greeterPlugin);
|
|
73
71
|
(0, assert_1.default)(this._peerId);
|
|
74
|
-
(0, assert_1.default)(this._identity.identityKey);
|
|
75
72
|
// Send to the first peer (any peer will do).
|
|
76
73
|
const peer = this._greeterPlugin.peers[0];
|
|
77
74
|
const responderPeerId = (0, crypto_1.keyToBuffer)(peer.getSession().peerId);
|
|
78
75
|
// Synthesize an "invitationID" which is the signature of both peerIds signed by our Identity key.
|
|
79
|
-
const signature = this.
|
|
76
|
+
const signature = this._credentialsSigner.signer.rawSign(Buffer.concat([this._peerId, responderPeerId]), this._credentialsSigner.getIdentityKey());
|
|
80
77
|
// We expect to receive a new swarm/rendezvousKey to use for the full Greeting process.
|
|
81
78
|
const claimResponse = await this._greeterPlugin.send(responderPeerId, (0, credentials_1.createGreetingClaimMessage)(signature));
|
|
82
79
|
const { id, rendezvousKey } = claimResponse;
|
|
83
80
|
(0, assert_1.default)(id && rendezvousKey);
|
|
84
81
|
await this.disconnect();
|
|
85
82
|
this._state = greeting_responder_1.GreetingState.SUCCEEDED;
|
|
86
|
-
return new invitation_descriptor_1.InvitationDescriptor(invitation_descriptor_1.InvitationDescriptorType.INTERACTIVE, Buffer.from(rendezvousKey), Buffer.from(id), this.
|
|
83
|
+
return new invitation_descriptor_1.InvitationDescriptor(invitation_descriptor_1.InvitationDescriptorType.INTERACTIVE, Buffer.from(rendezvousKey), Buffer.from(id), this._credentialsSigner.getIdentityKey().publicKey);
|
|
87
84
|
}
|
|
88
85
|
async disconnect() {
|
|
89
|
-
|
|
90
|
-
const swarmKey = this._identity.identityKey.publicKey.asBuffer();
|
|
86
|
+
const swarmKey = this._credentialsSigner.getIdentityKey().publicKey.asBuffer();
|
|
91
87
|
await this._networkManager.leaveProtocolSwarm(crypto_1.PublicKey.from(swarmKey));
|
|
92
88
|
this._state = greeting_responder_1.GreetingState.DISCONNECTED;
|
|
93
89
|
}
|
|
@@ -99,22 +95,16 @@ class HaloRecoveryInitiator {
|
|
|
99
95
|
}
|
|
100
96
|
// The secretProvider should provide an `Auth` message signed directly by the Identity key.
|
|
101
97
|
createSecretProvider() {
|
|
102
|
-
return async (info) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*/
|
|
108
|
-
(0, credentials_1.createAuthMessage)(this._identity.signer, info.id.value, (_a = this._identity.identityKey) !== null && _a !== void 0 ? _a : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError()), (_b = this._identity.identityKey) !== null && _b !== void 0 ? _b : (0, debug_2.raise)(new errors_1.IdentityNotInitializedError()), undefined, info.authNonce.value)));
|
|
109
|
-
};
|
|
98
|
+
return async (info) => Buffer.from(credentials_1.codec.encode(
|
|
99
|
+
/* The signed portion of the Auth message includes the ID and authNonce provided
|
|
100
|
+
* by "info". These values will be validated on the other end.
|
|
101
|
+
*/
|
|
102
|
+
(0, credentials_1.createAuthMessage)(this._credentialsSigner.signer, info.id.value, this._credentialsSigner.getIdentityKey(), this._credentialsSigner.getIdentityKey(), undefined, info.authNonce.value)));
|
|
110
103
|
}
|
|
111
|
-
static createHaloInvitationClaimHandler(
|
|
104
|
+
static createHaloInvitationClaimHandler(identityKey, invitationManager) {
|
|
112
105
|
const claimHandler = new credentials_1.PartyInvitationClaimHandler(async (invitationID, remotePeerId, peerId) => {
|
|
113
|
-
const identity = identityProvider();
|
|
114
|
-
(0, assert_1.default)(identity.halo, 'HALO is required');
|
|
115
|
-
(0, assert_1.default)(identity.identityKey);
|
|
116
106
|
// The invitationtId is the signature of both peerIds, signed by the Identity key.
|
|
117
|
-
const ok = (0, crypto_1.verify)(Buffer.concat([remotePeerId, peerId]), invitationID,
|
|
107
|
+
const ok = (0, crypto_1.verify)(Buffer.concat([remotePeerId, peerId]), invitationID, identityKey.asBuffer());
|
|
118
108
|
if (!ok) {
|
|
119
109
|
throw new errors_1.InvalidInvitationError();
|
|
120
110
|
}
|
|
@@ -123,7 +113,7 @@ class HaloRecoveryInitiator {
|
|
|
123
113
|
*/
|
|
124
114
|
const keyring = new credentials_1.Keyring();
|
|
125
115
|
await keyring.addPublicKey({
|
|
126
|
-
publicKey:
|
|
116
|
+
publicKey: identityKey,
|
|
127
117
|
type: credentials_1.KeyType.IDENTITY,
|
|
128
118
|
trusted: true,
|
|
129
119
|
own: false
|
|
@@ -135,8 +125,7 @@ class HaloRecoveryInitiator {
|
|
|
135
125
|
invitation.authNonce.equals(authMessage.signed.nonce);
|
|
136
126
|
};
|
|
137
127
|
// TODO(telackey): Configure expiration.
|
|
138
|
-
return
|
|
139
|
-
.createInvitation({ secretValidator }, { expiration: Date.now() + 60000 });
|
|
128
|
+
return invitationManager.createInvitation({ secretValidator }, { expiration: Date.now() + 60000 });
|
|
140
129
|
});
|
|
141
130
|
return claimHandler.createMessageHandler();
|
|
142
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"halo-recovery-initiator.js","sourceRoot":"","sources":["../../../src/invitations/halo-recovery-initiator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAC5B,kDAA0B;AAE1B,uCAA2C;AAC3C,mDAY2B;AAC3B,yCAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"halo-recovery-initiator.js","sourceRoot":"","sources":["../../../src/invitations/halo-recovery-initiator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA4B;AAC5B,kDAA0B;AAE1B,uCAA2C;AAC3C,mDAY2B;AAC3B,yCAAwF;AACxF,2DAA+E;AAE/E,sCAAmD;AAEnD,6EAAwE;AACxE,6DAAqD;AACrD,mEAAyF;AAGzF,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,sCAAsC,CAAC,CAAC;AAE1D,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B;;;;;;GAMG;AACH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 +4,6 @@ export * from './greeting-initiator';
|
|
|
4
4
|
export * from './greeting-responder';
|
|
5
5
|
export * from './halo-recovery-initiator';
|
|
6
6
|
export * from './invitation-descriptor';
|
|
7
|
-
export * from './invitation-
|
|
7
|
+
export * from './invitation-factory';
|
|
8
8
|
export * from './offline-invitation-claimer';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -19,6 +19,6 @@ __exportStar(require("./greeting-initiator"), exports);
|
|
|
19
19
|
__exportStar(require("./greeting-responder"), exports);
|
|
20
20
|
__exportStar(require("./halo-recovery-initiator"), exports);
|
|
21
21
|
__exportStar(require("./invitation-descriptor"), exports);
|
|
22
|
-
__exportStar(require("./invitation-
|
|
22
|
+
__exportStar(require("./invitation-factory"), exports);
|
|
23
23
|
__exportStar(require("./offline-invitation-claimer"), exports);
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { PublicKey } from '@dxos/crypto';
|
|
3
3
|
import { NetworkManager } from '@dxos/network-manager';
|
|
4
|
-
import { IdentityProvider } from '../halo';
|
|
5
4
|
import { PartyProcessor } from '../pipeline';
|
|
5
|
+
import { CredentialsSigner } from '../protocol/credentials-signer';
|
|
6
6
|
import { InvitationAuthenticator, InvitationOptions } from './common';
|
|
7
7
|
import { InvitationDescriptor } from './invitation-descriptor';
|
|
8
8
|
/**
|
|
9
9
|
* Groups together all invitation-related functionality for a single party.
|
|
10
10
|
*/
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class InvitationFactory {
|
|
12
12
|
private readonly _partyProcessor;
|
|
13
|
-
private readonly
|
|
13
|
+
private readonly _credentialsSigner;
|
|
14
14
|
private readonly _networkManager;
|
|
15
|
-
constructor(_partyProcessor: PartyProcessor,
|
|
16
|
-
private get _identity();
|
|
15
|
+
constructor(_partyProcessor: PartyProcessor, _credentialsSigner: CredentialsSigner, _networkManager: NetworkManager);
|
|
17
16
|
get isHalo(): boolean;
|
|
18
17
|
createOfflineInvitation(publicKey: PublicKey): Promise<InvitationDescriptor>;
|
|
19
18
|
/**
|
|
@@ -22,4 +21,4 @@ export declare class InvitationManager {
|
|
|
22
21
|
createInvitation(authenticationDetails?: InvitationAuthenticator, options?: InvitationOptions): Promise<InvitationDescriptor>;
|
|
23
22
|
getOfflineInvitation(invitationId: Buffer): import("@dxos/credentials").SignedMessage | undefined;
|
|
24
23
|
}
|
|
25
|
-
//# sourceMappingURL=invitation-
|
|
24
|
+
//# sourceMappingURL=invitation-factory.d.ts.map
|