Commit graph

93 commits

Author SHA1 Message Date
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
03cc667e48 Standardize some whitespace
The preferred style is 4 spaces.
2014-10-20 15:09: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
7e9c0e2394 Group ids should be strings (or stringables)
ArrayBuffer was a bad choice.
2014-10-16 13:38:33 -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
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
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
266600e5ab There's no need to wrap this function inside a function afaict 2014-10-09 18:54:23 -07:00
Matt Corallo
28779e0b35 Fix tests by returning promises 2014-07-27 02:05:25 -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
a6b0d1f84b Add entirely untested secondary device init 2014-07-26 01:32:05 -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
ebcfd4736e Fix session lookup in duplicate prekeymessage case 2014-07-23 03:36:11 -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
4c3ee6f23b Compare equality w/o getString (in the future) 2014-07-22 21:23:35 -04:00
Matt Corallo
b94ba6b726 USE_NACL = true 2014-07-20 16:49:40 -04:00
Marco
13a9329bcf improved number validation (based on google's libphonenumber) 2014-06-29 16:39:05 -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
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
d0fd3e94d8 sendMessage refactor, initial group stuff (breaks message storage) 2014-06-03 15:28:30 -04: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
aec36468bc Request new keys (largely untested) 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
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
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
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
6bc19ef558 More namespacing 2014-05-17 01:53:58 -04:00