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
17 KiB
1 line
17 KiB
{"version":3,"sources":["node_modules/matrix-react-sdk/lib/async-components/views/dialogs/EncryptedEventDialog.js"],"names":["_promise2","_interopRequireDefault","__webpack_require__","_propTypes2","_languageHandler","obj","__esModule","default","React","sdk","MatrixClientPeg","module","exports","createClass","displayName","propTypes","event","object","isRequired","onFinished","func","getInitialState","device","componentWillMount","_this","this","_unmounted","client","get","refreshDevice","then","dev","downloadKeys","props","getSender","setState","on","onDeviceVerificationChanged","err","console","log","componentWillUnmount","removeListener","resolve","getEventSenderDeviceInfo","userId","_this2","onKeyDown","e","keyCode","stopPropagation","preventDefault","_renderDeviceInfo","state","createElement","_t","verificationStatus","isBlocked","isVerified","getDisplayName","deviceId","getFingerprint","_renderEventInfo","getSenderKey","getKeysClaimed","ed25519","getWireContent","algorithm","getContent","msgtype","body","session_id","render","DeviceVerifyButtons","getComponent","buttons","className","onClick","autoFocus"],"mappings":"2FAEA,IAEAA,EAAAC,EAFeC,EAAQ,KAMvBC,EAAAF,EAFiBC,EAAQ,IAIzBE,EAAuBF,EAAQ,GAE/B,SAAAD,EAAAI,GAAsC,OAAAA,KAAAC,WAAAD,GAAuCE,QAAAF,GAkB7E,IAAAG,EAAYN,EAAQ,GAEpBO,EAAUP,EAAQ,GAClBQ,EAAsBR,EAAQ,GAE9BS,EAAAC,QAAAJ,EAAAK,aACAC,YAAA,uBAEAC,WACAC,MAAAb,EAAAI,QAAAU,OAAAC,WACAC,WAAAhB,EAAAI,QAAAa,KAAAF,YAGAG,gBAAA,WACA,OAAgBC,OAAA,OAGhBC,mBAAA,WACA,IAAAC,EAAAC,KAEAA,KAAAC,YAAA,EACA,IAAAC,EAAAjB,EAAAkB,MAIAH,KAAAI,gBAAAC,KAAA,SAAAC,GACA,OAAAA,GAKAJ,EAAAK,cAAAR,EAAAS,MAAAjB,MAAAkB,cAAA,GAAAJ,KAAA,WACA,OAAAN,EA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C,EAAA8C,cACA,KACA,KACAtC,EAAAoD,aAAAE,OAEA,KACA9D,EAAA8C,cACA,KACA,KACA9C,EAAA8C,cACA,KACA,MACA,EAAAlD,EAAAmD,IAAA,eAEA/C,EAAA8C,cACA,KACA,KACA9C,EAAA8C,cACA,OACA,KACAtC,EAAAkD,iBAAAK,YAAA/D,EAAA8C,cACA,IACA,MACA,EAAAlD,EAAAmD,IAAA,eASAiB,OAAA,WACA,IAAAC,EAAAhE,EAAAiE,aAAA,gCAEAC,EAAA,KAOA,OANAlD,KAAA4B,MAAA/B,SACAqD,EAAAnE,EAAA8C,cAAAmB,GAAgEnD,OAAAG,KAAA4B,MAAA/B,OAChEuB,OAAApB,KAAAQ,MAAAjB,MAAAkB,eAIA1B,EAAA8C,cACA,OACasB,UAAA,0BAAA7B,UAAAtB,KAAAsB,WACbvC,EAAA8C,cACA,OACiBsB,UAAA,oBACjB,EAAAxE,EAAAmD,IAAA,sCAEA/C,EAAA8C,cACA,OACiBsB,UAAA,qBACjBpE,EAAA8C,cACA,KACA,MACA,EAAAlD,EAAAmD,IAAA,sBAEA9B,KAAAqC,mBACAtD,EAAA8C,cACA,KACA,MACA,EAAAlD,EAAAmD,IAAA,8BAEA9B,KAAA2B,qBAEA5C,EAAA8C,cACA,OACiBsB,UAAA,qBACjBpE,EAAA8C,cACA,UACqBsB,UAAA,oBAAAC,QAAApD,KAAAQ,MAAAd,WAAA2D,WAAA,IACrB,EAAA1E,EAAAmD,IAAA,OAEAoB","file":"bundles/23de62a7a965ffa277af/9.js","sourcesContent":["'use strict';\n\nvar _promise = require('babel-runtime/core-js/promise');\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _languageHandler = require('../../../languageHandler');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2015, 2016 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar React = require(\"react\");\n\nvar sdk = require('../../../index');\nvar MatrixClientPeg = require(\"../../../MatrixClientPeg\");\n\nmodule.exports = React.createClass({\n displayName: 'EncryptedEventDialog',\n\n propTypes: {\n event: _propTypes2.default.object.isRequired,\n onFinished: _propTypes2.default.func.isRequired\n },\n\n getInitialState: function getInitialState() {\n return { device: null };\n },\n\n componentWillMount: function componentWillMount() {\n var _this = this;\n\n this._unmounted = false;\n var client = MatrixClientPeg.get();\n\n // first try to load the device from our store.\n //\n this.refreshDevice().then(function (dev) {\n if (dev) {\n return dev;\n }\n\n // tell the client to try to refresh the device list for this user\n return client.downloadKeys([_this.props.event.getSender()], true).then(function () {\n return _this.refreshDevice();\n });\n }).then(function (dev) {\n if (_this._unmounted) {\n return;\n }\n\n _this.setState({ device: dev });\n client.on(\"deviceVerificationChanged\", _this.onDeviceVerificationChanged);\n }, function (err) {\n console.log(\"Error downloading devices\", err);\n });\n },\n\n componentWillUnmount: function componentWillUnmount() {\n this._unmounted = true;\n var client = MatrixClientPeg.get();\n if (client) {\n client.removeListener(\"deviceVerificationChanged\", this.onDeviceVerificationChanged);\n }\n },\n\n refreshDevice: function refreshDevice() {\n // Promise.resolve to handle transition from static result to promise; can be removed\n // in future\n return _promise2.default.resolve(MatrixClientPeg.get().getEventSenderDeviceInfo(this.props.event));\n },\n\n onDeviceVerificationChanged: function onDeviceVerificationChanged(userId, device) {\n var _this2 = this;\n\n if (userId == this.props.event.getSender()) {\n this.refreshDevice().then(function (dev) {\n _this2.setState({ device: dev });\n });\n }\n },\n\n onKeyDown: function onKeyDown(e) {\n if (e.keyCode === 27) {\n // escape\n e.stopPropagation();\n e.preventDefault();\n this.props.onFinished(false);\n }\n },\n\n _renderDeviceInfo: function _renderDeviceInfo() {\n var device = this.state.device;\n if (!device) {\n return React.createElement(\n 'i',\n null,\n (0, _languageHandler._t)('unknown device')\n );\n }\n\n var verificationStatus = React.createElement(\n 'b',\n null,\n (0, _languageHandler._t)('NOT verified')\n );\n if (device.isBlocked()) {\n verificationStatus = React.createElement(\n 'b',\n null,\n (0, _languageHandler._t)('Blacklisted')\n );\n } else if (device.isVerified()) {\n verificationStatus = (0, _languageHandler._t)('verified');\n }\n\n return React.createElement(\n 'table',\n null,\n React.createElement(\n 'tbody',\n null,\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Name')\n ),\n React.createElement(\n 'td',\n null,\n device.getDisplayName()\n )\n ),\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Device ID')\n ),\n React.createElement(\n 'td',\n null,\n React.createElement(\n 'code',\n null,\n device.deviceId\n )\n )\n ),\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Verification')\n ),\n React.createElement(\n 'td',\n null,\n verificationStatus\n )\n ),\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Ed25519 fingerprint')\n ),\n React.createElement(\n 'td',\n null,\n React.createElement(\n 'code',\n null,\n device.getFingerprint()\n )\n )\n )\n )\n );\n },\n\n _renderEventInfo: function _renderEventInfo() {\n var event = this.props.event;\n\n return React.createElement(\n 'table',\n null,\n React.createElement(\n 'tbody',\n null,\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('User ID')\n ),\n React.createElement(\n 'td',\n null,\n event.getSender()\n )\n ),\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Curve25519 identity key')\n ),\n React.createElement(\n 'td',\n null,\n React.createElement(\n 'code',\n null,\n event.getSenderKey() || React.createElement(\n 'i',\n null,\n (0, _languageHandler._t)('none')\n )\n )\n )\n ),\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Claimed Ed25519 fingerprint key')\n ),\n React.createElement(\n 'td',\n null,\n React.createElement(\n 'code',\n null,\n event.getKeysClaimed().ed25519 || React.createElement(\n 'i',\n null,\n (0, _languageHandler._t)('none')\n )\n )\n )\n ),\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Algorithm')\n ),\n React.createElement(\n 'td',\n null,\n event.getWireContent().algorithm || React.createElement(\n 'i',\n null,\n (0, _languageHandler._t)('unencrypted')\n )\n )\n ),\n event.getContent().msgtype === 'm.bad.encrypted' ? React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Decryption error')\n ),\n React.createElement(\n 'td',\n null,\n event.getContent().body\n )\n ) : null,\n React.createElement(\n 'tr',\n null,\n React.createElement(\n 'td',\n null,\n (0, _languageHandler._t)('Session ID')\n ),\n React.createElement(\n 'td',\n null,\n React.createElement(\n 'code',\n null,\n event.getWireContent().session_id || React.createElement(\n 'i',\n null,\n (0, _languageHandler._t)('none')\n )\n )\n )\n )\n )\n );\n },\n\n render: function render() {\n var DeviceVerifyButtons = sdk.getComponent('elements.DeviceVerifyButtons');\n\n var buttons = null;\n if (this.state.device) {\n buttons = React.createElement(DeviceVerifyButtons, { device: this.state.device,\n userId: this.props.event.getSender()\n });\n }\n\n return React.createElement(\n 'div',\n { className: 'mx_EncryptedEventDialog', onKeyDown: this.onKeyDown },\n React.createElement(\n 'div',\n { className: 'mx_Dialog_title' },\n (0, _languageHandler._t)('End-to-end encryption information')\n ),\n React.createElement(\n 'div',\n { className: 'mx_Dialog_content' },\n React.createElement(\n 'h4',\n null,\n (0, _languageHandler._t)('Event information')\n ),\n this._renderEventInfo(),\n React.createElement(\n 'h4',\n null,\n (0, _languageHandler._t)('Sender device information')\n ),\n this._renderDeviceInfo()\n ),\n React.createElement(\n 'div',\n { className: 'mx_Dialog_buttons' },\n React.createElement(\n 'button',\n { className: 'mx_Dialog_primary', onClick: this.props.onFinished, autoFocus: true },\n (0, _languageHandler._t)('OK')\n ),\n buttons\n )\n );\n }\n});\n//# sourceMappingURL=EncryptedEventDialog.js.map"],"sourceRoot":""} |