Use staging server (ie update to server keys v2) and protocolv3

This commit is contained in:
Matt Corallo 2014-07-20 17:11:19 -04:00
parent 53f8ac9ad9
commit 66bf371aa7
2 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ window.textsecure.api = function() {
var URL_CALLS = {};
URL_CALLS['accounts'] = "/v1/accounts";
URL_CALLS['devices'] = "/v1/devices";
URL_CALLS['keys'] = "/v1/keys";
URL_CALLS['keys'] = "/v2/keys";
URL_CALLS['push'] = "/v1/websocket";
URL_CALLS['messages'] = "/v1/messages";
URL_CALLS['attachment'] = "/v1/attachments";

View file

@ -779,15 +779,14 @@ window.textsecure.crypto = function() {
var signedKeyId = textsecure.storage.getEncrypted("signedKeyId", 0);
textsecure.storage.putEncrypted("signedKeyId", signedKeyId + 1);
textsecure.storage.putEncrypted("lastSignedKeyUpdate", Date.now());
var keys = {};
keys.identityKey = identityKeyPair.pubKey;
keys.keys = [];
keys.preKeys = [];
var generateKey = function(keyId) {
return crypto_storage.getNewStoredKeyPair("preKey" + keyId, false).then(function(keyPair) {
keys.keys[keyId] = {keyId: keyId, publicKey: keyPair.pubKey};
keys.preKeys[keyId] = {keyId: keyId, publicKey: keyPair.pubKey};
});
};
@ -797,7 +796,7 @@ window.textsecure.crypto = function() {
promises[firstPreKeyId + GENERATE_KEYS_KEYS_GENERATED] = crypto_storage.getNewStoredKeyPair("signedKey" + signedKeyId).then(function(keyPair) {
return Ed25519Sign(identityKeyPair.privKey, keyPair.pubKey).then(function(sig) {
keys.signedKey = {keyId: signedKeyId, publicKey: keyPair.pubKey, signature: sig};
keys.signedPreKey = {keyId: signedKeyId, publicKey: keyPair.pubKey, signature: sig};
});
});
@ -814,6 +813,7 @@ window.textsecure.crypto = function() {
}
window.textsecure.registerOnLoadFunction(function() {
//TODO: Dont always update prekeys here
if (textsecure.storage.getEncrypted("lastSignedKeyUpdate", Date.now()) < Date.now() - MESSAGE_LOST_THRESHOLD_MS)
self.generateKeys();
});