Commit graph

26 commits

Author SHA1 Message Date
lilia
f23403f82b Fix arguments to sendMessageProto in tryMessageAgain
As ov ccc98d2 sendMessageProto takes a timestamp for the first argument,
in service of app-level delivery receipts.
2014-12-23 15:02:03 -08:00
lilia
f9e68be45b Don't refreshGroups in tryMessageAgain
This was intended to sync the group state of a recently re-installed
client, but is prone to overkill when we have a lot of old stale groups
around. Also this implementation incurs some rate limit errors from the
server.
2014-12-23 14:28:19 -08:00
lilia
1175f2ae3c Scratch that, reverse it. 2014-12-22 17:20:05 -08:00
lilia
8ed73d0ce5 Normalize send-path error handling
Receive and handle an array of errors in both the group and individual
cases.
2014-12-22 15:11:04 -08:00
lilia
ccc98d2f3d Fixup delivery receipts
Uses app-level timestamps for outgoing messages.
Adds timestamp property to the outgoing jsonData.
Triggers a runtime event to notify frontend on delivery receipts.
Renders delivered messages with a 'delivered' class.
2014-12-21 21:36:40 -08:00
lilia
348b5a53b1 Fixup OutgoingIdentityKeyError handling 2014-12-20 00:36:44 -08:00
lilia
4a401f07f3 Rewrite ReplayableErrors
ReplayableErrors make it easy for the frontend to handle identity key
errors by wrapping the necessary steps into one convenient little
replay() callback function.

The frontend remains agnostic to what those steps are. It just calls
replay() once the user has acknowledged the key change.

The protocol layer is responsible for registering the callbacks needed
by the IncomingIdentityKeyError and OutgoingIdentityKeyError.
2014-12-18 20:00:14 -08:00
lilia
b9859ad9d4 Add some license headers 2014-11-13 15:53:57 -08:00
lilia
9f676af9bb Refactor crypto.js and native client interface
NB: this diff is best viewed with --ignore-whitespace

Distills crypto.js down to the hard cryptoey bones. It pulls from
webcrypto for aes and hmac, and from native client for curve25519 stuff
or potentially another object implementing the handful of needed
curve25519 functions.

Everything else formerly known as crypto, including session storage and
management, axolotl, etc.. is now protocol.js. The separation is not
quite perfect, but it's a big step.

nativeclient.js now enables talking to the native client module through
a high level interface as well as registering callbacks that will be
executed once the module is loaded. And it has tests!

Finally, this commit removes all references to the "testing_only"
object, preferring to run tests on textsecure.crypto instead.
2014-11-06 04:33:43 -08:00
lilia
800e5ab703 Pass protobuf attachment ids as strings
Latest protobuf.js requires that we pass in the sign value when making
longs from strings, ex: dcodeIO.Long.fromString(id, true);

However, it does the string->long conversion automatically if its given
a string for a fixed64 field, so we can pass our string ids right in!
ftw
2014-10-29 23:18:29 -07:00
lilia
211129475c Fix attachment ids
Parse attachment ids out of the attachment pointer url and return them
as strings because the copy parsed by JSON suffers a loss of precision.
Convert them to and from the format expected by the protobuf using
facilities from decodeIO.Long.
2014-10-25 18:12:20 -07:00
lilia
1023ea1732 Refactor textsecure.protos -> textsecure.protobuf
DRY up protobuf declarations and move to a slightly briefer naming
convention.

Also dropped some ArrayBuffer -> string conversions as
ProtoBuf.js handles ArrayBuffers just fine, and in fact, more
efficiently than strings.

Finally, dropped the btoa() wrappers, because that incurs an extra
string -> string conversion before the protobuf's internal string ->
array buffer conversion. In lieu of btoa, we can simply pass in the
optional string encoding argument to the protobuf's decode method,
which in these cases should be 'binary'.

Related: #17
2014-10-20 15:11:16 -07:00
lilia
cc5327dbc9 Fix group loop
All the group messages were being sent to the last recipient in the
list, due to the persistence of `var number` in later loops and async
calls. An easy mistake to make, when you use for instead of each.
2014-10-18 15:00:43 -07:00
lilia
ac5c359053 Fix strange loop in sendMessageProto
Don't declare a new `var i`  within the scope of an existing `var i`.

Fixes #63
2014-10-17 16:57:33 -07:00
lilia
8288e298fc Group ids should be converted to ArrayBuffers for transport 2014-10-17 12:52:46 -07:00
lilia
5b0573293f Fix references to GroupContext Type ENUM values 2014-10-14 19:07:00 -07:00
Matt Corallo
c427da04f0 Add closeSession tests as Alice and fix re-requesting prekeys 2014-07-24 20:15:27 -04:00
Matt Corallo
0d4ae6a8cb Fix undefined variable in for's (browser update to strict mode?) 2014-07-22 21:33:35 -04:00
Matt Corallo
de83429962 v3 steps 2014-07-22 21:23:52 -04:00
Matt Corallo
12a849957a Refresh groups on (probably) new identity key (maybe more often?) 2014-06-05 22:28:30 -04:00
Matt Corallo
0f126fc0f8 Keep track of number->groups, add TODO to refresh, other tweaks 2014-06-05 21:05:42 -04:00
Matt Corallo
e495e8e3db Group updates to match real protocol and get better checking 2014-06-05 19:20:09 -04:00
Matt Corallo
c90b9a5c59 Some group update verification 2014-06-03 22:23:51 -04:00
Matt Corallo
b1ec02fa92 Group API 2014-06-03 21:09:04 -04:00
Matt Corallo
c953c6c16d closeSession 2014-06-03 17:44:30 -04:00
Matt Corallo
d0fd3e94d8 sendMessage refactor, initial group stuff (breaks message storage) 2014-06-03 15:28:30 -04:00