Commit graph

500 commits

Author SHA1 Message Date
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
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
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
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
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
cd55c0a1f1 Put groupid back in id field also 2014-10-17 14:32:37 -07:00
lilia
0bd5f3e3c2 If for some reason a group has no name, provide a default 2014-10-17 13:25:39 -07:00
lilia
0036e4ef74 Store group ids as strings 2014-10-17 13:11:08 -07:00
lilia
8288e298fc Group ids should be converted to ArrayBuffers for transport 2014-10-17 12:52:46 -07:00
lilia
143254cec8 Group ids are stored in groupId 2014-10-16 17:50:36 -07:00
lilia
bbe57ef0bf Stringify incoming group ids
Otherwise when we try to make their local storage keys they look like:
"egroupByteBuffer(offset=4,markedOffset=-1,length=28,capacity=112)"
2014-10-16 17:39:45 -07:00
lilia
4f21bbd21f Use textsecure.messaging to create groups
Not textsecure.storage. Sigh. Also accomodate the fact that
the group id is not returned directly, but rather at the end
of a promise chain.
2014-10-16 14:15:13 -07:00
lilia
fa4c385598 Make initial timestamp on a thread match the 1st message 2014-10-16 14:13:03 -07:00
lilia
f14cd2eed1 Don't validate presence of thread id
It's undefined until the first save();
2014-10-16 14:11:51 -07:00
lilia
7e9c0e2394 Group ids should be strings (or stringables)
ArrayBuffer was a bad choice.
2014-10-16 13:38:33 -07:00
lilia
6db3eeb52e Convert incoming timestamps into numbers
Fixes #59

protip: don't use << for anything over 2^32. The operands of all bitwise
operators are converted to signed 32-bit integers
2014-10-16 12:32:02 -07:00
lilia
d7edfd4efb Remove reference to undefined function 2014-10-15 18:10:27 -07:00
lilia
43f4f6cf99 Open a group's view after it's created 2014-10-14 21:35:40 -07:00
lilia
320d1f18ae Fix exception when protbuf-encoding groupIds
An exception is thrown when protobuf tries to encode a number as the
group id, which is declared to have type 'bytes'.

Fix by make it an ArrayBuffer instead, and increase the length to 16,
which is what the Android client uses:

c632b32ff8/src/org/thoughtcrime/securesms/database/GroupDatabase.java (L222)
2014-10-14 19:33:33 -07:00
lilia
5b0573293f Fix references to GroupContext Type ENUM values 2014-10-14 19:07:00 -07:00
lilia
01f9fc1f17 More frontend groups fixes 2014-10-14 19:06:35 -07:00
lilia
e89e691957 Fix bug in groupId generation
Previously, if calling createNewGroup with an undefined groupId,
no groupId was generated.

This occurred because no entry for "group" + undefined exists in
localStorage, which caused this code to think undefined was a
valid group id.

Fixed by adding `|| groupId == undefined` to the while clause.
Also decoupled the groupId collision check for clarity.
2014-10-14 15:47:51 -07:00
lilia
dc41ebf701 Small frontend fixes for the new group view 2014-10-14 15:47:51 -07:00
lilia
2bd77693e1 Refactor options page and style using bootstrap 2014-10-14 13:59:43 -07:00
lilia
81e4af5827 Move phonenumbery utils to libphonenumber object
Slowly whittling away at helpers.js...
2014-10-13 22:49:39 -07:00
lilia
9fc14cfa30 Remove erroneous comment re: MDN copyright
In fact, the code samples we have copied from MDN are declared to be
public domain (see link below):

  "Code samples added on or after August 20, 2010 are in the public
  domain."

https://developer.mozilla.org/en-US/docs/MDN/About#Copyrights_and_licenses

