chore: More try catch in bootstrap
This commit is contained in:
parent
a6ee805367
commit
ad39e3af25
|
|
@ -205,8 +205,14 @@ class Bootstrap {
|
||||||
throw BootstrapBadStateException('Wrong State');
|
throw BootstrapBadStateException('Wrong State');
|
||||||
}
|
}
|
||||||
if (use) {
|
if (use) {
|
||||||
|
try {
|
||||||
newSsssKey = encryption.ssss.open(encryption.ssss.defaultKeyId);
|
newSsssKey = encryption.ssss.open(encryption.ssss.defaultKeyId);
|
||||||
state = BootstrapState.openExistingSsss;
|
state = BootstrapState.openExistingSsss;
|
||||||
|
} catch (e, s) {
|
||||||
|
Logs().e('[Bootstrapping] Error open SSSS', e, s);
|
||||||
|
state = BootstrapState.error;
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (badSecrets().isNotEmpty) {
|
} else if (badSecrets().isNotEmpty) {
|
||||||
state = BootstrapState.askBadSsss;
|
state = BootstrapState.askBadSsss;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -233,9 +239,8 @@ class Bootstrap {
|
||||||
for (final key in keys) {
|
for (final key in keys) {
|
||||||
oldSsssKeys[key] = encryption.ssss.open(key);
|
oldSsssKeys[key] = encryption.ssss.open(key);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e, s) {
|
||||||
// very bad
|
Logs().e('[Bootstrapping] Error construction ssss key', e, s);
|
||||||
Logs().e('[Bootstrapping] Error construction ssss key', e);
|
|
||||||
state = BootstrapState.error;
|
state = BootstrapState.error;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -346,6 +351,7 @@ class Bootstrap {
|
||||||
checkOnlineKeyBackup();
|
checkOnlineKeyBackup();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
Uint8List masterSigningKey;
|
Uint8List masterSigningKey;
|
||||||
final secretsToStore = <String, String>{};
|
final secretsToStore = <String, String>{};
|
||||||
MatrixCrossSigningKey masterKey;
|
MatrixCrossSigningKey masterKey;
|
||||||
|
|
@ -388,7 +394,8 @@ class Bootstrap {
|
||||||
final keyObj = olm.PkSigning();
|
final keyObj = olm.PkSigning();
|
||||||
try {
|
try {
|
||||||
keyObj.init_with_seed(masterSigningKey);
|
keyObj.init_with_seed(masterSigningKey);
|
||||||
return keyObj.sign(String.fromCharCodes(canonicalJson.encode(object)));
|
return keyObj
|
||||||
|
.sign(String.fromCharCodes(canonicalJson.encode(object)));
|
||||||
} finally {
|
} finally {
|
||||||
keyObj.free();
|
keyObj.free();
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +450,6 @@ class Bootstrap {
|
||||||
userSigning.free();
|
userSigning.free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
// upload the keys!
|
// upload the keys!
|
||||||
state = BootstrapState.loading;
|
state = BootstrapState.loading;
|
||||||
await client.uiaRequestBackground(
|
await client.uiaRequestBackground(
|
||||||
|
|
@ -533,6 +539,7 @@ class Bootstrap {
|
||||||
state = BootstrapState.done;
|
state = BootstrapState.done;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
final keyObj = olm.PkDecryption();
|
final keyObj = olm.PkDecryption();
|
||||||
String pubKey;
|
String pubKey;
|
||||||
Uint8List privKey;
|
Uint8List privKey;
|
||||||
|
|
@ -542,7 +549,6 @@ class Bootstrap {
|
||||||
} finally {
|
} finally {
|
||||||
keyObj.free();
|
keyObj.free();
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
// create the new backup version
|
// create the new backup version
|
||||||
await client.createRoomKeysBackup(
|
await client.createRoomKeysBackup(
|
||||||
RoomKeysAlgorithmType.v1Curve25519AesSha2,
|
RoomKeysAlgorithmType.v1Curve25519AesSha2,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue