actually start verify process in verification panel
temporary code, as ux is not complete
This commit is contained in:
parent
c02fc44d25
commit
0f415038be
1 changed files with 14 additions and 3 deletions
|
@ -22,6 +22,7 @@ export default class VerificationPanel extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {};
|
this.state = {};
|
||||||
|
this._hasVerifier = !!props.request.verifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -53,12 +54,10 @@ export default class VerificationPanel extends React.PureComponent {
|
||||||
|
|
||||||
_startSAS = async () => {
|
_startSAS = async () => {
|
||||||
const verifier = this.props.request.beginKeyVerification(verificationMethods.SAS);
|
const verifier = this.props.request.beginKeyVerification(verificationMethods.SAS);
|
||||||
verifier.on('show_sas', this._onVerifierShowSas);
|
|
||||||
try {
|
try {
|
||||||
await this._verifier.verify();
|
await verifier.verify();
|
||||||
} finally {
|
} finally {
|
||||||
this.setState({sasEvent: null});
|
this.setState({sasEvent: null});
|
||||||
verifier.removeListener('show_sas', this._onVerifierShowSas);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,6 +74,18 @@ export default class VerificationPanel extends React.PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
_onRequestChange = () => {
|
_onRequestChange = () => {
|
||||||
|
const {request} = this.props;
|
||||||
|
if (!this._hasVerifier && !!request.verifier) {
|
||||||
|
request.verifier.on('show_sas', this._onVerifierShowSas);
|
||||||
|
try {
|
||||||
|
request.verifier.verify();
|
||||||
|
} catch (err) {
|
||||||
|
console.error("error verify", err);
|
||||||
|
}
|
||||||
|
} else if (this._hasVerifier && !request.verifier) {
|
||||||
|
request.verifier.removeListener('show_sas', this._onVerifierShowSas);
|
||||||
|
}
|
||||||
|
this._hasVerifier = !!request.verifier;
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue