You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Remove irrelevant verification flows for QR codes
You can't actually get at these through our verification framework - they scan/show steps are pre-verification framework.
This commit is contained in:
@@ -41,7 +41,7 @@ import {
|
|||||||
import {SECRET_STORAGE_ALGORITHM_V1, SecretStorage} from './SecretStorage';
|
import {SECRET_STORAGE_ALGORITHM_V1, SecretStorage} from './SecretStorage';
|
||||||
import {OutgoingRoomKeyRequestManager} from './OutgoingRoomKeyRequestManager';
|
import {OutgoingRoomKeyRequestManager} from './OutgoingRoomKeyRequestManager';
|
||||||
import {IndexedDBCryptoStore} from './store/indexeddb-crypto-store';
|
import {IndexedDBCryptoStore} from './store/indexeddb-crypto-store';
|
||||||
import {ReciprocateQRCode, ScanQRCode, ShowQRCode} from './verification/QRCode';
|
import {ReciprocateQRCode} from './verification/QRCode';
|
||||||
import {SAS} from './verification/SAS';
|
import {SAS} from './verification/SAS';
|
||||||
import {keyFromPassphrase} from './key_passphrase';
|
import {keyFromPassphrase} from './key_passphrase';
|
||||||
import {encodeRecoveryKey} from './recoverykey';
|
import {encodeRecoveryKey} from './recoverykey';
|
||||||
@@ -53,8 +53,6 @@ import * as httpApi from "../http-api";
|
|||||||
const DeviceVerification = DeviceInfo.DeviceVerification;
|
const DeviceVerification = DeviceInfo.DeviceVerification;
|
||||||
|
|
||||||
const defaultVerificationMethods = {
|
const defaultVerificationMethods = {
|
||||||
[ScanQRCode.NAME]: ScanQRCode,
|
|
||||||
[ShowQRCode.NAME]: ShowQRCode,
|
|
||||||
[ReciprocateQRCode.NAME]: ReciprocateQRCode,
|
[ReciprocateQRCode.NAME]: ReciprocateQRCode,
|
||||||
[SAS.NAME]: SAS,
|
[SAS.NAME]: SAS,
|
||||||
};
|
};
|
||||||
@@ -63,8 +61,6 @@ const defaultVerificationMethods = {
|
|||||||
* verification method names
|
* verification method names
|
||||||
*/
|
*/
|
||||||
export const verificationMethods = {
|
export const verificationMethods = {
|
||||||
QR_CODE_SCAN: ScanQRCode.NAME,
|
|
||||||
QR_CODE_SHOW: ShowQRCode.NAME,
|
|
||||||
RECIPROCATE_QR_CODE: ReciprocateQRCode.NAME,
|
RECIPROCATE_QR_CODE: ReciprocateQRCode.NAME,
|
||||||
SAS: SAS.NAME,
|
SAS: SAS.NAME,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,60 +33,8 @@ const MATRIXTO_REGEXP = /^(?:https?:\/\/)?(?:www\.)?matrix\.to\/#\/([#@!+][^?]+)
|
|||||||
|
|
||||||
const newQRCodeError = errorFactory("m.qr_code.invalid", "Invalid QR code");
|
const newQRCodeError = errorFactory("m.qr_code.invalid", "Invalid QR code");
|
||||||
|
|
||||||
/**
|
export const SHOW_QR_CODE_METHOD = "m.qr_code.show.v1";
|
||||||
* @class crypto/verification/QRCode/ShowQRCode
|
export const SCAN_QR_CODE_METHOD = "m.qr_code.scan.v1";
|
||||||
* @extends {module:crypto/verification/Base}
|
|
||||||
*/
|
|
||||||
export class ShowQRCode extends Base {
|
|
||||||
_doVerification() {
|
|
||||||
if (!this._done) {
|
|
||||||
const crossSigningInfo = this._baseApis.getStoredCrossSigningForUser(this.request.otherUserId);
|
|
||||||
const myKeyId = this._baseApis.getCrossSigningId();
|
|
||||||
const qrCodeKeys = [
|
|
||||||
[this._baseApis.getDeviceId(), this._baseApis.getDeviceEd25519Key()],
|
|
||||||
[myKeyId, myKeyId],
|
|
||||||
];
|
|
||||||
const query = {
|
|
||||||
request: this.request.requestEvent.getId(),
|
|
||||||
action: "verify",
|
|
||||||
secret: this.request.encodedSharedSecret,
|
|
||||||
other_user_key: crossSigningInfo.getId("master"),
|
|
||||||
};
|
|
||||||
for (const key of qrCodeKeys) {
|
|
||||||
query[`key_${key[0]}`] = key[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
const uri = `https://matrix.to/#/${this._baseApis.getUserId()}?${qs.stringify(query)}`;
|
|
||||||
this.emit("show_qr_code", {
|
|
||||||
url: uri,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowQRCode.NAME = "m.qr_code.show.v1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class crypto/verification/QRCode/ScanQRCode
|
|
||||||
* @extends {module:crypto/verification/Base}
|
|
||||||
*/
|
|
||||||
export class ScanQRCode extends Base {
|
|
||||||
static factory(...args) {
|
|
||||||
return new ScanQRCode(...args);
|
|
||||||
}
|
|
||||||
|
|
||||||
async _doVerification() {
|
|
||||||
const code = await new Promise((resolve, reject) => {
|
|
||||||
this.emit("scan", {
|
|
||||||
done: resolve,
|
|
||||||
cancel: () => reject(newUserCancelledError()),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
const {action, secret, otherUserKey, keys, targetUserId} = ReciprocateQRCode.splitUrl(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ScanQRCode.NAME = "m.qr_code.scan.v1";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class crypto/verification/QRCode/ReciprocateQRCode
|
* @class crypto/verification/QRCode/ReciprocateQRCode
|
||||||
|
|||||||
Reference in New Issue
Block a user