Skip to content

Commit 8b647e6

Browse files
committed
aes stream
1 parent 0d83376 commit 8b647e6

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/comms/isocket-comms.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class ISocketComms extends EventEmitter {
164164

165165
let content = null
166166

167-
if(this.aesStream){
167+
if(this.aesStream && input.id.indexOf('auth') == -1){
168168
debug('sending quantum aes')
169169
const contentBSON = Routines.BSON.serializeBSONWithoutOptimiser( input )
170170
content = await this.aesStream.encrypt( contentBSON )

src/comms/peer-comms.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {Routines} = require('@dataparty/crypto')
1+
const {Routines, Identity} = require('@dataparty/crypto')
22
const debug = require('debug')('dataparty.comms.peercomms')
33
const uuidv4 = require('uuid/v4')
44
const HttpMocks = require('node-mocks-http')
@@ -365,9 +365,9 @@ class PeerComms extends ISocketComms {
365365

366366
const offerBSON = Routines.BSON.serializeBSONWithoutOptimiser( op.input.offer )
367367
const offer = {
368-
sender: aesStreamOffer.sender,
369-
pqCipherText: aesStreamOffer.pqCipherText,
370-
streamNonce: aesStreamOffer.streamNonce
368+
sender: new Identity(op.input.offer.sender),
369+
pqCipherText: op.input.offer.pqCipherText,
370+
streamNonce: op.input.offer.streamNonce
371371
}
372372

373373
const signature = {
@@ -400,10 +400,12 @@ class PeerComms extends ISocketComms {
400400
debug('DENY - client not allowed - ', this.remoteIdentity)
401401
}
402402

403-
this.aesStream = this.party.privateIdentity.recoverStream(offer, true)
403+
404404

405405
debug('ALLOW - allowing client - ', this.remoteIdentity)
406406

407+
this.aesStream = await this.party.privateIdentity.recoverStream(offer, true)
408+
407409
clearTimeout(this._host_auth_timeout)
408410
this._host_auth_timeout = null
409411

0 commit comments

Comments
 (0)