Fixup dir structure

This commit is contained in:
Matt Corallo 2014-01-22 03:28:35 +00:00
parent 4595ad0fc4
commit eec4c66ef6
20 changed files with 53 additions and 49 deletions

View file

@ -1,15 +1,15 @@
<html> <html>
<head> <head>
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="js-deps/jquery.js"></script>
<script type="text/javascript" src="jquery.atmosphere.js"></script> <script type="text/javascript" src="js-deps/jquery.atmosphere.js"></script>
<script type="text/javascript" src="aes.js"></script> <script type="text/javascript" src="js-deps/aes.js"></script>
<script type="text/javascript" src="hmac-sha256.js"></script> <script type="text/javascript" src="js-deps/hmac-sha256.js"></script>
<script type="text/javascript" src="lib-typedarrays.js"></script> <script type="text/javascript" src="js-deps/lib-typedarrays.js"></script>
<script type="text/javascript" src="Long.min.js"></script> <script type="text/javascript" src="js-deps/Long.min.js"></script>
<script type="text/javascript" src="ByteBuffer.min.js"></script> <script type="text/javascript" src="js-deps/ByteBuffer.min.js"></script>
<script type="text/javascript" src="ProtoBuf.min.js"></script> <script type="text/javascript" src="js-deps/ProtoBuf.min.js"></script>
<script type="text/javascript" src="helpers.js"></script> <script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="background.js"></script> <script type="text/javascript" src="js/background.js"></script>
</head> </head>
<body> <body>
</body> </body>

View file

View file

View file

