You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
4.2 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{1451:function(e,t,n){"use strict";n.r(t);var a=n(0),l=n.n(a),r=n(11),i=n.n(r),c=n(2),o=n.n(c),d=n(1),s=n(4),u=n(15),m=n(3);t.default=i()({displayName:"EncryptedEventDialog",propTypes:{event:o.a.object.isRequired,onFinished:o.a.func.isRequired},getInitialState:function(){return{device:null}},componentWillMount:function(){this._unmounted=!1;const e=s.a.get();this.refreshDevice().then(t=>t||e.downloadKeys([this.props.event.getSender()],!0).then(()=>this.refreshDevice())).then(t=>{this._unmounted||(this.setState({device:t}),e.on("deviceVerificationChanged",this.onDeviceVerificationChanged))},e=>{console.log("Error downloading devices",e)})},componentWillUnmount:function(){this._unmounted=!0;const e=s.a.get();e&&e.removeListener("deviceVerificationChanged",this.onDeviceVerificationChanged)},refreshDevice:function(){return Promise.resolve(s.a.get().getEventSenderDeviceInfo(this.props.event))},onDeviceVerificationChanged:function(e,t){e==this.props.event.getSender()&&this.refreshDevice().then(e=>{this.setState({device:e})})},onKeyDown:function(e){e.key===u.a.ESCAPE&&(e.stopPropagation(),e.preventDefault(),this.props.onFinished(!1))},_renderDeviceInfo:function(){const e=this.state.device;if(!e)return l.a.createElement("i",null,Object(d.a)("unknown device"));let t=l.a.createElement("b",null,Object(d.a)("NOT verified"));return e.isBlocked()?t=l.a.createElement("b",null,Object(d.a)("Blacklisted")):e.isVerified()&&(t=Object(d.a)("verified")),l.a.createElement("table",null,l.a.createElement("tbody",null,l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Name")),l.a.createElement("td",null,e.getDisplayName())),l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Device ID")),l.a.createElement("td",null,l.a.createElement("code",null,e.deviceId))),l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Verification")),l.a.createElement("td",null,t)),l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Ed25519 fingerprint")),l.a.createElement("td",null,l.a.createElement("code",null,e.getFingerprint())))))},_renderEventInfo:function(){const e=this.props.event;return l.a.createElement("table",null,l.a.createElement("tbody",null,l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("User ID")),l.a.createElement("td",null,e.getSender())),l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Curve25519 identity key")),l.a.createElement("td",null,l.a.createElement("code",null,e.getSenderKey()||l.a.createElement("i",null,Object(d.a)("none"))))),l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Claimed Ed25519 fingerprint key")),l.a.createElement("td",null,l.a.createElement("code",null,e.getKeysClaimed().ed25519||l.a.createElement("i",null,Object(d.a)("none"))))),l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Algorithm")),l.a.createElement("td",null,e.getWireContent().algorithm||l.a.createElement("i",null,Object(d.a)("unencrypted")))),"m.bad.encrypted"===e.getContent().msgtype?l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Decryption error")),l.a.createElement("td",null,e.getContent().body)):null,l.a.createElement("tr",null,l.a.createElement("td",null,Object(d.a)("Session ID")),l.a.createElement("td",null,l.a.createElement("code",null,e.getWireContent().session_id||l.a.createElement("i",null,Object(d.a)("none")))))))},render:function(){const e=m.a("elements.DeviceVerifyButtons");let t=null;return this.state.device&&(t=l.a.createElement(e,{device:this.state.device,userId:this.props.event.getSender()})),l.a.createElement("div",{className:"mx_EncryptedEventDialog",onKeyDown:this.onKeyDown},l.a.createElement("div",{className:"mx_Dialog_title"},Object(d.a)("End-to-end encryption information")),l.a.createElement("div",{className:"mx_Dialog_content"},l.a.createElement("h4",null,Object(d.a)("Event information")),this._renderEventInfo(),l.a.createElement("h4",null,Object(d.a)("Sender session information")),this._renderDeviceInfo()),l.a.createElement("div",{className:"mx_Dialog_buttons"},l.a.createElement("button",{className:"mx_Dialog_primary",onClick:this.props.onFinished,autoFocus:!0},Object(d.a)("OK")),t))}})}}]);