Skip to content

Commit

Permalink
Send type 2 TLV when no question is supplied
Browse files Browse the repository at this point in the history
 * Closes #58
  • Loading branch information
arlolra committed Oct 15, 2014
1 parent be50ec3 commit 64c635f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/otr.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@

// utf8 inputs
secret = CryptoJS.enc.Utf8.parse(secret).toString(CryptoJS.enc.Latin1)
question = CryptoJS.enc.Utf8.parse(question).toString(CryptoJS.enc.Latin1)
if (question)
question = CryptoJS.enc.Utf8.parse(question).toString(CryptoJS.enc.Latin1)

this.sm.rcvSecret(secret, question)
}
Expand Down
10 changes: 6 additions & 4 deletions lib/sm.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@

this.smpstate = CONST.SMPSTATE_EXPECT0

// assume utf8 question
question = CryptoJS.enc.Latin1
.parse(question)
.toString(CryptoJS.enc.Utf8)
if (question) {
// assume utf8 question
question = CryptoJS.enc.Latin1
.parse(question)
.toString(CryptoJS.enc.Utf8)
}

// invoke question
this.trigger('question', [question])
Expand Down
1 change: 1 addition & 0 deletions test/spec/unit/otr.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ describe('OTR', function () {
})

it('should check for DH pubkey equality before skipping key replacement', function (done) {
this.timeout(5000)
// issue #47

var err = function (err) { assert.ifError(err) }
Expand Down

0 comments on commit 64c635f

Please sign in to comment.