Skip to content

Instantly share code, notes, and snippets.

@nakasyou
Created August 19, 2023 01:05
Show Gist options
  • Save nakasyou/10d9423999a32e3fffe60ec105485c42 to your computer and use it in GitHub Desktop.
Save nakasyou/10d9423999a32e3fffe60ec105485c42 to your computer and use it in GitHub Desktop.
Olm
"use strict";// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt Apache-2.0
var Olm=function(){var b={},pn,cn,tn=(()=>{var H=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(H=H||__filename),function(I){I=I||{};var n;n||(n=typeof I<"u"?I:{});var _n,gn;n.ready=new Promise(function(t,e){_n=t,gn=e});var $;if(typeof window<"u")$=function(t){window.crypto.getRandomValues(t)};else if(module.exports){var Xn=require("crypto");$=function(t){var e=Xn.randomBytes(t.length);t.set(e)}}else throw Error("Cannot find global to attach library to");if(typeof OLM_OPTIONS<"u")for(var yn in OLM_OPTIONS)OLM_OPTIONS.hasOwnProperty(yn)&&(n[yn]=OLM_OPTIONS[yn]);n.onRuntimeInitialized=function(){z=n._olm_error(),b.PRIVATE_KEY_LENGTH=n._olm_pk_private_key_length(),pn&&pn()},n.onAbort=function(t){cn&&cn(t)};var Rn=Object.assign({},n),zn=typeof window=="object",B=typeof importScripts=="function",Pn=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",w="",fn,on,rn,hn,ln,dn;Pn?(w=B?require("path").dirname(w)+"/":__dirname+"/",dn=()=>{ln||(hn=require("fs"),ln=require("path"))},fn=function(t,e){return dn(),t=ln.normalize(t),hn.readFileSync(t,e?void 0:"utf8")},rn=t=>(t=fn(t,!0),t.buffer||(t=new Uint8Array(t)),t),on=(t,e,_)=>{dn(),t=ln.normalize(t),hn.readFile(t,function(o,r){o?_(o):e(r.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(t){throw t}),process.on("unhandledRejection",function(t){throw t}),n.inspect=function(){return"[Emscripten Module object]"}):(zn||B)&&(B?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),H&&(w=H),w.indexOf("blob:")!==0?w=w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):w="",fn=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},B&&(rn=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),on=(t,e,_)=>{var o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType="arraybuffer",o.onload=()=>{o.status==200||o.status==0&&o.response?e(o.response):_()},o.onerror=_,o.send(null)}),n.print||console.log.bind(console);var G=n.printErr||console.warn.bind(console);Object.assign(n,Rn),Rn=null;var V;n.wasmBinary&&(V=n.wasmBinary);var Zn=n.noExitRuntime||!0;typeof WebAssembly!="object"&&Y("no native wasm support detected");var kn,Un=!1,Tn=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(t,e){if(t){var _=X,o=t+e;for(e=t;_[e]&&!(e>=o);)++e;if(16<e-t&&_.buffer&&Tn)t=Tn.decode(_.subarray(t,e));else{for(o="";t<e;){var r=_[t++];if(r&128){var s=_[t++]&63;if((r&224)==192)o+=String.fromCharCode((r&31)<<6|s);else{var p=_[t++]&63;r=(r&240)==224?(r&15)<<12|s<<6|p:(r&7)<<18|s<<12|p<<6|_[t++]&63,65536>r?o+=String.fromCharCode(r):(r-=65536,o+=String.fromCharCode(55296|r>>10,56320|r&1023))}}else o+=String.fromCharCode(r)}t=o}}else t="";return t}function Ln(t,e,_,o){if(!(0<o))return 0;var r=_;o=_+o-1;for(var s=0;s<t.length;++s){var p=t.charCodeAt(s);if(55296<=p&&57343>=p){var d=t.charCodeAt(++s);p=65536+((p&1023)<<10)|d&1023}if(127>=p){if(_>=o)break;e[_++]=p}else{if(2047>=p){if(_+1>=o)break;e[_++]=192|p>>6}else{if(65535>=p){if(_+2>=o)break;e[_++]=224|p>>12}else{if(_+3>=o)break;e[_++]=240|p>>18,e[_++]=128|p>>12&63}e[_++]=128|p>>6&63}e[_++]=128|p&63}}return e[_]=0,_-r}function D(t,e,_){return Ln(t,X,e,_)}function q(t){for(var e=0,_=0;_<t.length;++_){var o=t.charCodeAt(_);127>=o?e++:2047>=o?e+=2:55296<=o&&57343>=o?(e+=4,++_):e+=3}return e}var Mn,C,X,bn,N,vn,$n,wn;function Hn(){var t=kn.buffer;Mn=t,n.HEAP8=C=new Int8Array(t),n.HEAP16=bn=new Int16Array(t),n.HEAP32=N=new Int32Array(t),n.HEAPU8=X=new Uint8Array(t),n.HEAPU16=new Uint16Array(t),n.HEAPU32=vn=new Uint32Array(t),n.HEAPF32=$n=new Float32Array(t),n.HEAPF64=wn=new Float64Array(t)}var In=[],Cn=[],Wn=[];function Kn(){var t=n.preRun.shift();In.unshift(t)}var W=0,xn=null,K=null;function Y(t){throw n.onAbort&&n.onAbort(t),t="Aborted("+t+")",G(t),Un=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),gn(t),t}function jn(){return x.startsWith("data:application/octet-stream;base64,")}var x;if(x="olm.wasm",!jn()){var Fn=x;x=n.locateFile?n.locateFile(Fn,w):w+Fn}function Dn(){var t=x;try{if(t==x&&V)return new Uint8Array(V);if(rn)return rn(t);throw"both async and sync fetching of the wasm failed"}catch(e){Y(e)}}function Yn(){if(!V&&(zn||B)){if(typeof fetch=="function"&&!x.startsWith("file://"))return fetch(x,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw"failed to load wasm binary file at '"+x+"'";return t.arrayBuffer()}).catch(function(){return Dn()});if(on)return new Promise(function(t,e){on(x,function(_){t(new Uint8Array(_))},e)})}return Promise.resolve().then(function(){return Dn()})}var An;function En(t){for(;0<t.length;)t.shift()(n)}function an(t,e="i8"){switch(e.endsWith("*")&&(e="*"),e){case"i1":return C[t>>0];case"i8":return C[t>>0];case"i16":return bn[t>>1];case"i32":return N[t>>2];case"i64":return N[t>>2];case"float":return $n[t>>2];case"double":return wn[t>>3];case"*":return vn[t>>2];default:Y("invalid type for getValue: "+e)}return null}function L(t){var e="i8";switch(e.endsWith("*")&&(e="*"),e){case"i1":C[t>>0]=0;break;case"i8":C[t>>0]=0;break;case"i16":bn[t>>1]=0;break;case"i32":N[t>>2]=0;break;case"i64":An=[0,0],N[t>>2]=An[0],N[t+4>>2]=An[1];break;case"float":$n[t>>2]=0;break;case"double":wn[t>>3]=0;break;case"*":vn[t>>2]=0;break;default:Y("invalid type for setValue: "+e)}}function J(t,e,_){for(var o=0;o<t.length;++o)C[e++>>0]=t.charCodeAt(o);_||(C[e>>0]=0)}function qn(t,e,_){return _=Array(0<_?_:q(t)+1),t=Ln(t,_,0,_.length),e&&(_.length=t),_}var Jn={b:function(t,e,_){X.copyWithin(t,e,e+_)},a:function(t){var e=X.length;if(t>>>=0,2147483648<t)return!1;for(var _=1;4>=_;_*=2){var o=e*(1+.2/_);o=Math.min(o,t+100663296);var r=Math;o=Math.max(t,o),r=r.min.call(r,2147483648,o+(65536-o%65536)%65536);n:{try{kn.grow(r-Mn.byteLength+65535>>>16),Hn();var s=1;break n}catch{}s=void 0}if(s)return!0}return!1}};(function(){function t(r){n.asm=r.exports,kn=n.asm.c,Hn(),Cn.unshift(n.asm.d),W--,n.monitorRunDependencies&&n.monitorRunDependencies(W),W==0&&(xn!==null&&(clearInterval(xn),xn=null),K&&(r=K,K=null,r()))}function e(r){t(r.instance)}function _(r){return Yn().then(function(s){return WebAssembly.instantiate(s,o)}).then(function(s){return s}).then(r,function(s){G("failed to asynchronously prepare wasm: "+s),Y(s)})}var o={a:Jn};if(W++,n.monitorRunDependencies&&n.monitorRunDependencies(W),n.instantiateWasm)try{return n.instantiateWasm(o,t)}catch(r){return G("Module.instantiateWasm callback failed with error: "+r),!1}return function(){return V||typeof WebAssembly.instantiateStreaming!="function"||jn()||x.startsWith("file://")||Pn||typeof fetch!="function"?_(e):fetch(x,{credentials:"same-origin"}).then(function(r){return WebAssembly.instantiateStreaming(r,o).then(e,function(s){return G("wasm streaming compile failed: "+s),G("falling back to ArrayBuffer instantiation"),_(e)})})}().catch(gn),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.d).apply(null,arguments)},n._olm_get_library_version=function(){return(n._olm_get_library_version=n.asm.f).apply(null,arguments)},n._olm_error=function(){return(n._olm_error=n.asm.g).apply(null,arguments)},n._olm_account_last_error=function(){return(n._olm_account_last_error=n.asm.h).apply(null,arguments)},n.__olm_error_to_string=function(){return(n.__olm_error_to_string=n.asm.i).apply(null,arguments)},n._olm_account_last_error_code=function(){return(n._olm_account_last_error_code=n.asm.j).apply(null,arguments)},n._olm_session_last_error=function(){return(n._olm_session_last_error=n.asm.k).apply(null,arguments)},n._olm_session_last_error_code=function(){return(n._olm_session_last_error_code=n.asm.l).apply(null,arguments)},n._olm_utility_last_error=function(){return(n._olm_utility_last_error=n.asm.m).apply(null,arguments)},n._olm_utility_last_error_code=function(){return(n._olm_utility_last_error_code=n.asm.n).apply(null,arguments)},n._olm_account_size=function(){return(n._olm_account_size=n.asm.o).apply(null,arguments)},n._olm_session_size=function(){return(n._olm_session_size=n.asm.p).apply(null,arguments)},n._olm_utility_size=function(){return(n._olm_utility_size=n.asm.q).apply(null,arguments)},n._olm_account=function(){return(n._olm_account=n.asm.r).apply(null,arguments)},n._olm_session=function(){return(n._olm_session=n.asm.s).apply(null,arguments)},n._olm_utility=function(){return(n._olm_utility=n.asm.t).apply(null,arguments)},n._olm_clear_account=function(){return(n._olm_clear_account=n.asm.u).apply(null,arguments)},n._olm_clear_session=function(){return(n._olm_clear_session=n.asm.v).apply(null,arguments)},n._olm_clear_utility=function(){return(n._olm_clear_utility=n.asm.w).apply(null,arguments)},n._olm_pickle_account_length=function(){return(n._olm_pickle_account_length=n.asm.x).apply(null,arguments)},n._olm_pickle_session_length=function(){return(n._olm_pickle_session_length=n.asm.y).apply(null,arguments)},n._olm_pickle_account=function(){return(n._olm_pickle_account=n.asm.z).apply(null,arguments)},n._olm_pickle_session=function(){return(n._olm_pickle_session=n.asm.A).apply(null,arguments)},n._olm_unpickle_account=function(){return(n._olm_unpickle_account=n.asm.B).apply(null,arguments)},n._olm_unpickle_session=function(){return(n._olm_unpickle_session=n.asm.C).apply(null,arguments)},n._olm_create_account_random_length=function(){return(n._olm_create_account_random_length=n.asm.D).apply(null,arguments)},n._olm_create_account=function(){return(n._olm_create_account=n.asm.E).apply(null,arguments)},n._olm_account_identity_keys_length=function(){return(n._olm_account_identity_keys_length=n.asm.F).apply(null,arguments)},n._olm_account_identity_keys=function(){return(n._olm_account_identity_keys=n.asm.G).apply(null,arguments)},n._olm_account_signature_length=function(){return(n._olm_account_signature_length=n.asm.H).apply(null,arguments)},n._olm_account_sign=function(){return(n._olm_account_sign=n.asm.I).apply(null,arguments)},n._olm_account_one_time_keys_length=function(){return(n._olm_account_one_time_keys_length=n.asm.J).apply(null,arguments)},n._olm_account_one_time_keys=function(){return(n._olm_account_one_time_keys=n.asm.K).apply(null,arguments)},n._olm_account_mark_keys_as_published=function(){return(n._olm_account_mark_keys_as_published=n.asm.L).apply(null,arguments)},n._olm_account_max_number_of_one_time_keys=function(){return(n._olm_account_max_number_of_one_time_keys=n.asm.M).apply(null,arguments)},n._olm_account_generate_one_time_keys_random_length=function(){return(n._olm_account_generate_one_time_keys_random_length=n.asm.N).apply(null,arguments)},n._olm_account_generate_one_time_keys=function(){return(n._olm_account_generate_one_time_keys=n.asm.O).apply(null,arguments)},n._olm_account_generate_fallback_key_random_length=function(){return(n._olm_account_generate_fallback_key_random_length=n.asm.P).apply(null,arguments)},n._olm_account_generate_fallback_key=function(){return(n._olm_account_generate_fallback_key=n.asm.Q).apply(null,arguments)},n._olm_account_fallback_key_length=function(){return(n._olm_account_fallback_key_length=n.asm.R).apply(null,arguments)},n._olm_account_fallback_key=function(){return(n._olm_account_fallback_key=n.asm.S).apply(null,arguments)},n._olm_account_unpublished_fallback_key_length=function(){return(n._olm_account_unpublished_fallback_key_length=n.asm.T).apply(null,arguments)},n._olm_account_unpublished_fallback_key=function(){return(n._olm_account_unpublished_fallback_key=n.asm.U).apply(null,arguments)},n._olm_account_forget_old_fallback_key=function(){return(n._olm_account_forget_old_fallback_key=n.asm.V).apply(null,arguments)},n._olm_create_outbound_session_random_length=function(){return(n._olm_create_outbound_session_random_length=n.asm.W).apply(null,arguments)},n._olm_create_outbound_session=function(){return(n._olm_create_outbound_session=n.asm.X).apply(null,arguments)},n._olm_create_inbound_session=function(){return(n._olm_create_inbound_session=n.asm.Y).apply(null,arguments)},n._olm_create_inbound_session_from=function(){return(n._olm_create_inbound_session_from=n.asm.Z).apply(null,arguments)},n._olm_session_id_length=function(){return(n._olm_session_id_length=n.asm._).apply(null,arguments)},n._olm_session_id=function(){return(n._olm_session_id=n.asm.$).apply(null,arguments)},n._olm_session_has_received_message=function(){return(n._olm_session_has_received_message=n.asm.aa).apply(null,arguments)},n._olm_session_describe=function(){return(n._olm_session_describe=n.asm.ba).apply(null,arguments)},n._olm_matches_inbound_session=function(){return(n._olm_matches_inbound_session=n.asm.ca).apply(null,arguments)},n._olm_matches_inbound_session_from=function(){return(n._olm_matches_inbound_session_from=n.asm.da).apply(null,arguments)},n._olm_remove_one_time_keys=function(){return(n._olm_remove_one_time_keys=n.asm.ea).apply(null,arguments)},n._olm_encrypt_message_type=function(){return(n._olm_encrypt_message_type=n.asm.fa).apply(null,arguments)},n._olm_encrypt_random_length=function(){return(n._olm_encrypt_random_length=n.asm.ga).apply(null,arguments)},n._olm_encrypt_message_length=function(){return(n._olm_encrypt_message_length=n.asm.ha).apply(null,arguments)},n._olm_encrypt=function(){return(n._olm_encrypt=n.asm.ia).apply(null,arguments)},n._olm_decrypt_max_plaintext_length=function(){return(n._olm_decrypt_max_plaintext_length=n.asm.ja).apply(null,arguments)},n._olm_decrypt=function(){return(n._olm_decrypt=n.asm.ka).apply(null,arguments)},n._olm_sha256_length=function(){return(n._olm_sha256_length=n.asm.la).apply(null,arguments)},n._olm_sha256=function(){return(n._olm_sha256=n.asm.ma).apply(null,arguments)},n._olm_ed25519_verify=function(){return(n._olm_ed25519_verify=n.asm.na).apply(null,arguments)},n._olm_pk_encryption_last_error=function(){return(n._olm_pk_encryption_last_error=n.asm.oa).apply(null,arguments)},n._olm_pk_encryption_last_error_code=function(){return(n._olm_pk_encryption_last_error_code=n.asm.pa).apply(null,arguments)},n._olm_pk_encryption_size=function(){return(n._olm_pk_encryption_size=n.asm.qa).apply(null,arguments)},n._olm_pk_encryption=function(){return(n._olm_pk_encryption=n.asm.ra).apply(null,arguments)},n._olm_clear_pk_encryption=function(){return(n._olm_clear_pk_encryption=n.asm.sa).apply(null,arguments)},n._olm_pk_encryption_set_recipient_key=function(){return(n._olm_pk_encryption_set_recipient_key=n.asm.ta).apply(null,arguments)},n._olm_pk_key_length=function(){return(n._olm_pk_key_length=n.asm.ua).apply(null,arguments)},n._olm_pk_ciphertext_length=function(){return(n._olm_pk_ciphertext_length=n.asm.va).apply(null,arguments)},n._olm_pk_mac_length=function(){return(n._olm_pk_mac_length=n.asm.wa).apply(null,arguments)},n._olm_pk_encrypt_random_length=function(){return(n._olm_pk_encrypt_random_length=n.asm.xa).apply(null,arguments)},n._olm_pk_encrypt=function(){return(n._olm_pk_encrypt=n.asm.ya).apply(null,arguments)},n._olm_pk_decryption_last_error=function(){return(n._olm_pk_decryption_last_error=n.asm.za).apply(null,arguments)},n._olm_pk_decryption_last_error_code=function(){return(n._olm_pk_decryption_last_error_code=n.asm.Aa).apply(null,arguments)},n._olm_pk_decryption_size=function(){return(n._olm_pk_decryption_size=n.asm.Ba).apply(null,arguments)},n._olm_pk_decryption=function(){return(n._olm_pk_decryption=n.asm.Ca).apply(null,arguments)},n._olm_clear_pk_decryption=function(){return(n._olm_clear_pk_decryption=n.asm.Da).apply(null,arguments)},n._olm_pk_private_key_length=function(){return(n._olm_pk_private_key_length=n.asm.Ea).apply(null,arguments)},n._olm_pk_generate_key_random_length=function(){return(n._olm_pk_generate_key_random_length=n.asm.Fa).apply(null,arguments)},n._olm_pk_key_from_private=function(){return(n._olm_pk_key_from_private=n.asm.Ga).apply(null,arguments)},n._olm_pk_generate_key=function(){return(n._olm_pk_generate_key=n.asm.Ha).apply(null,arguments)},n._olm_pickle_pk_decryption_length=function(){return(n._olm_pickle_pk_decryption_length=n.asm.Ia).apply(null,arguments)},n._olm_pickle_pk_decryption=function(){return(n._olm_pickle_pk_decryption=n.asm.Ja).apply(null,arguments)},n._olm_unpickle_pk_decryption=function(){return(n._olm_unpickle_pk_decryption=n.asm.Ka).apply(null,arguments)},n._olm_pk_max_plaintext_length=function(){return(n._olm_pk_max_plaintext_length=n.asm.La).apply(null,arguments)},n._olm_pk_decrypt=function(){return(n._olm_pk_decrypt=n.asm.Ma).apply(null,arguments)},n._olm_pk_get_private_key=function(){return(n._olm_pk_get_private_key=n.asm.Na).apply(null,arguments)},n._olm_pk_signing_size=function(){return(n._olm_pk_signing_size=n.asm.Oa).apply(null,arguments)},n._olm_pk_signing=function(){return(n._olm_pk_signing=n.asm.Pa).apply(null,arguments)},n._olm_pk_signing_last_error=function(){return(n._olm_pk_signing_last_error=n.asm.Qa).apply(null,arguments)},n._olm_pk_signing_last_error_code=function(){return(n._olm_pk_signing_last_error_code=n.asm.Ra).apply(null,arguments)},n._olm_clear_pk_signing=function(){return(n._olm_clear_pk_signing=n.asm.Sa).apply(null,arguments)},n._olm_pk_signing_seed_length=function(){return(n._olm_pk_signing_seed_length=n.asm.Ta).apply(null,arguments)},n._olm_pk_signing_public_key_length=function(){return(n._olm_pk_signing_public_key_length=n.asm.Ua).apply(null,arguments)},n._olm_pk_signing_key_from_seed=function(){return(n._olm_pk_signing_key_from_seed=n.asm.Va).apply(null,arguments)},n._olm_pk_signature_length=function(){return(n._olm_pk_signature_length=n.asm.Wa).apply(null,arguments)},n._olm_pk_sign=function(){return(n._olm_pk_sign=n.asm.Xa).apply(null,arguments)},n._olm_inbound_group_session_size=function(){return(n._olm_inbound_group_session_size=n.asm.Ya).apply(null,arguments)},n._olm_inbound_group_session=function(){return(n._olm_inbound_group_session=n.asm.Za).apply(null,arguments)},n._olm_clear_inbound_group_session=function(){return(n._olm_clear_inbound_group_session=n.asm._a).apply(null,arguments)},n._olm_inbound_group_session_last_error=function(){return(n._olm_inbound_group_session_last_error=n.asm.$a).apply(null,arguments)},n._olm_inbound_group_session_last_error_code=function(){return(n._olm_inbound_group_session_last_error_code=n.asm.ab).apply(null,arguments)},n._olm_init_inbound_group_session=function(){return(n._olm_init_inbound_group_session=n.asm.bb).apply(null,arguments)},n._olm_import_inbound_group_session=function(){return(n._olm_import_inbound_group_session=n.asm.cb).apply(null,arguments)},n._olm_pickle_inbound_group_session_length=function(){return(n._olm_pickle_inbound_group_session_length=n.asm.db).apply(null,arguments)},n._olm_pickle_inbound_group_session=function(){return(n._olm_pickle_inbound_group_session=n.asm.eb).apply(null,arguments)},n._olm_unpickle_inbound_group_session=function(){return(n._olm_unpickle_inbound_group_session=n.asm.fb).apply(null,arguments)},n._olm_group_decrypt_max_plaintext_length=function(){return(n._olm_group_decrypt_max_plaintext_length=n.asm.gb).apply(null,arguments)},n._olm_group_decrypt=function(){return(n._olm_group_decrypt=n.asm.hb).apply(null,arguments)},n._olm_inbound_group_session_id_length=function(){return(n._olm_inbound_group_session_id_length=n.asm.ib).apply(null,arguments)},n._olm_inbound_group_session_id=function(){return(n._olm_inbound_group_session_id=n.asm.jb).apply(null,arguments)},n._olm_inbound_group_session_first_known_index=function(){return(n._olm_inbound_group_session_first_known_index=n.asm.kb).apply(null,arguments)},n._olm_inbound_group_session_is_verified=function(){return(n._olm_inbound_group_session_is_verified=n.asm.lb).apply(null,arguments)},n._olm_export_inbound_group_session_length=function(){return(n._olm_export_inbound_group_session_length=n.asm.mb).apply(null,arguments)},n._olm_export_inbound_group_session=function(){return(n._olm_export_inbound_group_session=n.asm.nb).apply(null,arguments)},n._olm_outbound_group_session_size=function(){return(n._olm_outbound_group_session_size=n.asm.ob).apply(null,arguments)},n._olm_outbound_group_session=function(){return(n._olm_outbound_group_session=n.asm.pb).apply(null,arguments)},n._olm_clear_outbound_group_session=function(){return(n._olm_clear_outbound_group_session=n.asm.qb).apply(null,arguments)},n._olm_outbound_group_session_last_error=function(){return(n._olm_outbound_group_session_last_error=n.asm.rb).apply(null,arguments)},n._olm_outbound_group_session_last_error_code=function(){return(n._olm_outbound_group_session_last_error_code=n.asm.sb).apply(null,arguments)},n._olm_pickle_outbound_group_session_length=function(){return(n._olm_pickle_outbound_group_session_length=n.asm.tb).apply(null,arguments)},n._olm_pickle_outbound_group_session=function(){return(n._olm_pickle_outbound_group_session=n.asm.ub).apply(null,arguments)},n._olm_unpickle_outbound_group_session=function(){return(n._olm_unpickle_outbound_group_session=n.asm.vb).apply(null,arguments)},n._olm_init_outbound_group_session_random_length=function(){return(n._olm_init_outbound_group_session_random_length=n.asm.wb).apply(null,arguments)},n._olm_init_outbound_group_session=function(){return(n._olm_init_outbound_group_session=n.asm.xb).apply(null,arguments)},n._olm_group_encrypt_message_length=function(){return(n._olm_group_encrypt_message_length=n.asm.yb).apply(null,arguments)},n._olm_group_encrypt=function(){return(n._olm_group_encrypt=n.asm.zb).apply(null,arguments)},n._olm_outbound_group_session_id_length=function(){return(n._olm_outbound_group_session_id_length=n.asm.Ab).apply(null,arguments)},n._olm_outbound_group_session_id=function(){return(n._olm_outbound_group_session_id=n.asm.Bb).apply(null,arguments)},n._olm_outbound_group_session_message_index=function(){return(n._olm_outbound_group_session_message_index=n.asm.Cb).apply(null,arguments)},n._olm_outbound_group_session_key_length=function(){return(n._olm_outbound_group_session_key_length=n.asm.Db).apply(null,arguments)},n._olm_outbound_group_session_key=function(){return(n._olm_outbound_group_session_key=n.asm.Eb).apply(null,arguments)},n._olm_sas_last_error=function(){return(n._olm_sas_last_error=n.asm.Fb).apply(null,arguments)},n._olm_sas_last_error_code=function(){return(n._olm_sas_last_error_code=n.asm.Gb).apply(null,arguments)},n._olm_sas_size=function(){return(n._olm_sas_size=n.asm.Hb).apply(null,arguments)},n._olm_sas=function(){return(n._olm_sas=n.asm.Ib).apply(null,arguments)},n._olm_clear_sas=function(){return(n._olm_clear_sas=n.asm.Jb).apply(null,arguments)},n._olm_create_sas_random_length=function(){return(n._olm_create_sas_random_length=n.asm.Kb).apply(null,arguments)},n._olm_create_sas=function(){return(n._olm_create_sas=n.asm.Lb).apply(null,arguments)},n._olm_sas_pubkey_length=function(){return(n._olm_sas_pubkey_length=n.asm.Mb).apply(null,arguments)},n._olm_sas_get_pubkey=function(){return(n._olm_sas_get_pubkey=n.asm.Nb).apply(null,arguments)},n._olm_sas_set_their_key=function(){return(n._olm_sas_set_their_key=n.asm.Ob).apply(null,arguments)},n._olm_sas_is_their_key_set=function(){return(n._olm_sas_is_their_key_set=n.asm.Pb).apply(null,arguments)},n._olm_sas_generate_bytes=function(){return(n._olm_sas_generate_bytes=n.asm.Qb).apply(null,arguments)},n._olm_sas_mac_length=function(){return(n._olm_sas_mac_length=n.asm.Rb).apply(null,arguments)},n._olm_sas_calculate_mac_fixed_base64=function(){return(n._olm_sas_calculate_mac_fixed_base64=n.asm.Sb).apply(null,arguments)},n._olm_sas_calculate_mac=function(){return(n._olm_sas_calculate_mac=n.asm.Tb).apply(null,arguments)},n._olm_sas_calculate_mac_long_kdf=function(){return(n._olm_sas_calculate_mac_long_kdf=n.asm.Ub).apply(null,arguments)},n._malloc=function(){return(n._malloc=n.asm.Vb).apply(null,arguments)},n._free=function(){return(n._free=n.asm.Wb).apply(null,arguments)};var Nn=n.stackSave=function(){return(Nn=n.stackSave=n.asm.Xb).apply(null,arguments)},Bn=n.stackRestore=function(){return(Bn=n.stackRestore=n.asm.Yb).apply(null,arguments)},Gn=n.stackAlloc=function(){return(Gn=n.stackAlloc=n.asm.Zb).apply(null,arguments)};n.UTF8ToString=u,n.stringToUTF8=D,n.intArrayFromString=qn,n.writeAsciiToMemory=J,n.ALLOC_STACK=1;var sn;K=function t(){sn||Vn(),sn||(K=t)};function Vn(){function t(){if(!sn&&(sn=!0,n.calledRun=!0,!Un)){if(En(Cn),_n(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var e=n.postRun.shift();Wn.unshift(e)}En(Wn)}}if(!(0<W)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)Kn();En(In),0<W||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),t()},1)):t())}}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.pop()();Vn();function U(){var t=n._olm_outbound_group_session_size();this.ac=c(t),this.$b=n._olm_outbound_group_session(this.ac)}function v(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_outbound_group_session_last_error(arguments[0])),Error("OLM."+e);return e}}U.prototype.free=function(){n._olm_clear_outbound_group_session(this.$b),g(this.$b)},U.prototype.pickle=a(function(t){t=i(t);var e=v(n._olm_pickle_outbound_group_session_length)(this.$b),_=l(t),o=l(e+1);try{v(n._olm_pickle_outbound_group_session)(this.$b,_,t.length,o,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(o,e)}),U.prototype.unpickle=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e);try{v(n._olm_unpickle_outbound_group_session)(this.$b,_,t.length,o,e.length)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}}),U.prototype.create=a(function(){var t=v(n._olm_init_outbound_group_session_random_length)(this.$b),e=E(t,$);try{v(n._olm_init_outbound_group_session)(this.$b,e,t)}finally{m(e,t)}}),U.prototype.encrypt=function(t){try{var e=q(t),_=v(n._olm_group_encrypt_message_length)(this.$b,e),o=c(e+1);D(t,o,e+1);var r=c(_+1);return v(n._olm_group_encrypt)(this.$b,o,e,r,_),L(r+_),u(r,_)}finally{o!==void 0&&(m(o,e+1),g(o)),r!==void 0&&g(r)}},U.prototype.session_id=a(function(){var t=v(n._olm_outbound_group_session_id_length)(this.$b),e=l(t+1);return v(n._olm_outbound_group_session_id)(this.$b,e,t),u(e,t)}),U.prototype.session_key=a(function(){var t=v(n._olm_outbound_group_session_key_length)(this.$b),e=l(t+1);v(n._olm_outbound_group_session_key)(this.$b,e,t);var _=u(e,t);return m(e,t),_}),U.prototype.message_index=function(){return v(n._olm_outbound_group_session_message_index)(this.$b)},b.OutboundGroupSession=U;function R(){var t=n._olm_inbound_group_session_size();this.ac=c(t),this.$b=n._olm_inbound_group_session(this.ac)}function S(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_inbound_group_session_last_error(arguments[0])),Error("OLM."+e);return e}}R.prototype.free=function(){n._olm_clear_inbound_group_session(this.$b),g(this.$b)},R.prototype.pickle=a(function(t){t=i(t);var e=S(n._olm_pickle_inbound_group_session_length)(this.$b),_=l(t),o=l(e+1);try{S(n._olm_pickle_inbound_group_session)(this.$b,_,t.length,o,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(o,e)}),R.prototype.unpickle=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e);try{S(n._olm_unpickle_inbound_group_session)(this.$b,_,t.length,o,e.length)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}}),R.prototype.create=a(function(t){t=i(t);var e=l(t);try{S(n._olm_init_inbound_group_session)(this.$b,e,t.length)}finally{for(m(e,t.length),e=0;e<t.length;e++)t[e]=0}}),R.prototype.import_session=a(function(t){t=i(t);var e=l(t);try{S(n._olm_import_inbound_group_session)(this.$b,e,t.length)}finally{for(m(e,t.length),e=0;e<t.length;e++)t[e]=0}}),R.prototype.decrypt=a(function(t){try{var e=c(t.length);J(t,e,!0);var _=S(n._olm_group_decrypt_max_plaintext_length)(this.$b,e,t.length);J(t,e,!0);var o=c(_+1),r=l(4),s=S(n._olm_group_decrypt)(this.$b,e,t.length,o,_,r);return L(o+s),{plaintext:u(o,s),message_index:an(r,"i32")}}finally{e!==void 0&&g(e),o!==void 0&&(m(o,s),g(o))}}),R.prototype.session_id=a(function(){var t=S(n._olm_inbound_group_session_id_length)(this.$b),e=l(t+1);return S(n._olm_inbound_group_session_id)(this.$b,e,t),u(e,t)}),R.prototype.first_known_index=a(function(){return S(n._olm_inbound_group_session_first_known_index)(this.$b)}),R.prototype.export_session=a(function(t){var e=S(n._olm_export_inbound_group_session_length)(this.$b),_=l(e+1);return v(n._olm_export_inbound_group_session)(this.$b,_,e,t),t=u(_,e),m(_,e),t}),b.InboundGroupSession=R;function un(){var t=n._olm_pk_encryption_size();this.ac=c(t),this.$b=n._olm_pk_encryption(this.ac)}function j(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_pk_encryption_last_error(arguments[0])),Error("OLM."+e);return e}}un.prototype.free=function(){n._olm_clear_pk_encryption(this.$b),g(this.$b)},un.prototype.set_recipient_key=a(function(t){t=i(t);var e=l(t);j(n._olm_pk_encryption_set_recipient_key)(this.$b,e,t.length)}),un.prototype.encrypt=a(function(t){try{var e=q(t),_=c(e+1);D(t,_,e+1);var o=j(n._olm_pk_encrypt_random_length)(),r=E(o,$),s=j(n._olm_pk_ciphertext_length)(this.$b,e),p=c(s+1),d=j(n._olm_pk_mac_length)(this.$b),nn=l(d+1);L(nn+d);var F=j(n._olm_pk_key_length)(),P=l(F+1);return L(P+F),j(n._olm_pk_encrypt)(this.$b,_,e,p,s,nn,d,P,F,r,o),L(p+s),{ciphertext:u(p,s),mac:u(nn,d),ephemeral:u(P,F)}}finally{r!==void 0&&m(r,o),_!==void 0&&(m(_,e+1),g(_)),p!==void 0&&g(p)}});function M(){var t=n._olm_pk_decryption_size();this.ac=c(t),this.$b=n._olm_pk_decryption(this.ac)}function A(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_pk_decryption_last_error(arguments[0])),Error("OLM."+e);return e}}M.prototype.free=function(){n._olm_clear_pk_decryption(this.$b),g(this.$b)},M.prototype.init_with_private_key=a(function(t){var e=l(t.length);n.HEAPU8.set(t,e);var _=A(n._olm_pk_key_length)(),o=l(_+1);try{A(n._olm_pk_key_from_private)(this.$b,o,_,e,t.length)}finally{m(e,t.length)}return u(o,_)}),M.prototype.generate_key=a(function(){var t=A(n._olm_pk_private_key_length)(),e=E(t,$),_=A(n._olm_pk_key_length)(),o=l(_+1);try{A(n._olm_pk_key_from_private)(this.$b,o,_,e,t)}finally{m(e,t)}return u(o,_)}),M.prototype.get_private_key=a(function(){var t=j(n._olm_pk_private_key_length)(),e=l(t);A(n._olm_pk_get_private_key)(this.$b,e,t);var _=new Uint8Array(new Uint8Array(n.HEAPU8.buffer,e,t));return m(e,t),_}),M.prototype.pickle=a(function(t){t=i(t);var e=A(n._olm_pickle_pk_decryption_length)(this.$b),_=l(t),o=l(e+1);try{A(n._olm_pickle_pk_decryption)(this.$b,_,t.length,o,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(o,e)}),M.prototype.unpickle=a(function(t,e){t=i(t);var _=l(t),o=i(e),r=l(o);e=A(n._olm_pk_key_length)();var s=l(e+1);try{A(n._olm_unpickle_pk_decryption)(this.$b,_,t.length,r,o.length,s,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(s,e)}),M.prototype.decrypt=a(function(t,e,_){try{var o=q(_),r=c(o+1);D(_,r,o+1);var s=i(t),p=l(s),d=i(e),nn=l(d),F=A(n._olm_pk_max_plaintext_length)(this.$b,o),P=c(F+1),On=A(n._olm_pk_decrypt)(this.$b,p,s.length,nn,d.length,r,o,P,F);return L(P+On),u(P,On)}finally{P!==void 0&&(m(P,On+1),g(P)),r!==void 0&&g(r)}});function Z(){var t=n._olm_pk_signing_size();this.ac=c(t),this.$b=n._olm_pk_signing(this.ac)}function Q(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_pk_signing_last_error(arguments[0])),Error("OLM."+e);return e}}Z.prototype.free=function(){n._olm_clear_pk_signing(this.$b),g(this.$b)},Z.prototype.init_with_seed=a(function(t){var e=l(t.length);n.HEAPU8.set(t,e);var _=Q(n._olm_pk_signing_public_key_length)(),o=l(_+1);try{Q(n._olm_pk_signing_key_from_seed)(this.$b,o,_,e,t.length)}finally{m(e,t.length)}return u(o,_)}),Z.prototype.generate_seed=a(function(){var t=Q(n._olm_pk_signing_seed_length)(),e=E(t,$),_=new Uint8Array(new Uint8Array(n.HEAPU8.buffer,e,t));return m(e,t),_}),Z.prototype.sign=a(function(t){try{var e=q(t),_=c(e+1);D(t,_,e+1);var o=Q(n._olm_pk_signature_length)(),r=l(o+1);return Q(n._olm_pk_sign)(this.$b,_,e,r,o),u(r,o)}finally{_!==void 0&&(m(_,e+1),g(_))}});function T(){var t=n._olm_sas_size(),e=n._olm_create_sas_random_length(),_=E(e,$);this.ac=c(t),this.$b=n._olm_sas(this.ac),n._olm_create_sas(this.$b,_,e),m(_,e)}function O(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_sas_last_error(arguments[0])),Error("OLM."+e);return e}}T.prototype.free=function(){n._olm_clear_sas(this.$b),g(this.$b)},T.prototype.get_pubkey=a(function(){var t=O(n._olm_sas_pubkey_length)(this.$b),e=l(t+1);return O(n._olm_sas_get_pubkey)(this.$b,e,t),u(e,t)}),T.prototype.set_their_key=a(function(t){t=i(t);var e=l(t);O(n._olm_sas_set_their_key)(this.$b,e,t.length)}),T.prototype.is_their_key_set=a(function(){return!!O(n._olm_sas_is_their_key_set)(this.$b)}),T.prototype.generate_bytes=a(function(t,e){t=i(t);var _=l(t),o=l(e);return O(n._olm_sas_generate_bytes)(this.$b,_,t.length,o,e),new Uint8Array(new Uint8Array(n.HEAPU8.buffer,o,e))}),T.prototype.calculate_mac=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e),r=O(n._olm_sas_mac_length)(this.$b),s=l(r+1);return O(n._olm_sas_calculate_mac)(this.$b,_,t.length,o,e.length,s,r),u(s,r)}),T.prototype.calculate_mac_fixed_base64=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e),r=O(n._olm_sas_mac_length)(this.$b),s=l(r+1);return O(n._olm_sas_calculate_mac_fixed_base64)(this.$b,_,t.length,o,e.length,s,r),u(s,r)}),T.prototype.calculate_mac_long_kdf=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e),r=O(n._olm_sas_mac_length)(this.$b),s=l(r+1);return O(n._olm_sas_calculate_mac_long_kdf)(this.$b,_,t.length,o,e.length,s,r),u(s,r)});var c=n._malloc,g=n._free,z;function E(t,e){var _=Gn(t);return e(new Uint8Array(n.HEAPU8.buffer,_,t)),_}function l(t){return typeof t=="number"?E(t,function(e){e.fill(0)}):E(t.length,function(e){e.set(t)})}function i(t){return t instanceof Uint8Array?t:qn(t,!0)}function a(t){return function(){var e=Nn();try{return t.apply(this,arguments)}finally{Bn(e)}}}function m(t,e){for(;0<e--;)n.HEAP8[t++]=0}function h(){var t=n._olm_account_size();this.ac=c(t),this.$b=n._olm_account(this.ac)}function y(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_account_last_error(arguments[0])),Error("OLM."+e);return e}}h.prototype.free=function(){n._olm_clear_account(this.$b),g(this.$b)},h.prototype.create=a(function(){var t=y(n._olm_create_account_random_length)(this.$b),e=E(t,$);try{y(n._olm_create_account)(this.$b,e,t)}finally{m(e,t)}}),h.prototype.identity_keys=a(function(){var t=y(n._olm_account_identity_keys_length)(this.$b),e=l(t+1);return y(n._olm_account_identity_keys)(this.$b,e,t),u(e,t)}),h.prototype.sign=a(function(t){var e=y(n._olm_account_signature_length)(this.$b);t=i(t);var _=l(t),o=l(e+1);try{y(n._olm_account_sign)(this.$b,_,t.length,o,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(o,e)}),h.prototype.one_time_keys=a(function(){var t=y(n._olm_account_one_time_keys_length)(this.$b),e=l(t+1);return y(n._olm_account_one_time_keys)(this.$b,e,t),u(e,t)}),h.prototype.mark_keys_as_published=a(function(){y(n._olm_account_mark_keys_as_published)(this.$b)}),h.prototype.max_number_of_one_time_keys=a(function(){return y(n._olm_account_max_number_of_one_time_keys)(this.$b)}),h.prototype.generate_one_time_keys=a(function(t){var e=y(n._olm_account_generate_one_time_keys_random_length)(this.$b,t),_=E(e,$);try{y(n._olm_account_generate_one_time_keys)(this.$b,t,_,e)}finally{m(_,e)}}),h.prototype.remove_one_time_keys=a(function(t){y(n._olm_remove_one_time_keys)(this.$b,t.$b)}),h.prototype.generate_fallback_key=a(function(){var t=y(n._olm_account_generate_fallback_key_random_length)(this.$b),e=E(t,$);try{y(n._olm_account_generate_fallback_key)(this.$b,e,t)}finally{m(e,t)}}),h.prototype.fallback_key=a(function(){var t=y(n._olm_account_fallback_key_length)(this.$b),e=l(t+1);return y(n._olm_account_fallback_key)(this.$b,e,t),u(e,t)}),h.prototype.unpublished_fallback_key=a(function(){var t=y(n._olm_account_unpublished_fallback_key_length)(this.$b),e=l(t+1);return y(n._olm_account_unpublished_fallback_key)(this.$b,e,t),u(e,t)}),h.prototype.forget_old_fallback_key=a(function(){y(n._olm_account_forget_old_fallback_key)(this.$b)}),h.prototype.pickle=a(function(t){t=i(t);var e=y(n._olm_pickle_account_length)(this.$b),_=l(t),o=l(e+1);try{y(n._olm_pickle_account)(this.$b,_,t.length,o,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(o,e)}),h.prototype.unpickle=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e);try{y(n._olm_unpickle_account)(this.$b,_,t.length,o,e.length)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}});function k(){var t=n._olm_session_size();this.ac=c(t),this.$b=n._olm_session(this.ac)}function f(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_session_last_error(arguments[0])),Error("OLM."+e);return e}}k.prototype.free=function(){n._olm_clear_session(this.$b),g(this.$b)},k.prototype.pickle=a(function(t){t=i(t);var e=f(n._olm_pickle_session_length)(this.$b),_=l(t),o=l(e+1);try{f(n._olm_pickle_session)(this.$b,_,t.length,o,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(o,e)}),k.prototype.unpickle=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e);try{f(n._olm_unpickle_session)(this.$b,_,t.length,o,e.length)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}}),k.prototype.create_outbound=a(function(t,e,_){var o=f(n._olm_create_outbound_session_random_length)(this.$b),r=E(o,$);e=i(e),_=i(_);var s=l(e),p=l(_);try{f(n._olm_create_outbound_session)(this.$b,t.$b,s,e.length,p,_.length,r,o)}finally{m(r,o)}}),k.prototype.create_inbound=a(function(t,e){e=i(e);var _=l(e);try{f(n._olm_create_inbound_session)(this.$b,t.$b,_,e.length)}finally{for(m(_,e.length),t=0;t<e.length;t++)e[t]=0}}),k.prototype.create_inbound_from=a(function(t,e,_){e=i(e);var o=l(e);_=i(_);var r=l(_);try{f(n._olm_create_inbound_session_from)(this.$b,t.$b,o,e.length,r,_.length)}finally{for(m(r,_.length),t=0;t<_.length;t++)_[t]=0}}),k.prototype.session_id=a(function(){var t=f(n._olm_session_id_length)(this.$b),e=l(t+1);return f(n._olm_session_id)(this.$b,e,t),u(e,t)}),k.prototype.has_received_message=function(){return!!f(n._olm_session_has_received_message)(this.$b)},k.prototype.matches_inbound=a(function(t){t=i(t);var e=l(t);return!!f(n._olm_matches_inbound_session)(this.$b,e,t.length)}),k.prototype.matches_inbound_from=a(function(t,e){t=i(t);var _=l(t);e=i(e);var o=l(e);return!!f(n._olm_matches_inbound_session_from)(this.$b,_,t.length,o,e.length)}),k.prototype.encrypt=a(function(t){try{var e=f(n._olm_encrypt_random_length)(this.$b),_=f(n._olm_encrypt_message_type)(this.$b),o=q(t),r=f(n._olm_encrypt_message_length)(this.$b,o),s=E(e,$),p=c(o+1);D(t,p,o+1);var d=c(r+1);return f(n._olm_encrypt)(this.$b,p,o,s,e,d,r),L(d+r),{type:_,body:u(d,r)}}finally{s!==void 0&&m(s,e),p!==void 0&&(m(p,o+1),g(p)),d!==void 0&&g(d)}}),k.prototype.decrypt=a(function(t,e){try{var _=c(e.length);J(e,_,!0);var o=f(n._olm_decrypt_max_plaintext_length)(this.$b,t,_,e.length);J(e,_,!0);var r=c(o+1),s=f(n._olm_decrypt)(this.$b,t,_,e.length,r,o);return L(r+s),u(r,s)}finally{_!==void 0&&g(_),r!==void 0&&(m(r,o),g(r))}}),k.prototype.describe=a(function(){try{var t=c(256);return f(n._olm_session_describe)(this.$b,t,256),u(t)}finally{t!==void 0&&g(t)}});function mn(){var t=n._olm_utility_size();this.ac=c(t),this.$b=n._olm_utility(this.ac)}function Sn(t){return function(){var e=t.apply(this,arguments);if(e===z)throw e=u(n._olm_utility_last_error(arguments[0])),Error("OLM."+e);return e}}return mn.prototype.free=function(){n._olm_clear_utility(this.$b),g(this.$b)},mn.prototype.sha256=a(function(t){var e=Sn(n._olm_sha256_length)(this.$b);t=i(t);var _=l(t),o=l(e+1);try{Sn(n._olm_sha256)(this.$b,_,t.length,o,e)}finally{for(m(_,t.length),_=0;_<t.length;_++)t[_]=0}return u(o,e)}),mn.prototype.ed25519_verify=a(function(t,e,_){t=i(t);var o=l(t);e=i(e);var r=l(e);_=i(_);var s=l(_);try{Sn(n._olm_ed25519_verify)(this.$b,o,t.length,r,e.length,s,_.length)}finally{for(m(r,e.length),t=0;t<e.length;t++)e[t]=0}}),b.Account=h,b.Session=k,b.Utility=mn,b.PkEncryption=un,b.PkDecryption=M,b.PkSigning=Z,b.SAS=T,b.get_library_version=a(function(){var t=l(3);return n._olm_get_library_version(t,t+1,t+2),[an(t,"i8"),an(t+1,"i8"),an(t+2,"i8")]}),I.ready}})();typeof exports=="object"&&typeof module=="object"?module.exports=tn:typeof define=="function"&&define.amd?define([],function(){return tn}):typeof exports=="object"&&(exports.Module=tn);var en;return b.init=function(H){return en||(H&&(OLM_OPTIONS=H),en=new Promise(function(I,n){pn=function(){I()},cn=function(_n){n(_n)},tn()}),en)},b}();typeof window<"u"&&(window.Olm=Olm),typeof module=="object"&&(module.exports=Olm);// @license-end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment