|
1 | 1 |
|
2 | | -const {Routines, Identity} = require('@dataparty/crypto') |
| 2 | +const {Routines, Identity, AESStream} = require('@dataparty/crypto') |
3 | 3 | const debug = require('debug')('dataparty.comms.peercomms') |
4 | 4 | const uuidv4 = require('uuid/v4') |
5 | 5 | const HttpMocks = require('node-mocks-http') |
@@ -231,8 +231,8 @@ class PeerComms extends ISocketComms { |
231 | 231 | this.close() |
232 | 232 | } |
233 | 233 |
|
234 | | - async close(){ |
235 | | - debug('close', this.uuid) |
| 234 | + async close(event){ |
| 235 | + debug('close', this.uuid, event) |
236 | 236 |
|
237 | 237 | if(this.party.topics){ |
238 | 238 | await this.party.topics.destroyNode(this) |
@@ -369,7 +369,8 @@ class PeerComms extends ISocketComms { |
369 | 369 | const offer = { |
370 | 370 | sender: new Identity(op.input.offer.sender), |
371 | 371 | pqCipherText: op.input.offer.pqCipherText, |
372 | | - streamNonce: op.input.offer.streamNonce |
| 372 | + streamNonce: op.input.offer.streamNonce, |
| 373 | + mode: op.input.offer.mode |
373 | 374 | } |
374 | 375 |
|
375 | 376 | const signature = { |
@@ -419,9 +420,16 @@ class PeerComms extends ISocketComms { |
419 | 420 | } |
420 | 421 | } |
421 | 422 |
|
| 423 | + debug('clienr auth op offer -', offer) |
422 | 424 | debug('ALLOW - allowing client - ', this.remoteIdentity) |
423 | 425 |
|
424 | | - this.aesStream = await this.party.privateIdentity.recoverStream(offer, true) |
| 426 | + this.aesStream = await AESStream.recoverStream( |
| 427 | + this.party.privateIdentity, |
| 428 | + offer, |
| 429 | + true |
| 430 | + ) |
| 431 | + |
| 432 | + debug('aes-stream', this.aesStream) |
425 | 433 |
|
426 | 434 | clearTimeout(this._host_auth_timeout) |
427 | 435 | this._host_auth_timeout = null |
|
0 commit comments