You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-02 17:02:31 +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) {
|
async signUser(key) {
|
||||||
if (!this.keys.user_signing) {
|
if (!this.keys.user_signing) {
|
||||||
|
logger.info("No user signing key: not signing user");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return this.signObject(key.keys.master, "user_signing");
|
return this.signObject(key.keys.master, "user_signing");
|
||||||
@@ -360,6 +361,7 @@ export class CrossSigningInfo extends EventEmitter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!this.keys.self_signing) {
|
if (!this.keys.self_signing) {
|
||||||
|
logger.info("No self signing key: not signing device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return this.signObject(
|
return this.signObject(
|
||||||
|
|||||||
@@ -1527,8 +1527,13 @@ Crypto.prototype.setDeviceVerification = async function(
|
|||||||
this._storeTrustedSelfKeys(xsk.keys);
|
this._storeTrustedSelfKeys(xsk.keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"Master key " + xsk.getId() + " for " + userId +
|
||||||
|
" marked verified. Signing...",
|
||||||
|
);
|
||||||
const device = await this._crossSigningInfo.signUser(xsk);
|
const device = await this._crossSigningInfo.signUser(xsk);
|
||||||
if (device) {
|
if (device) {
|
||||||
|
logger.info("Uploading signature for " + userId + "...");
|
||||||
await this._baseApis.uploadKeySignatures({
|
await this._baseApis.uploadKeySignatures({
|
||||||
[userId]: {
|
[userId]: {
|
||||||
[deviceId]: device,
|
[deviceId]: device,
|
||||||
@@ -1574,10 +1579,12 @@ Crypto.prototype.setDeviceVerification = async function(
|
|||||||
|
|
||||||
// do cross-signing
|
// do cross-signing
|
||||||
if (verified && userId === this._userId) {
|
if (verified && userId === this._userId) {
|
||||||
|
logger.info("Own device " + deviceId + " marked verified: signing");
|
||||||
const device = await this._crossSigningInfo.signDevice(
|
const device = await this._crossSigningInfo.signDevice(
|
||||||
userId, DeviceInfo.fromStorage(dev, deviceId),
|
userId, DeviceInfo.fromStorage(dev, deviceId),
|
||||||
);
|
);
|
||||||
if (device) {
|
if (device) {
|
||||||
|
logger.info("Uploading signature for " + deviceId);
|
||||||
await this._baseApis.uploadKeySignatures({
|
await this._baseApis.uploadKeySignatures({
|
||||||
[userId]: {
|
[userId]: {
|
||||||
[deviceId]: device,
|
[deviceId]: device,
|
||||||
|
|||||||
@@ -303,6 +303,10 @@ export class VerificationBase extends EventEmitter {
|
|||||||
throw new Error("No devices could be verified");
|
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) {
|
for (const deviceId of verifiedDevices) {
|
||||||
await this._baseApis.setDeviceVerified(userId, deviceId);
|
await this._baseApis.setDeviceVerified(userId, deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user