AFAICT we're using code from this page, last updated 10/4/14:
https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
2014-10-10 17:25:40 -07:00
lilia
75e78caec8 Function-wrap options.js 2014-10-10 16:58:44 -07:00
lilia
683c373943 Relaxes verification code validation
When codes are sent they are formatted as xxx-xxx. Previously when I
would paste these from GVoice they failed validation thanks to the dash
and whatever whitespace I happened to grab.
2014-10-10 16:32:22 -07:00
lilia
27708cd8d7 Switch to staging. -ca is now production 2014-10-10 16:32:15 -07:00
lilia
0f4b53c176 Update records list in BBLocalStorage on fetch
Previously, would only update the known messages.
2014-10-09 20:08:28 -07:00
lilia
2288f8adc1 Fix new group ui not showing 2014-10-09 19:02:52 -07:00
lilia
266600e5ab There's no need to wrap this function inside a function afaict 2014-10-09 18:54:23 -07:00
lilia
ae98b8680f Fix whitespace in popup.js
Our official standard is 4 space indentation.
2014-10-09 18:43:58 -07:00
lilia
ef066ea9d2 Make conversations open when they are created 2014-09-04 00:21:18 -07:00
lilia
230d24a69e Views already have a #remove() 2014-09-04 00:21:02 -07:00
lilia
db86abdf70 Add list view tests
Also,
 * moved fetch out of the list view
 * removed unused #last() function
 * put test setup lines in their own tiny file.
 * added data-cover to view script tags for code coveage reports.
2014-09-04 00:18:15 -07:00
lilia
ad7456b367 Refactor away this poorly named and overloaded file 2014-08-31 18:18:13 -07:00
lilia
b9640a54bd Move new convo stuff to its own file 2014-08-31 18:02:39 -07:00
lilia
9af18ce6ae Encapsulate page layout js
The layout class is the only class that should have knowledge of
page-level constant markup, such as #gutter and #contacts, and
should be pretty much the only place we find elements by id (with
the exception of template elements).

This change removes references to #gutter from views. Rather than
hardcoding assumptions about page layout, view elements should
ask the layout to insert themselves into the main content area by
calling Whisper.Layout.setContent.
2014-08-31 17:46:01 -07:00
lilia
5ddcc516e4 remove extra insertion, it's already happening 2014-08-25 19:01:18 -07:00
lilia
2f0b0f7a1b Get overflow scrolls working
Had to resort to a resize event handler.
A bit slow at times, but it works.
2014-08-25 19:01:13 -07:00
lilia
546cdf82cb Fix some markup issues
* Remove spurious search div
* Fix nested uls
* Use class name selected, not closed (the inverse)
* Restor nacl div
2014-08-25 18:59:22 -07:00
lilia
c2beda8e40 Get single recipient message composition working again 2014-08-25 18:55:51 -07:00
lilia
c034ac8267 Refactor components for the main content section
Each conversation views now manages its own separate elements
rather than all binding to a shared #conversation element, and
similarly for message composition ui.

Also includes the beginnings of group creation UI (not working yet),
featuring bootstrap-tagsinput field for entering group recipients
2014-08-25 18:54:55 -07:00
lilia
8d83a8fb27 This element is constant, so let's bootstrap it 2014-08-25 18:48:12 -07:00
lilia
5f74a60364 Format thread timestamps 2014-08-25 18:48:12 -07:00
lilia
44f272a181 Get messages sending with new ui
Also convert index.html to 4-space indentation.
2014-07-27 15:04:12 -10:00
lilia
95c31629b7 get frontend rendering with new markup/css 2014-07-27 12:16:58 -10:00
lilia
850a91c77d Fix message sending 2014-07-27 11:35:49 -10:00
lilia
0741c74618 Don't recreate views unnecessarily
Let ConversationListItemView save a reference to its corresponding
ConversationView. This lets it render or delegate/undelegate events
when opening and closing a conversation.

Similarly for ConversationView itself, which contains a MessageListView.
2014-07-27 11:35:49 -10:00
lilia
9d0be46a53 Close an open conversation before opening another 2014-07-27 11:35:49 -10:00
lilia
bbb5d56516 Don't reopen a currently selected conversation 2014-07-27 11:35:49 -10:00
lilia
98cfc1b701 Remove old convo compose view 2014-07-27 11:35:49 -10:00
lilia
511b121a2f Refactor conversation view into two classes
One that resides in the left hand column as a list item, and another
which displays in the main column and handles ui events therein.
2014-07-27 11:35:49 -10:00
lilia
6ff6ef07a9 Parse the template before binding render to an event 2014-07-27 11:35:49 -10:00
lilia
d615a5a18b Let list view changes the color of selected conversations 2014-07-27 11:35:49 -10:00
lilia
dc957415c2 Cull dead code
Most of this no longer needed because of templating and list views.
2014-07-27 11:35:49 -10:00
lilia
9082781e09 Make header and footer/form work without overflowing 2014-07-27 11:35:49 -10:00
lilia
df95a7f71a Move ui init out of nacl callback and remove some lines that no longer apply 2014-07-27 11:35:49 -10:00
lilia
def32f42d4 New layout/design
Two column layout and style tweaks. Templatized conversation views.
Generalized list view.
2014-07-27 11:35:48 -10:00
lilia
6d5e32bca8 Don't make a new collection on every call to thread.messages() 2014-07-27 11:35:48 -10:00
lilia
7e20838128 Rename file 2014-07-27 11:35:48 -10:00
lilia
4724c96ecb Use $.find so these locals can go away 2014-07-27 11:35:48 -10:00
lilia
2e3d89ef78 Use mustache template for message rendering 2014-07-27 11:35:48 -10:00
lilia
25fecc949e Condense some code using Backbone.View's event framework 2014-07-27 11:35:48 -10:00
lilia
06ff6c3087 Let thread collection double as contacts db
When a thread is 'destroyed' from the UI we delete its messages and mark
the thread as inactive, (in other words, keep it around as contact info).
Additionally, we only load active threads when initializing the UI, and
reactivate threads when new messages are added to them.

Conflicts:
	js/models/messages.js
	js/models/threads.js
	js/views/conversations/show.js
2014-07-27 11:35:48 -10:00
lilia
c6b79236d9 Fix whitespace, lint 2014-07-27 11:35:48 -10:00
lilia
ebf1b3352f Use separate message collections for each thread to facilitate lookup and lazy loading 2014-07-27 11:35:48 -10:00
Matt Corallo
d6d17eaf19 Remove unused function 2014-07-27 02:33:17 -04:00
Matt Corallo
3696214edc Add missing localStorage.clear() 2014-07-27 02:30:00 -04:00
Matt Corallo
28779e0b35 Fix tests by returning promises 2014-07-27 02:05:25 -04:00
Matt Corallo
90eb9cb0c8 Remove ping, update to latest spec proposal 2014-07-26 18:15:24 -04:00
Matt Corallo
f6f35c5b61 Fix a missing function and dont blow up on delivery receipts 2014-07-26 01:53:24 -04:00
Matt Corallo
d9f53d4c01 Fix not-allowed inline scripts error 2014-07-26 01:37:47 -04:00
Matt Corallo
a6b0d1f84b Add entirely untested secondary device init 2014-07-26 01:32:05 -04:00
lilia
2751d0e884 Such tests. Very mocha. Much chai. Amaze!!!
ERHMAGERRRD testing frameworks are so the best. Removed all our custom
code for ensuring test exclusivity and doneness and isolating callbacks
and everything. mocha does it all for us, and makes it pretty.

Also rather than return a long chain of promises that eventually resolve
to truthiness, we now use chai to make assertions about what is good and
right in the world.

Recommended reading:
  https://visionmedia.github.io/mocha
  http://chaijs.com/api/assert/
2014-07-25 18:01:19 -10:00
Matt Corallo
6455da5c9a Refactor a bunch of stuff re: session closing, add test cases 2014-07-25 19:55:49 -04:00
Matt Corallo
c427da04f0 Add closeSession tests as Alice and fix re-requesting prekeys 2014-07-24 20:15:27 -04:00
Matt Corallo
6f3ee151f3 Add a BOB test-case around session closure 2014-07-24 17:11:53 -04:00
Matt Corallo
a6426194ef Update BOB test cases 2014-07-24 06:42:41 -04:00
Matt Corallo
957587bd9a Add identity keys to MAC, begin updating test cases 2014-07-24 06:29:11 -04:00
Matt Corallo
eab0911d3d I lied, there is no verification tag 2014-07-24 05:14:38 -04:00
Matt Corallo
85f33345ab Move test shuffling to js/testvectors.js 2014-07-23 20:29:45 -04:00
Matt Corallo
0088721343 Move AXOLOTL test vectors to js/testvectors.js 2014-07-23 18:22:16 -04:00
Matt Corallo
07f79cb4bf Fix tester 2014-07-23 03:59:22 -04:00
Matt Corallo
7013c5e031 First steps towards BOB test vectors 2014-07-23 03:57:50 -04:00
Matt Corallo
ebcfd4736e Fix session lookup in duplicate prekeymessage case 2014-07-23 03:36:11 -04:00
Matt Corallo
5040bfbe44 Fix pending verifications 2014-07-23 02:53:31 -04:00
Matt Corallo
a76ae2f1f8 Add verification tags, make alice tests strict(ish) again 2014-07-23 02:49:47 -04:00
Matt Corallo
287b55120d First cut of ALICE test vectors 2014-07-23 01:49:13 -04:00
Matt Corallo
a8908646aa Fix null flags in v3 2014-07-22 21:38:48 -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
66bf371aa7 Use staging server (ie update to server keys v2) and protocolv3 2014-07-22 21:23:35 -04:00
Matt Corallo
53f8ac9ad9 Generate signed keys (breaks registration) 2014-07-22 21:23:35 -04:00
Matt Corallo
4c3ee6f23b Compare equality w/o getString (in the future) 2014-07-22 21:23:35 -04:00
Matt Corallo
3190fe97f9 HMAC Update for Protov3 2014-07-22 21:23:35 -04:00
Matt Corallo
b5c6e3d101 JS ed25519 2014-07-20 16:49:40 -04:00
Matt Corallo
b94ba6b726 USE_NACL = true 2014-07-20 16:49:40 -04:00
Matt Corallo
7d27df9868 Report testing done 2014-07-20 16:29:42 -04:00
Matt Corallo
a2da4fffb0 Remove useless function 2014-07-17 18:13:32 -04:00
Marco
13a9329bcf improved number validation (based on google's libphonenumber) 2014-06-29 16:39:05 -07:00
Matt Corallo
92514ad08f Fix missing baseKey 2014-06-09 20:27:09 -04:00
Matt Corallo
ceca03c5d0 Close chainKey.key 2014-06-09 20:27:09 -04:00
lilia
ce3c5eb909 Refactor conversation list view
Pull apart UI classes for displaying and creating threads.
Also get rid of ugly alert popup in favor of Whisper.notify.
2014-06-07 16:31:40 -07:00
Matt Corallo
1ec6b0aed6 Better TODO wording 2014-06-05 22:34:01 -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
lilia
ec900e0ea4 Fix double display of outgoing messages 2014-06-03 20:05:41 -07:00
lilia
a09a4776d3 Fix incoming message display/storage
There were a few problems.

1. The message event was being triggered in background, not popup
2. The initial message/thread fetches from localStorage were mis-ordered
3. The timestamp wasn't being extracted from the right place
4. #3 caused messages to fail validation and not be saved

1-3 are fixed. To address 4 I switched validate() to log a warning
instead of preventing save.
2014-06-03 19:57:03 -07: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
Matt Corallo
fb2aa6144c Merge pull request #45 from codedust/extractchrome
moved some chromium-specific code into chromium.js
2014-06-02 00:41:51 +00:00
Marco
5cddcb59aa improved some css for options.html 2014-06-01 22:31:19 +02:00
Marco
69ba6581b0 moved some chromium-specific code into chromium.js (using extension.navigator namespace) 2014-06-01 21:33:58 +02:00
Matt Corallo
cf35b7056f Retry API, standardize <script> list 2014-06-01 13:39:35 -04:00
Matt Corallo
8f49d201e6 Fix longstanding(?) attachment bug 2014-05-31 13:33:41 -04:00
Matt Corallo
c2d1d816f2 Save sessions in deviceObjects, test using fake_api, minor tweaks 2014-05-31 13:28:46 -04:00
Matt Corallo
1724d122d3 More typos from me being too tired 2014-05-28 04:33:01 +02:00
Matt Corallo
5cea7b6857 Few typos blocking registration 2014-05-28 04:03:23 +02:00
Matt Corallo
eb80a10ed1 Fix new function(){}() typo (thanks codedust on GitHub) 2014-05-28 03:53:43 +02:00
Matt Corallo
aec36468bc Request new keys (largely untested) 2014-05-28 03:45:40 +02:00
Matt Corallo
56433bd9af One more tiny error refactor 2014-05-28 03:45:40 +02:00
Matt Corallo
68131a6e2a Add human readable version of errors 2014-05-28 03:45:40 +02:00
Matt Corallo
753a950816 Redo registration process 2014-05-28 03:45:40 +02:00
lilia
83508abab8 Thread model and UI improvements
Adds thread model/collection for managing conversation-level state, such
as unreadCounts, group membership, thread order, etc... plus various UI
improvements enabled by thread model, including an improved compose
flow, and thread-destroy button.

Adds Whisper.notify for presenting messages to the user in an orderly
fashion. Currently using a growl-style fade in/out effect.

Also some housekeeping:
Cut up views into separate files.
Partial fix for formatTimestamp.
Tweaked buttons and other styles.
2014-05-26 15:33:45 -07:00
Matt Corallo
2d12a33ead Fix decoding/protos/tests 2014-05-26 01:48:41 +02:00
Matt Corallo
ac48d552fa Fix some bugs recently introduced 2014-05-26 00:45:55 +02:00
Matt Corallo
21b95ce1d3 Re-create some of d9bf0a4, which was broken and reverted in 1e6720 2014-05-26 00:45:55 +02:00
Matt Corallo
18f1eed70f Some number verification refactor stuff 2014-05-26 00:45:55 +02:00
Matt Corallo
d387cd22f5 s/getEncodedNumber// (with XXXs) 2014-05-26 00:45:55 +02:00
Matt Corallo
9aae93fc99 textsecure.protos 2014-05-26 00:45:55 +02:00
lilia
1e672030de Fix a couple things broken in d9bf0a4
Slight revert from said commit. We really do need the
IncomingPushMessageSignal protobuf at the UI layer, mostly because
it contains the 'source' attribute, without which we don't know
who sent the message.

Also fix a crash when there are no attachments on a message.
2014-05-22 21:59:34 -07:00
lilia
de0a1df3ca Fix broken registration flow
Better load the functions defined in chromium.js before trying to use
them. Hmm.. also, options.js should probably wait for the DOM to load
before it tries to initialize things in it.
2014-05-20 21:39:29 -07:00
Matt Corallo
d9bf0a41fb textsecure.storage, chromium.js 2014-05-20 22:21:07 -04:00
Matt Corallo
ee2f43aba4 Fix, display (image) attachments 2014-05-19 03:07:01 -04:00
Matt Corallo
be82547ea1 Move message saving out of helpers.js 2014-05-18 19:50:30 -04:00
lilia
3bd559bbaa DRY up PushMessageContentProtobuf construction
Messages now know how to protobuf-ify themselves.
2014-05-18 14:33:18 -07:00
lilia
2601c3cc3a Rename some things to be a little more semantic
The 'sender' field actually holds the recipient for outgoing
messages. Rename that field to 'person', indicating the 2nd
party generically.

Also decouples the thread name from thread recipients at the
view layer, in preparation for group support.
2014-05-18 13:49:11 -07:00
Marco
14ebef70cb fixed 'TypeError: Promise.resolve is not a constructor' in Firefox 2014-05-18 21:58:53 +02:00
lilia
810aabf2a6 Save messages from 'Compose' UI 2014-05-17 20:42:08 -07:00
lilia
b852e68290 Backbone message storage and views
Adds Backbone-based Whisper.Messages model/collection with local storage
extension. Saves sent and received messages in Whisper.Messages instead
of message map. This will assign a unique id to the message and save it
to localStorage.

Adds Backbone-based view to popup.html
  Automatically updates itself when new messages are saved to
  Whisper.Messages db from the background page.

Added some shiny new styles, and started splitting up css into multiple
files for sanity's sake.
2014-05-17 20:26:50 -07:00
lilia
170257dafb Fix subscribeToPush is not defined 2014-05-17 14:15:13 -07:00
lilia
ed3aa9667d Fix undefined URL_BASE in background.js
Sieze an opportunity to move code out of the helpers.js.
Only 616 more lines to go.
2014-05-17 14:02:35 -07:00
Matt Corallo
4efb8a2616 Fix NaCL (maybe it should be removed?) 2014-05-17 01:55:32 -04:00
Matt Corallo
6bc19ef558 More namespacing 2014-05-17 01:53:58 -04:00
Matt Corallo
05101b69b0 Some initial helpers.js namespaceing 2014-05-17 00:54:12 -04:00
Matt Corallo
07a23f0759 Fix attachments 2014-05-15 01:02:15 -04:00
Matt Corallo
3103eaa192 Commit broken attachment loader (S3 403s I can't figure out...) 2014-05-15 00:26:37 -04:00
Matt Corallo
ea1bd535dc Fix interpretation of prekeymsg.registrationId 2014-05-14 23:26:46 -04:00
Matt Corallo
2f16b884a5 Fixup last commit 2014-05-14 18:26:07 -04:00
Matt Corallo
e3097746c0 Check registration ID on prekeymsg 2014-05-14 18:15:46 -04:00
Matt Corallo
76e7dcb77d Clean up session retreival (fixes #30) 2014-05-14 17:21:54 -04:00
Matt Corallo
8d408e6d8f THOUGH SALL USE TABSTOP AND SHIFTWIDTH 4 (so that indents read right) 2014-05-14 17:21:49 -04:00
Matt Corallo
ae41a5df71 Merge remote-tracking branch 'lilia/master' 2014-05-14 17:21:40 -04:00
Matt Corallo
d5491bda0b Stop an attacker from closing a session that isn't theirs (#29) 2014-05-14 14:27:08 -04:00
Matt Corallo
3a812d4958 Multi-session storage for close/regular message race conditions 2014-05-14 05:10:05 -04:00
Matt Corallo
cdebc8afb4 Also delete chain key 2014-05-14 03:33:24 -04:00
Matt Corallo
08093a206d Fix old chain deletion 2014-05-14 03:02:47 -04:00
Matt Corallo
605863ffa3 Fix decryption of large messages (eg w/ attachments) 2014-05-14 02:08:01 -04:00
lilia
e3b00e08f3 Generate and submit registrationId, fixes #25
If we're expecting to get registrationIds from others, it's only fair
that we also supply our own.
2014-05-13 20:10:30 -07:00
Matt Corallo
5752a772d1 promises, type conversion errors 2014-05-13 15:15:45 -04:00
Matt Corallo
caa363b929 FINALLY report crypto, etc errors to console thanks to promises... 2014-05-13 04:40:29 -04:00
Matt Corallo
a7de5e2159 last(?) round of crypto.js AB-type-conversion changes, new tests 2014-05-13 01:52:25 -04:00
lilia
1d95fcc027 Fix exception in options.js on first run
Fixes #22 Uncaught ReferenceError: getRandomBytes is not defined
options.js:41
2014-05-12 13:45:52 -07:00
Matt Corallo
5583e82a20 Refactor some low-level crypto things 2014-05-09 03:43:23 -04:00
Matt Corallo
905357a2e1 More wholesale conversion to promises 2014-05-09 03:20:54 -04:00
Matt Corallo
efe2fa1021 Move crypto things to js/crypto.js 2014-05-09 02:00:49 -04:00
Matt Corallo
2b21111d7b Fix/test pre key generation 2014-05-09 01:35:16 -04:00
Matt Corallo
3fffbad11a Fix now-broken test cases and change lots of things over to promises 2014-05-06 23:46:32 -04:00
lilia
41d50d7480 Lilia's Webcrypto branch rebased and a few very tiny tweaks 2014-05-06 23:45:55 -04:00
Matt Corallo
1137f9d711 Add TODO file showing what still needs to be done 2014-05-04 17:07:25 -04:00
Matt Corallo
138581701c tweak ui things a tiny bit 2014-05-04 02:50:34 -04:00
Matt Corallo
3e60368a16 LGPL license (I'd like to be an axolotl/TS JS lib in the future) 2014-05-04 02:34:13 -04:00
Matt Corallo
01c4f3dd56 Fix ALL the things! 2014-05-04 02:21:31 -04:00
Matt Corallo
d213cb0598 I like stack traces, also, fix identity key bit fiddle crap 2014-05-04 02:21:31 -04:00
Matt Corallo
705f8ce818 generic-ize 2014-05-04 02:21:31 -04:00
Matt Corallo
87c19c0c94 Another step forward 2014-05-04 02:21:31 -04:00
Ventero
3d7db4dbc3 Correctly extract string data for password.
btoa expects a string argument, so when passing it the ArrayBuffer
object returned by getRandomBytes(), it's converted to a string by
calling .toString() on it. This always results in "[object ArrayBuffer]",
effectively resulting in a completely non-random password.
2014-04-17 15:56:50 +02:00
Matt Corallo
cf79b41cc4 Merge pull request #8 from liliakai/master
Fix click handler
2014-04-09 02:07:28 -04:00
lilia
68027dadd4 Fix click handler
var i was being bound in the closure of this click handler, then
incremented by the for loop, such that its value was 1 by the time the
handler was called, so we were grabbing the message body from, e.g.
$("#input1") when we wanted $("#input0").
2014-04-08 23:03:34 -07:00
Matt Corallo
d56c3e1051 Add bit for !identityKey and commit wip test-cases 2014-04-07 13:11:01 -04:00
Matt Corallo
244aa8df92 Fix NaCL priv calc code 2014-04-07 13:11:01 -04:00
lilia
984a76eeb1 Fix crashing send button
destinations is dead. all hail group.members.
2014-04-06 14:26:38 -07:00
lilia
49cdf04065 Work on message styling
Replicates some styles from the android app.
2014-04-06 14:26:09 -07:00
Matt Corallo
e492aae172 Fix popup refreshing on send 2014-04-04 05:50:46 -04:00
Matt Corallo
732f9ac089 ping server to keep connection open 2014-04-04 04:47:04 -04:00
lilia
a67ab3a46f Make popup a little nicer to look at
Also add a little auto-suggestion contacts list. For now it just
contains your own number.
2014-04-02 23:11:34 -07:00
Matt Corallo
2ae5628122 Send-to-self works =D 2014-03-26 15:05:09 -04:00
Matt Corallo
136a8941c1 Things:
* key API changes moxie made because he disliked the other API
 * remove atmosphere
 * Fix some bugs in the send path, update for new send API
 * Send HTML
2014-03-25 15:27:19 -04:00
Matt Corallo
000a5e1440 Fix up a few things so registration works 2014-03-23 13:19:53 -04:00
Matt Corallo
832daf54db tabstabstabstabstabs 2014-03-22 18:45:01 -04:00
lilia
be52e4c3a4 Fix infinite recursion in ensureStringed(Array)
To ensureStringed(thing), you must first ensureStringed(thing)...
This was causing an infintel loop in multidevice mode.
2014-03-20 00:57:29 -07:00
lilia
fe1b5435aa Add FakeWhisperAPI for serverless development
When included after api.js, fake_api.js inits a FakeWhisperAPI.

FakeWhisperAPI inherits the methods of API, overrides a few, and
then usurps its place as the one true API.

Single device mode successfully "registers" against FakeAPI. Sadly,
multidevice mode has a recursive loop somewhere that makes the callstack
asplode.
2014-03-20 00:57:29 -07:00
lilia
6934ba0b92 Refactor Server API functions
The details of the server API are now mostly relegated to api.js, and
accessed through the API container object, improving modularity and
readability, and setting us up to derive a FakeAPI for serverless
development.
2014-03-15 19:57:40 -07:00
Matt Corallo
1c20dba67f Merge pull request #2 from liliakai/master
Make booleans stringable
2014-03-11 11:13:34 -07:00
lilia
0d5d14da6a Fix the clickies 2014-03-10 22:53:06 -07:00
lilia
820d67a0ba Avoid jsonifying undefined data
For example, when requesting a verification code, there is no JSON data
to send.
2014-03-10 19:09:10 -07:00
lilia
0fff393ebf Make booleans stringable
Fixes "unsure of how to jsonify object of type boolean",
e.g., supportsSms: false
2014-03-10 15:50:28 -07:00
Matt Corallo
fee6a69083 Optional curve25519 in js 2014-03-09 20:32:00 -04:00
Matt Corallo
85f419b923 Passing test-cases (fscking type conversions...) 2014-03-08 20:23:24 -05:00
Matt Corallo
e932536dfd Untested send-encrypted support 2014-03-08 19:15:36 -05:00
Matt Corallo
fe570c754a Genericify initSession (and break it for alice) 2014-03-08 19:08:40 -04:00
Matt Corallo
611d5329d3 Pass tests 2014-03-08 00:13:53 -04:00
Matt Corallo
6e0fe271ab Few more steps 2014-03-06 17:44:59 -04:00
Matt Corallo
465bdf2bd3 Abstract out lots of CryptoJS 2014-03-06 15:01:23 -04:00
Matt Corallo
dd3dd11b32 Updates, more tests, etc 2014-03-06 14:18:11 -04:00
Matt Corallo
da1b021972 Fix up initial ratchet stuff 2014-03-06 00:17:09 -04:00
Matt Corallo
3c603c72b4 Lots of updates post-test-cases 2014-03-04 21:31:15 -04:00
Matt Corallo
e0d0df3b4a ECDHE through NaCL 2014-01-22 07:37:14 +00:00
Matt Corallo
8db3885659 Updates, NaCL 2014-01-22 06:23:41 +00:00
Matt Corallo
eec4c66ef6 Fixup dir structure 2014-01-22 03:28:35 +00:00