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
8.0 KiB

{"version":3,"sources":["webpack:///./node_modules/matrix-react-sdk/src/async-components/views/dialogs/security/ImportE2eKeysDialog.js","webpack:///./node_modules/matrix-react-sdk/src/utils/MegolmExportEncryption.js"],"names":["ImportE2eKeysDialog","React","Component","constructor","props","super","ev","files","this","_file","current","setState","enableSubmit","_passphrase","value","length","preventDefault","_startImport","onFinished","_unmounted","createRef","state","phase","errStr","componentWillUnmount","file","passphrase","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsArrayBuffer","readFileAsArrayBuffer","then","arrayBuffer","MegolmExportEncryption","keys","matrixClient","importRoomKeys","JSON","parse","catch","console","error","msg","friendlyText","_t","render","BaseDialog","sdk","disableForm","className","title","onSubmit","_onFormSubmit","htmlFor","ref","id","type","autoFocus","onChange","_onFormChange","disabled","size","onClick","_onCancelClick","PropTypes","instanceOf","MatrixClient","isRequired","func","TextEncoder","window","TextEncodingUtf8","TextDecoder","subtleCrypto","crypto","subtle","webkitSubtle","friendlyError","Error","cryptoFailMsg","async","decryptMegolmKeyFile","data","password","body","fileStr","decode","Uint8Array","lineStart","lineEnd","indexOf","line","slice","trim","HEADER_LINE","dataStart","undefined","dataEnd","base64","latin1String","atob","uint8Array","i","charCodeAt","decodeBase64","unpackMegolmKeyFile","brand","SdkConfig","get","ciphertextLength","salt","subarray","iv","iterations","ciphertext","hmac","aesKey","hmacKey","deriveKeys","toVerify","isValid","plaintext","verify","name","decrypt","counter","encryptMegolmKeyFile","options","kdfRounds","kdf_rounds","getRandomValues","encodedData","encode","encrypt","cipherArray","bodyLength","resultBuffer","idx","set","toSign","sign","hmacArray","nLines","Math","ceil","lines","Array","o","encodeBase64","join","buffer","packMegolmKeyFile","start","Date","key","keybits","importKey","deriveBits","hash","now","log","aesProm","hmacProm","all","String","fromCharCode","apply","btoa"],"mappings":"mOAuCe,MAAMA,UAA4BC,IAAMC,UAMnDC,YAAYC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