@ -58,27 +58,27 @@ function base64ToUint8Array(string) {
// Protobuf decodingA // Protobuf decodingA
//TODO: throw on missing fields everywhere //TODO: throw on missing fields everywhere
var IncomingPushMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("IncomingPushMessageSignal.proto").build("textsecure.IncomingPushMessageSignal"); var IncomingPushMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("protos/IncomingPushMessageSignal.proto").build("textsecure.IncomingPushMessageSignal");
function decodeIncomingPushMessageProtobuf(string) { function decodeIncomingPushMessageProtobuf(string) {
return IncomingPushMessageProtobuf.decode(btoa(string)); return IncomingPushMessageProtobuf.decode(btoa(string));
} }
var PushMessageContentProtobuf = dcodeIO.ProtoBuf.loadProtoFile("IncomingPushMessageSignal.proto").build("textsecure.PushMessageContent"); var PushMessageContentProtobuf = dcodeIO.ProtoBuf.loadProtoFile("protos/IncomingPushMessageSignal.proto").build("textsecure.PushMessageContent");
function decodePushMessageContentProtobuf(string) { function decodePushMessageContentProtobuf(string) {
return PushMessageContentProtobuf.decode(btoa(string)); return PushMessageContentProtobuf.decode(btoa(string));
} }
var WhisperMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("WhisperTextProtocol.proto").build("textsecure.WhisperMessage"); var WhisperMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("protos/WhisperTextProtocol.proto").build("textsecure.WhisperMessage");
function decodeWhisperMessageProtobuf(string) { function decodeWhisperMessageProtobuf(string) {
return WhisperMessageProtobuf.decode(btoa(string)); return WhisperMessageProtobuf.decode(btoa(string));
} }
var PreKeyWhisperMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("WhisperTextProtocol.proto").build("textsecure.PreKeyWhisperMessage"); var PreKeyWhisperMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("protos/WhisperTextProtocol.proto").build("textsecure.PreKeyWhisperMessage");
function decodePreKeyWhisperMessageProtobuf(string) { function decodePreKeyWhisperMessageProtobuf(string) {
return PreKeyWhisperMessageProtobuf.decode(btoa(string)); return PreKeyWhisperMessageProtobuf.decode(btoa(string));
} }
var KeyExchangeMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("WhisperTextProtocol.proto").build("textsecure.KeyExchangeMessage"); var KeyExchangeMessageProtobuf = dcodeIO.ProtoBuf.loadProtoFile("protos/WhisperTextProtocol.proto").build("textsecure.KeyExchangeMessage");
function decodeKeyExchangeMessageProtobuf(string) { function decodeKeyExchangeMessageProtobuf(string) {
return KeyExchangeMessageProtobuf.decode(btoa(string)); return KeyExchangeMessageProtobuf.decode(btoa(string));
} }
@ -256,6 +256,10 @@ function getRandomBytes(size) {
(function(crypto, $, undefined) { (function(crypto, $, undefined) {
var createNewKeyPair = function() { var createNewKeyPair = function() {
//TODO //TODO
var privKey = getRandomBytes(32);
privKey[0] &= 248;
privKey[31] &= 127;
privKey[31] |= 64;
var pubKey = "BRTJzsHPUWRRBxyo5MoaBRidMk2fwDlfqvU91b6pzbED"; var pubKey = "BRTJzsHPUWRRBxyo5MoaBRidMk2fwDlfqvU91b6pzbED";
var privKey = ""; var privKey = "";
return { pubKey: pubKey, privKey: privKey }; return { pubKey: pubKey, privKey: privKey };
@ -264,7 +268,7 @@ function getRandomBytes(size) {
var crypto_storage = {}; var crypto_storage = {};
crypto_storage.getNewPubKeySTORINGPrivKey = function(keyName) { crypto_storage.getNewPubKeySTORINGPrivKey = function(keyName) {
var keyPair = crypto._createNewKeyPair(); var keyPair = createNewKeyPair();
storage.putEncrypted("25519Key" + keyName, keyPair); storage.putEncrypted("25519Key" + keyName, keyPair);
return keyPair.pubKey; return keyPair.pubKey;
} }
@ -393,7 +397,7 @@ function getRandomBytes(size) {
var masterKey = HKDF(ECDHE(remoteKey, ratchet.ephemeralKeyPair.privKey), ratchet.rootKey, "WhisperRatchet"); var masterKey = HKDF(ECDHE(remoteKey, ratchet.ephemeralKeyPair.privKey), ratchet.rootKey, "WhisperRatchet");
session[remoteKey] = { messageKeys: {}, chainKey: { counter: 0, key: masterKey.substring(32, 64) } }; session[remoteKey] = { messageKeys: {}, chainKey: { counter: 0, key: masterKey.substring(32, 64) } };
ratchet.ephemeralKeyPair = _createNewKeyPair(); ratchet.ephemeralKeyPair = createNewKeyPair();
masterKey = HKDF(ECDHE(remoteKey, ratchet.ephemeralKeyPair.privKey), masterKey.substring(0, 32), "WhisperRatchet"); masterKey = HKDF(ECDHE(remoteKey, ratchet.ephemeralKeyPair.privKey), masterKey.substring(0, 32), "WhisperRatchet");
ratchet.rootKey = masterKey.substring(0, 32); ratchet.rootKey = masterKey.substring(0, 32);
session[nextRatchet.ephemeralKeyPair.pubKey] = { messageKeys: {}, chainKey: { counter: 0, key: masterKey.substring(32, 64) } }; session[nextRatchet.ephemeralKeyPair.pubKey] = { messageKeys: {}, chainKey: { counter: 0, key: masterKey.substring(32, 64) } };

View file

View file

@ -16,8 +16,8 @@
}, },
"background": { "background": {
"scripts": [ "jquery.js", "jquery.atmosphere.js", "aes.js", "hmac-sha256.js", "lib-typedarrays.js", "scripts": [ "js-deps/jquery.js", "js-deps/jquery.atmosphere.js", "js-deps/aes.js", "js-deps/hmac-sha256.js", "js-deps/lib-typedarrays.js",
"Long.min.js", "ByteBuffer.min.js", "ProtoBuf.min.js", "helpers.js", "background.js" ] "js-deps/Long.min.js", "js-deps/ByteBuffer.min.js", "js-deps/ProtoBuf.min.js", "js/helpers.js", "js/background.js" ]
}, },
"options_page": "options.html" "options_page": "options.html"

View file

@ -22,15 +22,15 @@
<h2>You are now registered on TextSecure with number <span id="complete-number"></span></h2> <h2>You are now registered on TextSecure with number <span id="complete-number"></span></h2>
</div> </div>
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="js-deps/jquery.js"></script>
<script type="text/javascript" src="jquery.atmosphere.js"></script> <script type="text/javascript" src="js-deps/jquery.atmosphere.js"></script>
<script type="text/javascript" src="aes.js"></script> <script type="text/javascript" src="js-deps/aes.js"></script>
<script type="text/javascript" src="hmac-sha256.js"></script> <script type="text/javascript" src="js-deps/hmac-sha256.js"></script>
<script type="text/javascript" src="lib-typedarrays.js"></script> <script type="text/javascript" src="js-deps/lib-typedarrays.js"></script>
<script type="text/javascript" src="Long.min.js"></script> <script type="text/javascript" src="js-deps/Long.min.js"></script>
<script type="text/javascript" src="ByteBuffer.min.js"></script> <script type="text/javascript" src="js-deps/ByteBuffer.min.js"></script>
<script type="text/javascript" src="ProtoBuf.min.js"></script> <script type="text/javascript" src="js-deps/ProtoBuf.min.js"></script>
<script type="text/javascript" src="helpers.js"></script> <script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="options.js"></script> <script type="text/javascript" src="js/options.js"></script>
</body> </body>
</html> </html>

View file

@ -10,15 +10,15 @@
</div> </div>
<div id="send" style="display:none;"></div> <div id="send" style="display:none;"></div>
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="js-deps/jquery.js"></script>
<script type="text/javascript" src="jquery.atmosphere.js"></script> <script type="text/javascript" src="js-deps/jquery.atmosphere.js"></script>
<script type="text/javascript" src="aes.js"></script> <script type="text/javascript" src="js-deps/aes.js"></script>
<script type="text/javascript" src="hmac-sha256.js"></script> <script type="text/javascript" src="js-deps/hmac-sha256.js"></script>
<script type="text/javascript" src="lib-typedarrays.js"></script> <script type="text/javascript" src="js-deps/lib-typedarrays.js"></script>
<script type="text/javascript" src="Long.min.js"></script> <script type="text/javascript" src="js-deps/Long.min.js"></script>
<script type="text/javascript" src="ByteBuffer.min.js"></script> <script type="text/javascript" src="js-deps/ByteBuffer.min.js"></script>
<script type="text/javascript" src="ProtoBuf.min.js"></script> <script type="text/javascript" src="js-deps/ProtoBuf.min.js"></script>
<script type="text/javascript" src="helpers.js"></script> <script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="popup.js"></script> <script type="text/javascript" src="js/popup.js"></script>
</body> </body>
</html> </html>

View file

@ -8,14 +8,14 @@
</div> </div>
</body> </body>
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="js-deps/jquery.js"></script>
<script type="text/javascript" src="jquery.atmosphere.js"></script> <script type="text/javascript" src="js-deps/jquery.atmosphere.js"></script>
<script type="text/javascript" src="aes.js"></script> <script type="text/javascript" src="js-deps/aes.js"></script>
<script type="text/javascript" src="hmac-sha256.js"></script> <script type="text/javascript" src="js-deps/hmac-sha256.js"></script>
<script type="text/javascript" src="lib-typedarrays.js"></script> <script type="text/javascript" src="js-deps/lib-typedarrays.js"></script>
<script type="text/javascript" src="Long.min.js"></script> <script type="text/javascript" src="js-deps/Long.min.js"></script>
<script type="text/javascript" src="ByteBuffer.min.js"></script> <script type="text/javascript" src="js-deps/ByteBuffer.min.js"></script>
<script type="text/javascript" src="ProtoBuf.min.js"></script> <script type="text/javascript" src="js-deps/ProtoBuf.min.js"></script>
<script type="text/javascript" src="helpers.js"></script> <script type="text/javascript" src="js/helpers.js"></script>
<script type="text/javascript" src="test.js"></script> <script type="text/javascript" src="js/test.js"></script>
</html> </html>