chore: Make bootstrap logs more chatty
This commit is contained in:
parent
9bef8452d3
commit
0a9f8497e2
|
|
@ -260,6 +260,7 @@ class Bootstrap {
|
||||||
}
|
}
|
||||||
state = BootstrapState.loading;
|
state = BootstrapState.loading;
|
||||||
try {
|
try {
|
||||||
|
Logs().v('Create key...');
|
||||||
newSsssKey = await encryption.ssss.createKey(passphrase);
|
newSsssKey = await encryption.ssss.createKey(passphrase);
|
||||||
if (oldSsssKeys != null) {
|
if (oldSsssKeys != null) {
|
||||||
// alright, we have to re-encrypt old secrets with the new key
|
// alright, we have to re-encrypt old secrets with the new key
|
||||||
|
|
@ -280,7 +281,9 @@ class Bootstrap {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (final s in removeKey(keyId)) {
|
for (final s in removeKey(keyId)) {
|
||||||
|
Logs().v('Get stored key of type $s...');
|
||||||
secretMap[s] = await key.getStored(s);
|
secretMap[s] = await key.getStored(s);
|
||||||
|
Logs().v('Store new secret with this key...');
|
||||||
await newSsssKey.store(s, secretMap[s], add: true);
|
await newSsssKey.store(s, secretMap[s], add: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,9 +296,10 @@ class Bootstrap {
|
||||||
await updatedAccountData;
|
await updatedAccountData;
|
||||||
if (oldSsssKeys != null) {
|
if (oldSsssKeys != null) {
|
||||||
for (final entry in secretMap.entries) {
|
for (final entry in secretMap.entries) {
|
||||||
|
Logs().v('Validate and stripe other keys ${entry.key}...');
|
||||||
await newSsssKey.validateAndStripOtherKeys(entry.key, entry.value);
|
await newSsssKey.validateAndStripOtherKeys(entry.key, entry.value);
|
||||||
}
|
}
|
||||||
// and make super sure we have everything cached
|
Logs().v('And make super sure we have everything cached...');
|
||||||
await newSsssKey.maybeCacheAll();
|
await newSsssKey.maybeCacheAll();
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
|
@ -315,6 +319,7 @@ class Bootstrap {
|
||||||
if (!newSsssKey.isUnlocked) {
|
if (!newSsssKey.isUnlocked) {
|
||||||
throw BootstrapBadStateException('Key not unlocked');
|
throw BootstrapBadStateException('Key not unlocked');
|
||||||
}
|
}
|
||||||
|
Logs().v('Maybe cache all...');
|
||||||
await newSsssKey.maybeCacheAll();
|
await newSsssKey.maybeCacheAll();
|
||||||
checkCrossSigning();
|
checkCrossSigning();
|
||||||
}
|
}
|
||||||
|
|
@ -378,6 +383,7 @@ class Bootstrap {
|
||||||
master.free();
|
master.free();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Logs().v('Get stored key...');
|
||||||
masterSigningKey = base64.decode(
|
masterSigningKey = base64.decode(
|
||||||
await newSsssKey.getStored(EventTypes.CrossSigningMasterKey) ?? '');
|
await newSsssKey.getStored(EventTypes.CrossSigningMasterKey) ?? '');
|
||||||
if (masterSigningKey == null || masterSigningKey.isEmpty) {
|
if (masterSigningKey == null || masterSigningKey.isEmpty) {
|
||||||
|
|
@ -496,15 +502,16 @@ class Bootstrap {
|
||||||
throw BootstrapBadStateException(
|
throw BootstrapBadStateException(
|
||||||
'ERROR: New master key does not match up!');
|
'ERROR: New master key does not match up!');
|
||||||
}
|
}
|
||||||
|
Logs().v('Set own master key to verified...');
|
||||||
await client.userDeviceKeys[client.userID].masterKey
|
await client.userDeviceKeys[client.userID].masterKey
|
||||||
.setVerified(true, false);
|
.setVerified(true, false);
|
||||||
keysToSign.add(client.userDeviceKeys[client.userID].masterKey);
|
keysToSign.add(client.userDeviceKeys[client.userID].masterKey);
|
||||||
}
|
}
|
||||||
// and sign ourself!
|
|
||||||
if (selfSigningKey != null) {
|
if (selfSigningKey != null) {
|
||||||
keysToSign.add(
|
keysToSign.add(
|
||||||
client.userDeviceKeys[client.userID].deviceKeys[client.deviceID]);
|
client.userDeviceKeys[client.userID].deviceKeys[client.deviceID]);
|
||||||
}
|
}
|
||||||
|
Logs().v('Sign ourself...');
|
||||||
await encryption.crossSigning.sign(keysToSign);
|
await encryption.crossSigning.sign(keysToSign);
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logs().e('[Bootstrapping] Error setting up cross signing', e, s);
|
Logs().e('[Bootstrapping] Error setting up cross signing', e, s);
|
||||||
|
|
@ -553,16 +560,17 @@ class Bootstrap {
|
||||||
} finally {
|
} finally {
|
||||||
keyObj.free();
|
keyObj.free();
|
||||||
}
|
}
|
||||||
// create the new backup version
|
Logs().v('Create the new backup version...');
|
||||||
await client.createRoomKeysBackup(
|
await client.createRoomKeysBackup(
|
||||||
RoomKeysAlgorithmType.v1Curve25519AesSha2,
|
RoomKeysAlgorithmType.v1Curve25519AesSha2,
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'public_key': pubKey,
|
'public_key': pubKey,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// store the secret
|
Logs().v('Store the secret...');
|
||||||
await newSsssKey.store(MEGOLM_KEY, base64.encode(privKey));
|
await newSsssKey.store(MEGOLM_KEY, base64.encode(privKey));
|
||||||
// and finally set all megolm keys as needing to be uploaded again
|
Logs().v(
|
||||||
|
'And finally set all megolm keys as needing to be uploaded again...');
|
||||||
await client.database?.markInboundGroupSessionsAsNeedingUpload(client.id);
|
await client.database?.markInboundGroupSessionsAsNeedingUpload(client.id);
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logs().e('[Bootstrapping] Error setting up online key backup', e, s);
|
Logs().e('[Bootstrapping] Error setting up online key backup', e, s);
|
||||||
|
|
@ -576,7 +584,7 @@ class Bootstrap {
|
||||||
}
|
}
|
||||||
|
|
||||||
set state(BootstrapState newState) {
|
set state(BootstrapState newState) {
|
||||||
Logs().v('BootstrapState', newState);
|
Logs().v('BootstrapState: $newState');
|
||||||
if (state != BootstrapState.error) {
|
if (state != BootstrapState.error) {
|
||||||
_state = newState;
|
_state = newState;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue