matrix-react-sdk
Version:
SDK for matrix.org using React
55 lines (54 loc) • 1.77 kB
TypeScript
import React from "react";
import { MSC3906Rendezvous, MSC4108SignInWithQR, RendezvousFailureReason } from "matrix-js-sdk/src/rendezvous";
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { Mode, Phase } from "./LoginWithQR-types";
interface IProps {
client: MatrixClient;
mode: Mode;
legacy: boolean;
onFinished(...args: any): void;
}
interface IState {
phase: Phase;
rendezvous?: MSC3906Rendezvous | MSC4108SignInWithQR;
mediaPermissionError?: boolean;
confirmationDigits?: string;
verificationUri?: string;
userCode?: string;
checkCode?: string;
failureReason?: FailureReason;
lastScannedCode?: Buffer;
}
export declare enum LoginWithQRFailureReason {
/**
* @deprecated the MSC3906 implementation is deprecated in favour of MSC4108.
*/
RateLimited = "rate_limited",
CheckCodeMismatch = "check_code_mismatch"
}
export type FailureReason = RendezvousFailureReason | LoginWithQRFailureReason;
/**
* A component that allows sign in and E2EE set up with a QR code.
*
* It implements `login.reciprocate` capabilities and showing QR codes.
*
* This uses the unstable feature of MSC3906: https://github.com/matrix-org/matrix-spec-proposals/pull/3906
*/
export default class LoginWithQR extends React.Component<IProps, IState> {
private finished;
constructor(props: IProps);
private get ourIntent();
componentDidMount(): void;
componentDidUpdate(prevProps: Readonly<IProps>): void;
private updateMode;
componentWillUnmount(): void;
private legacyApproveLogin;
private onFinished;
private generateAndShowCode;
private approveLogin;
private onFailure;
reset(): void;
private onClick;
render(): React.ReactNode;
}
export {};