matrix-react-sdk
Version:
SDK for matrix.org using React
59 lines (58 loc) • 2.06 kB
TypeScript
import React from "react";
import { ShowQrCodeCallbacks, ShowSasCallbacks, VerificationPhase as Phase, VerificationRequest } from "matrix-js-sdk/src/crypto-api";
import { Device, RoomMember, User } from "matrix-js-sdk/src/matrix";
interface IProps {
layout: string;
request: VerificationRequest;
member: RoomMember | User;
phase?: Phase;
onClose: () => void;
isRoomEncrypted: boolean;
inDialog: boolean;
}
interface IState {
/**
* The data for the QR code to display.
*
* We attempt to calculate this once the verification request transitions into the "Ready" phase. If the other
* side cannot scan QR codes, it will remain `undefined`.
*/
qrCodeBytes: Buffer | undefined;
sasEvent: ShowSasCallbacks | null;
emojiButtonClicked?: boolean;
reciprocateButtonClicked?: boolean;
reciprocateQREvent: ShowQrCodeCallbacks | null;
/**
* Details of the other device involved in the transaction.
*
* `undefined` if there is not (yet) another device in the transaction, or if we do not know about it.
*/
otherDeviceDetails?: Device;
}
export default class VerificationPanel extends React.PureComponent<IProps, IState> {
private hasVerifier;
/** have we yet tried to check the other device's info */
private haveCheckedDevice;
/** have we yet tried to get the QR code */
private haveFetchedQRCode;
constructor(props: IProps);
private renderQRPhase;
private onReciprocateYesClick;
private onReciprocateNoClick;
/**
* Get details of the other device involved in the verification, if we haven't before, and store in the state.
*/
private maybeGetOtherDevice;
private renderQRReciprocatePhase;
private renderVerifiedPhase;
private renderCancelledPhase;
render(): React.ReactNode;
private startSAS;
private onSasMatchesClick;
private onSasMismatchesClick;
private updateVerifierState;
private onRequestChange;
componentDidMount(): void;
componentWillUnmount(): void;
}
export {};