From b682e7d908a8e6b3c84a0e77977604bd85709bf6 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 23 Jan 2020 20:05:32 -0700 Subject: [PATCH] Generate a QR code for apps to scan --- .../elements/crypto/VerificationQRCode.js | 8 ++--- .../views/right_panel/VerificationPanel.js | 32 +++++++++++-------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/components/views/elements/crypto/VerificationQRCode.js b/src/components/views/elements/crypto/VerificationQRCode.js index c49dd3faf5..fa4031da9f 100644 --- a/src/components/views/elements/crypto/VerificationQRCode.js +++ b/src/components/views/elements/crypto/VerificationQRCode.js @@ -24,15 +24,13 @@ import QRCode from "qrcode-react"; export default class VerificationQRCode extends React.PureComponent { static propTypes = { // Common for all kinds of QR codes - keys: PropTypes.array.isRequired, // array of [Key ID, Key] pairs + keys: PropTypes.array.isRequired, // array of [Key ID, Base64 Key] pairs action: PropTypes.string.isRequired, keyholderUserId: PropTypes.string.isRequired, // User verification use case only secret: PropTypes.string, - otherUserKey: PropTypes.string, - verificationKey: PropTypes.string, - verificationAlgorithms: PropTypes.array, + otherUserKey: PropTypes.string, // Base64 key being verified requestEventId: PropTypes.string, }; @@ -44,8 +42,6 @@ export default class VerificationQRCode extends React.PureComponent { const query = { request: this.props.requestEventId, action: this.props.action, - verification_algorithms: this.props.verificationAlgorithms, - verification_key: this.props.verificationKey, other_user_key: this.props.otherUserKey, }; for (const key of this.props.keys) { diff --git a/src/components/views/right_panel/VerificationPanel.js b/src/components/views/right_panel/VerificationPanel.js index 34f7538b1c..d0c3d2df10 100644 --- a/src/components/views/right_panel/VerificationPanel.js +++ b/src/components/views/right_panel/VerificationPanel.js @@ -45,22 +45,28 @@ export default class VerificationPanel extends React.PureComponent { if (request.requested) { return (

Waiting for {request.otherUserId} to accept ...

); } else if (request.ready) { - const keyId = `ed25519:${MatrixClientPeg.get().getCrossSigningId()}`; - const qrCodeKeys = [ - [MatrixClientPeg.get().getDeviceId(), MatrixClientPeg.get().getDeviceEd25519Key()], - [keyId, MatrixClientPeg.get().getCrossSigningId()], - ]; - const qrCode = ; const verifyButton = Verify by emoji ; - return (

{request.otherUserId} is ready, start {verifyButton} or have them scan: {qrCode}

); + + if (request.requestEvent && request.requestEvent.getId()) { + const keyId = `ed25519:${MatrixClientPeg.get().getCrossSigningId()}`; + const qrCodeKeys = [ + [MatrixClientPeg.get().getDeviceId(), MatrixClientPeg.get().getDeviceEd25519Key()], + [keyId, MatrixClientPeg.get().getCrossSigningId()], + ]; + const crossSigningInfo = MatrixClientPeg.get().getStoredCrossSigningForUser(request.otherUserId); + const qrCode = ; + return (

{request.otherUserId} is ready, start {verifyButton} or have them scan: {qrCode}

); + } + + return (

{request.otherUserId} is ready, start {verifyButton}

); } else if (request.started) { if (this.state.sasWaitingForOtherParty) { return

Waiting for {request.otherUserId} to confirm ...

;