Commit Graph

264 Commits (69c52d51b3362047f6791ce2e12d75f125fb4c45)

Author SHA1 Message Date
lilia 69c52d51b3 Abstract out curve25519 tests
Also rename the internal variable in crypto.js to be a little more
explicit about which curve we're dealing with.
11 years ago
lilia 79925fd227 Removed now unused copy of getRandomBytes 11 years ago
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.
11 years ago
lilia cd4b98d426 Remove 1mod8
27b5bf54cc
11 years ago
lilia db76c7e164 Initialize session.currentRatchet.previousCounter 11 years ago
lilia aa937ae1d1 Add attachment inputs to new conversation form
Fixes reference error to 'map' on undefined attachments list.
11 years ago
lilia f7d92ccb5b Bowerize backbone.localstorage 11 years ago
lilia 51de1d46c8 Update ByteBuffer.js
Such update. Very versioned, wow.
11 years ago
Arlo Breault bc5dea62c3 Use FileReader to base64 encode attachments
* Implements #82
11 years ago
lilia 6e3014895b Fix cryptojs hmac implementation
Apparently the bowerized version of cryptojs's WordArray.create doesn't
handle arraybuffers correctly.
11 years ago
lilia 6e86a2b7cf Switch libphonenumber to bower 11 years ago
lilia 508c59e05c Rename bower_components
To components. Because tab-completion works better when there aren't two
things starting with bower, and shorter names are nicer to deal with in
general.
11 years ago
lilia ca7ba43b13 Fix overly hidden elements on registration page
Latest bootstrap css is really aggressive about hiding things.
11 years ago
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
11 years ago
lilia 9c568ed0b8 Don't warn on missing message bodies
A message can be blank if it has an attachment
11 years ago
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.
11 years ago
lilia 987744cd79 Default avatars
Someday you'll be able to edit your avatar. Until then, put a bird on
it.
11 years ago
lilia 2a7d3996bb Remove unused popup.html
And popup.js is now index.js, illustrating its importance as the titular
javascript file.
11 years ago
lilia 1c76c0b546 Move storage objects to their own files
Greatly reduce the size of the ignominiously named helpers.js.
11 years ago
lilia b92c5bb84e Unused function 11 years ago
lilia ddd6f1a944 remove another unused function 11 years ago
lilia 80e3fadcb1 Remove unused *MACWithVersionByte functions 11 years ago
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])`.
11 years ago
lilia 244e051fc3 Add importKey to webcrypto.js 11 years ago
Matt Corallo 37ef492642 Remove now-broken axolotl test 11 years ago
Matt Corallo 2e7b5b46e3 Remove AES-CTR entirely 11 years ago
Matt Corallo da0c63fb1b Add (untested) AES-CBC switch from v3 (fs loss resulted in old tested version being lost) 11 years ago
Matt Corallo 3a39602385 Fix borked spacing in webcrypto.js 11 years ago
Matt Corallo 73f867f7de rm useless GPL, license testvectors under X11 (ie 3-c MIT + advertising provision) 11 years ago
Matt Corallo 68a42a6ae7 Give up on webcrypto :( 11 years ago
lilia 21225b2074 Save outgoing attachments 11 years ago
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.
11 years ago
lilia e07759a93c Fix CBC encryption, test 11 years ago
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/
11 years ago
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.
11 years ago
lilia eebb14599f Well that's handy 11 years ago
lilia 674b173c59 Add support for cbc encryption 11 years ago
lilia 229007040c Basic frontend support for image attachments 11 years ago
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.
11 years ago
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.
11 years ago
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.
11 years ago
lilia d67b723f4f Highlight the selected thread 11 years ago
lilia 19dac1f3df Decorate incoming group messages
with numbers and image placeholders, so you know who's saying what.
11 years ago
lilia 78166365c7 Fix new message number validation 11 years ago
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.
11 years ago
lilia 6e2a85ccf1 wip new message phone number validation 11 years ago
lilia e831c649bd Require a mandatory websocket reset once a minute
Compensate for the lack of keepalives in the WebSocket API.

Fixes #67
11 years ago
lilia a3bf40e852 Shorten websocket time out. Fixes #67 11 years ago
lilia 3a00e49791 Open the most recent conversation on load 11 years ago
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
11 years ago