Commit Graph

8489 Commits

Author SHA1 Message Date
lilia e156c2c0dd Use jquery with native transport support
The jquery mainline is lagging on support for responseType:
'arraybuffer', an XHRHTTPRequest Level 2 feature (whatever that means).
We use this responseType to transfer attachments.

I rebased https://github.com/jquery/jquery/pull/1525 on the 2.1.1
release and cut 2.1.1-ajax-nativetransport in my own fork.
2014-10-30 01:32:27 -07: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 73f4f64351 Grunt preen and concat
Set up grunt with tasks for:
  * preen - deletes unused files from bower_components, configured in
      bower.json
  * concat - concatenates preened bower components, configured
      automagically from the preen config

It's worth noting that this setup assumes the order of files within a
package doesn't matter. This is usually true since we often include only
one file from the package.
2014-10-29 20:50:51 -07:00
lilia c8ad65efe0 Switch to bower dependencies
Checks in only the files we actually need from bower_components.
2014-10-29 20:50:51 -07:00
lilia 9c568ed0b8 Don't warn on missing message bodies
A message can be blank if it has an attachment
2014-10-29 20:50:51 -07:00
lilia df0eaf622a Clean up test files
Moved all test code into /test. Renamed test.js to crypto_test.js.
(Let's try to keep test files topical.) Merged test_views.html and
test.html into a single test/index.html.

Todo: use Grunt to generate test/index.html from index.html and files
found in /test. Also, write more tests.
2014-10-29 16:05:51 -07:00
lilia 987744cd79 Default avatars
Someday you'll be able to edit your avatar. Until then, put a bird on
it.
2014-10-29 16:05:51 -07:00
lilia 245dc5b248 Update message view test 2014-10-29 12:53:54 -07:00
lilia cb89ac1071 Fix view test nacl path 2014-10-28 22:53:26 -07:00
lilia 2a7d3996bb Remove unused popup.html
And popup.js is now index.js, illustrating its importance as the titular
javascript file.
2014-10-28 22:47:48 -07:00
lilia 1c76c0b546 Move storage objects to their own files
Greatly reduce the size of the ignominiously named helpers.js.
2014-10-28 22:47:48 -07:00
lilia b92c5bb84e Unused function 2014-10-28 19:15:01 -07:00
lilia ddd6f1a944 remove another unused function 2014-10-27 02:09:46 -07:00
lilia 80e3fadcb1 Remove unused *MACWithVersionByte functions 2014-10-26 21:27:08 -07:00
lilia 39505c81b1 Finish up webcrypto integration, Fixes #72
We now correctly and opportunistically use the webcrypto API if
available, polyfilling if it's not detected. This change also includes a
layer of abstraction over the webcrypto interface so we no longer have
to deal with key-imports or algorithm names all over the place. Since we
no longer support AES-CTR, code outside this file can simply call
`textsecure.subtle.<encrypt|decrypt|sign>(key, data [, iv])`.
2014-10-26 20:29:10 -07:00
lilia 244e051fc3 Add importKey to webcrypto.js 2014-10-26 15:54:19 -07:00
Matt Corallo 37ef492642 Remove now-broken axolotl test 2014-10-26 03:44:55 -07:00
Matt Corallo 2e7b5b46e3 Remove AES-CTR entirely 2014-10-26 03:41:11 -07:00
Matt Corallo da0c63fb1b Add (untested) AES-CBC switch from v3 (fs loss resulted in old tested version being lost) 2014-10-26 03:40:00 -07:00
Matt Corallo 3a39602385 Fix borked spacing in webcrypto.js 2014-10-26 03:23:34 -07:00
Matt Corallo 73f867f7de rm useless GPL, license testvectors under X11 (ie 3-c MIT + advertising provision) 2014-10-26 02:59:59 -07:00
Matt Corallo 68a42a6ae7 Give up on webcrypto :( 2014-10-26 02:46:13 -07:00
lilia 21225b2074 Save outgoing attachments 2014-10-26 00:30:20 -07:00
lilia 3334504eff render attachments 2014-10-26 00:30:20 -07:00
lilia b69db59ad4 Fix buffer concatenation
TypedArray.prototype.set doesn't handle ArrayBuffers correctly (it
writes all zeros). Instead, wrap each ArrayBuffer in a typed array
for concatenation.
2014-10-25 23:07:14 -07:00
lilia e07759a93c Fix CBC encryption, test 2014-10-25 20:45:21 -07:00
lilia e35148add8 No, jQuery, don't processData!
processData (default: true)
Type: Boolean
By default, data passed in to the data option as an object (technically,
anything other than a string) will be processed and transformed into a
query string, fitting to the default content-type
"application/x-www-form-urlencoded". If you want to send a DOMDocument,
or other non-processed data, set this option to false.

https://api.jquery.com/jQuery.ajax/
2014-10-25 19:48:54 -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 eebb14599f Well that's handy 2014-10-25 18:12:07 -07:00
lilia 674b173c59 Add support for cbc encryption 2014-10-24 19:09:58 -07:00
lilia 229007040c Basic frontend support for image attachments 2014-10-24 18:53:55 -07:00
lilia d362d0d978 Autoscroll conversation views
Scroll to the bottom (most recent) message in the conversation when it
is opened, when we send a message, and when we receive a message.
2014-10-24 14:49:42 -07:00
lilia 4675cdf3f2 Webcrypto won't go down without a fight
Turns out that assigning a new object to window.crypto.subtle
is not so easy. That's probably a good thing.
2014-10-23 21:30:36 -07:00
lilia a4b25f7df1 Disable the real webcrypto
Sadly, we are not quite compliant with the WC3 webcrypto spec
due to our insistance on passing around key data in plain old
ArrayBuffers.

Also converted whitespace.
2014-10-23 21:15:27 -07:00
lilia c6aae62151 Small message form tweaks 2014-10-22 18:28:40 -07:00
lilia d67b723f4f Highlight the selected thread 2014-10-22 17:26:37 -07:00
lilia 19dac1f3df Decorate incoming group messages
with numbers and image placeholders, so you know who's saying what.
2014-10-22 16:30:27 -07:00
lilia 78166365c7 Fix new message number validation 2014-10-22 16:07:16 -07:00
lilia 838283f28b Send acks instead of closing and opening the socket
Hopefully the real fix for #67 until we get protocol-level pings from
the wc3 api.
2014-10-22 12:38:30 -07:00
lilia 6e2a85ccf1 wip new message phone number validation 2014-10-22 12:05:33 -07:00
lilia e831c649bd Require a mandatory websocket reset once a minute
Compensate for the lack of keepalives in the WebSocket API.

Fixes #67
2014-10-21 19:57:53 -07:00
lilia a3bf40e852 Shorten websocket time out. Fixes #67 2014-10-21 14:26:14 -07:00
lilia 3a00e49791 Open the most recent conversation on load 2014-10-20 17:49:41 -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 03cc667e48 Standardize some whitespace
The preferred style is 4 spaces.
2014-10-20 15:09:36 -07:00
Arnaud Benard e568e2c528 Fixes #61 - Order by timestamps with tests 2014-10-20 02:07:46 -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
liliakai 1571868520 Merge pull request #66 from aprescott/initial-setup-instructions
Add some initial development setup instructions
2014-10-17 17:42:50 -07:00
Adam Prescott ea85e41cac Add some initial development setup instructions. 2014-10-17 20:37:35 -04: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