aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
index d6d733f..e49eb4c 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
@@ -157,7 +157,7 @@ extendTransport(class {
const epoch = this.chatEpoch || keys.current;
const epochKey = keys.byEpoch.get(epoch);
if (!epochKey) throw new Error('No chat key for this group — reconnect');
- if (!this.devicePk || !this._sessionKeys || !this._sessionKeys.skEdB64) {
+ if (!this.devicePk || !this._identity) {
throw new Error('This device is not identified to the node — reconnect');
}
@@ -172,9 +172,11 @@ extendTransport(class {
const { nonce, ct } = await C.sealChat(
epochKey, gid, epoch, this.devicePk, plaintext);
const device = C.b64decode(this.devicePk);
- const sig = C.b64decode(await window.MeshBayKeys.signBytes(
- this._sessionKeys.skEdB64,
- C.chatSigningTranscript(gid, epoch, device, nonce, ct)));
+ // The transcript names the signing device as this identity's own key,
+ // which is what `devicePk` is once the node has been told (device_hello).
+ const sig = C.b64decode(await this._identity.signAs('chat', {
+ groupId: gid, epoch, nonce: C.b64encode(nonce), ct: C.b64encode(ct),
+ }));
const msg = await this._sendAndWait({
type: 'chat_msg',
@@ -212,7 +214,6 @@ extendTransport(class {
if (msg.epoch) this.chatEpoch = msg.epoch;
this._chatKeys = null;
this._chatKeysInFlight = null;
- if (this._onChatEpoch) this._onChatEpoch(this.chatEpoch);
}
/**