Generate signed keys (breaks registration)

This commit is contained in:
Matt Corallo 2014-07-20 16:28:44 -04:00
parent 4c3ee6f23b
commit 53f8ac9ad9
2 changed files with 63 additions and 27 deletions

View file

@ -139,14 +139,44 @@ textsecure.registerOnLoadFunction(function() {
return textsecure.crypto.generateKeys().then(function() {
if (textsecure.storage.getEncrypted("25519KeyidentityKey") === undefined)
return false;
if (textsecure.storage.getEncrypted("25519KeypreKey16777215") === undefined)
if (textsecure.storage.getEncrypted("25519KeysignedKey0") === undefined)
return false;
for (var i = 0; i < 100; i++)
if (textsecure.storage.getEncrypted("25519KeypreKey" + i) === undefined)
return false;
return true;
var origIdentityKey = getString(textsecure.storage.getEncrypted("25519KeyidentityKey").privKey);
return textsecure.crypto.generateKeys().then(function() {
if (textsecure.storage.getEncrypted("25519KeyidentityKey") === undefined ||
getString(textsecure.storage.getEncrypted("25519KeyidentityKey").privKey) != origIdentityKey)
return false;
if (textsecure.storage.getEncrypted("25519KeysignedKey0") === undefined ||
textsecure.storage.getEncrypted("25519KeysignedKey1") === undefined)
return false;
for (var i = 0; i < 200; i++)
if (textsecure.storage.getEncrypted("25519KeypreKey" + i) === undefined)
return false;
return textsecure.crypto.generateKeys().then(function() {
if (textsecure.storage.getEncrypted("25519KeyidentityKey") === undefined ||
getString(textsecure.storage.getEncrypted("25519KeyidentityKey").privKey) != origIdentityKey)
return false;
if (textsecure.storage.getEncrypted("25519KeysignedKey0") !== undefined ||
textsecure.storage.getEncrypted("25519KeysignedKey1") === undefined ||
textsecure.storage.getEncrypted("25519KeysignedKey2") === undefined)
return false;
for (var i = 0; i < 300; i++)
if (textsecure.storage.getEncrypted("25519KeypreKey" + i) === undefined)
return false;
return true;
});
});
});
}, "Test Identity/Pre Key Creation", true);