1
0
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:
Travis Ralston
2020-01-29 09:26:22 +00:00
parent 09a8f7122c
commit fd563bda6a
2 changed files with 3 additions and 59 deletions

View File

@@ -41,7 +41,7 @@ import {
import {SECRET_STORAGE_ALGORITHM_V1, SecretStorage} from './SecretStorage';
import {OutgoingRoomKeyRequestManager} from './OutgoingRoomKeyRequestManager';
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 {keyFromPassphrase} from './key_passphrase';
import {encodeRecoveryKey} from './recoverykey';
@@ -53,8 +53,6 @@ import * as httpApi from "../http-api";
const DeviceVerification = DeviceInfo.DeviceVerification;
const defaultVerificationMethods = {
[ScanQRCode.NAME]: ScanQRCode,
[ShowQRCode.NAME]: ShowQRCode,
[ReciprocateQRCode.NAME]: ReciprocateQRCode,
[SAS.NAME]: SAS,
};
@@ -63,8 +61,6 @@ const defaultVerificationMethods = {
* verification method names
*/
export const verificationMethods = {
QR_CODE_SCAN: ScanQRCode.NAME,
QR_CODE_SHOW: ShowQRCode.NAME,
RECIPROCATE_QR_CODE: ReciprocateQRCode.NAME,
SAS: SAS.NAME,
};

View File

@@ -33,60 +33,8 @@ const MATRIXTO_REGEXP = /^(?:https?:\/\/)?(?:www\.)?matrix\.to\/#\/([#@!+][^?]+)
const newQRCodeError = errorFactory("m.qr_code.invalid", "Invalid QR code");
/**
* @class crypto/verification/QRCode/ShowQRCode
* @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";
export const SHOW_QR_CODE_METHOD = "m.qr_code.show.v1";
export const SCAN_QR_CODE_METHOD = "m.qr_code.scan.v1";
/**
* @class crypto/verification/QRCode/ReciprocateQRCode