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