You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-01 04:43:29 +03:00
Add a bunch of logging to verification
So we have a better idea of what's going on
This commit is contained in:
@@ -348,6 +348,7 @@ export class CrossSigningInfo extends EventEmitter {
|
||||
|
||||
async signUser(key) {
|
||||
if (!this.keys.user_signing) {
|
||||
logger.info("No user signing key: not signing user");
|
||||
return;
|
||||
}
|
||||
return this.signObject(key.keys.master, "user_signing");
|
||||
@@ -360,6 +361,7 @@ export class CrossSigningInfo extends EventEmitter {
|
||||
);
|
||||
}
|
||||
if (!this.keys.self_signing) {
|
||||
logger.info("No self signing key: not signing device");
|
||||
return;
|
||||
}
|
||||
return this.signObject(
|
||||
|
||||
@@ -1527,8 +1527,13 @@ Crypto.prototype.setDeviceVerification = async function(
|
||||
this._storeTrustedSelfKeys(xsk.keys);
|
||||
}
|
||||
|
||||
logger.info(
|
||||
"Master key " + xsk.getId() + " for " + userId +
|
||||
" marked verified. Signing...",
|
||||
);
|
||||
const device = await this._crossSigningInfo.signUser(xsk);
|
||||
if (device) {
|
||||
logger.info("Uploading signature for " + userId + "...");
|
||||
await this._baseApis.uploadKeySignatures({
|
||||
[userId]: {
|
||||
[deviceId]: device,
|
||||
@@ -1574,10 +1579,12 @@ Crypto.prototype.setDeviceVerification = async function(
|
||||
|
||||
// do cross-signing
|
||||
if (verified && userId === this._userId) {
|
||||
logger.info("Own device " + deviceId + " marked verified: signing");
|
||||
const device = await this._crossSigningInfo.signDevice(
|
||||
userId, DeviceInfo.fromStorage(dev, deviceId),
|
||||
);
|
||||
if (device) {
|
||||
logger.info("Uploading signature for " + deviceId);
|
||||
await this._baseApis.uploadKeySignatures({
|
||||
[userId]: {
|
||||
[deviceId]: device,
|
||||
|
||||
@@ -303,6 +303,10 @@ export class VerificationBase extends EventEmitter {
|
||||
throw new Error("No devices could be verified");
|
||||
}
|
||||
|
||||
logger.info("Verification completed! Marking devices verified: ", verifiedDevices);
|
||||
// TODO: There should probably be a batch version of this, otherwise it's going
|
||||
// to upload each signature in a separate API call which is silly because the
|
||||
// API supports as many signatures as you like.
|
||||
for (const deviceId of verifiedDevices) {
|
||||
await this._baseApis.setDeviceVerified(userId, deviceId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user