Skip to content

Commit 5b38545

Browse files
committed
bump version
1 parent 5c66ad2 commit 5b38545

File tree

5 files changed

+56
-47
lines changed

5 files changed

+56
-47
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "otr",
3-
"version": "0.2.10",
3+
"version": "0.2.11",
44
"main": "build/otr.js",
55
"ignore": [
66
"**/.*",

build/otr.js

+44-42
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
3-
otr.js v0.2.10 - 2014-02-04
3+
otr.js v0.2.11 - 2014-03-24
44
(c) 2014 - Arlo Breault <[email protected]>
55
Freely distributed under the MPL v2.0 license.
66
@@ -1095,7 +1095,6 @@
10951095
this.ssid = null
10961096
this.transmittedRS = false
10971097
this.r = null
1098-
this.priv = otr.priv
10991098

11001099
// bind methods
11011100
var self = this
@@ -1144,10 +1143,10 @@
11441143
},
11451144

11461145
makeM: function (their_y, m1, c, m2) {
1147-
var pk = this.priv.packPublic()
1146+
var pk = this.otr.priv.packPublic()
11481147
var kid = HLP.packINT(this.our_keyid)
11491148
var m = hMac(this.our_dh.publicKey, their_y, pk, kid, m1)
1150-
m = this.priv.sign(m)
1149+
m = this.otr.priv.sign(m)
11511150
var msg = pk + kid
11521151
msg += BigInt.bigInt2bits(m[0], 20) // pad to 20 bytes
11531152
msg += BigInt.bigInt2bits(m[1], 20)
@@ -1409,7 +1408,7 @@
14091408
)
14101409
if (send[0]) return this.otr.error(send[0])
14111410

1412-
this.otr._sendMsg(send[1], true)
1411+
this.otr.io(send[1])
14131412
},
14141413

14151414
initiateAKE: function (version) {
@@ -1556,7 +1555,7 @@
15561555

15571556
if (msg.type === 6) {
15581557
this.init()
1559-
this.trigger('trust', [false])
1558+
this.trigger('abort')
15601559
return
15611560
}
15621561

@@ -2092,21 +2091,25 @@
20922091
})
20932092
this.sm.on('send', function (ssid, send) {
20942093
if (self.ssid === ssid)
2095-
self._sendMsg(send)
2094+
send = self.prepareMsg(send)
2095+
self.io(send)
20962096
})
20972097
}
20982098

2099-
OTR.prototype.io = function (msg) {
2099+
OTR.prototype.io = function (msg, meta) {
21002100

21012101
// buffer
2102+
msg = ([].concat(msg)).map(function(m){
2103+
return { msg: m, meta: meta }
2104+
})
21022105
this.outgoing = this.outgoing.concat(msg)
21032106

21042107
var self = this
21052108
;(function send(first) {
21062109
if (!first) {
21072110
if (!self.outgoing.length) return
2108-
var msg = self.outgoing.shift()
2109-
self.trigger('io', [msg])
2111+
var elem = self.outgoing.shift()
2112+
self.trigger('io', [elem.msg, elem.meta])
21102113
}
21112114
setTimeout(send, first ? 0 : self.send_interval)
21122115
}(true))
@@ -2413,46 +2416,43 @@
24132416
msg += '?'
24142417
}
24152418

2416-
this._sendMsg(msg, true)
2419+
this.io(msg)
24172420
this.trigger('status', [CONST.STATUS_SEND_QUERY])
24182421
}
24192422

2420-
OTR.prototype.sendMsg = function (msg) {
2423+
OTR.prototype.sendMsg = function (msg, meta) {
24212424
if ( this.REQUIRE_ENCRYPTION ||
24222425
this.msgstate !== CONST.MSGSTATE_PLAINTEXT
24232426
) {
24242427
msg = CryptoJS.enc.Utf8.parse(msg)
24252428
msg = msg.toString(CryptoJS.enc.Latin1)
24262429
}
2427-
this._sendMsg(msg)
2428-
}
2429-
2430-
OTR.prototype._sendMsg = function (msg, internal) {
2431-
if (!internal) { // a user or sm msg
24322430

2433-
switch (this.msgstate) {
2434-
case CONST.MSGSTATE_PLAINTEXT:
2435-
if (this.REQUIRE_ENCRYPTION) {
2436-
this.storedMgs.push(msg)
2437-
this.sendQueryMsg()
2438-
return
2439-
}
2440-
if (this.SEND_WHITESPACE_TAG && !this.receivedPlaintext) {
2441-
msg += CONST.WHITESPACE_TAG // 16 byte tag
2442-
if (this.ALLOW_V3) msg += CONST.WHITESPACE_TAG_V3
2443-
if (this.ALLOW_V2) msg += CONST.WHITESPACE_TAG_V2
2444-
}
2445-
break
2446-
case CONST.MSGSTATE_FINISHED:
2447-
this.storedMgs.push(msg)
2448-
this.error('Message cannot be sent at this time.')
2431+
switch (this.msgstate) {
2432+
case CONST.MSGSTATE_PLAINTEXT:
2433+
if (this.REQUIRE_ENCRYPTION) {
2434+
this.storedMgs.push({msg: msg, meta: meta})
2435+
this.sendQueryMsg()
24492436
return
2450-
default:
2451-
msg = this.prepareMsg(msg)
2452-
}
2453-
2437+
}
2438+
if (this.SEND_WHITESPACE_TAG && !this.receivedPlaintext) {
2439+
msg += CONST.WHITESPACE_TAG // 16 byte tag
2440+
if (this.ALLOW_V3) msg += CONST.WHITESPACE_TAG_V3
2441+
if (this.ALLOW_V2) msg += CONST.WHITESPACE_TAG_V2
2442+
}
2443+
break
2444+
case CONST.MSGSTATE_FINISHED:
2445+
this.storedMgs.push({msg: msg, meta: meta})
2446+
this.error('Message cannot be sent at this time.')
2447+
return
2448+
case CONST.MSGSTATE_ENCRYPTED:
2449+
msg = this.prepareMsg(msg)
2450+
break
2451+
default:
2452+
throw new Error('Unknown message state.')
24542453
}
2455-
if (msg) this.io(msg)
2454+
2455+
if (msg) this.io(msg, meta)
24562456
}
24572457

24582458
OTR.prototype.receiveMsg = function (msg) {
@@ -2532,16 +2532,17 @@
25322532
if (send) {
25332533
if (!this.debug) err = "An OTR error has occurred."
25342534
err = '?OTR Error:' + err
2535-
this._sendMsg(err, true)
2535+
this.io(err)
25362536
return
25372537
}
25382538
this.trigger('error', [err])
25392539
}
25402540

25412541
OTR.prototype.sendStored = function () {
25422542
var self = this
2543-
;(this.storedMgs.splice(0)).forEach(function (msg) {
2544-
self._sendMsg(msg)
2543+
;(this.storedMgs.splice(0)).forEach(function (elem) {
2544+
var msg = self.prepareMsg(elem.msg)
2545+
self.io(msg, elem.meta)
25452546
})
25462547
}
25472548

@@ -2567,7 +2568,7 @@
25672568
msg += l1name
25682569

25692570
msg = this.prepareMsg(msg, filename)
2570-
if (msg) this._sendMsg(msg, true)
2571+
this.io(msg)
25712572
}
25722573

25732574
OTR.prototype.endOtr = function () {
@@ -2594,6 +2595,7 @@
25942595

25952596
}).call(this)
25962597

2598+
25972599
return {
25982600
OTR: this.OTR
25992601
, DSA: this.DSA

build/otr.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

changelog.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
0.2.11 / 2014-03-24
3+
===================
4+
5+
* update dev dependencies
6+
* option to attach meta data to outgoing messages
7+
* type 6 tlvs trigger an abort
8+
29
0.2.10 / 2014-02-04
310
==================
411

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "otr",
3-
"version": "0.2.10",
3+
"version": "0.2.11",
44
"description": "Off-the-Record Messaging Protocol",
55
"homepage": "https://github.com/arlolra/otr",
66
"main": "index.js",

0 commit comments

Comments
 (0)