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
This commit is contained in:
lilia 2014-10-20 01:21:23 -07:00
parent 03cc667e48
commit 1023ea1732
9 changed files with 79 additions and 96 deletions

View file

@ -104,6 +104,7 @@
<script type="text/javascript" src="js-deps/libphonenumber_api-compiled.js"></script>
<script type="text/javascript" src="js-deps/qrcode.min.js"></script>
<script type="text/javascript" src="js/protobufs.js"></script>
<script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="js/libphonenumber-util.js"></script>
<script type="text/javascript" src="js/webcrypto.js"></script>